Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d4093dea3b7cfce7d9f43f7d8c79438f2f7046e9
      
https://github.com/WebKit/WebKit/commit/d4093dea3b7cfce7d9f43f7d8c79438f2f7046e9
  Author: Rupin Mittal <[email protected]>
  Date:   2026-08-11 (Tue, 11 Aug 2026)

  Changed paths:
    A 
LayoutTests/navigation-api/navigate-event-source-element-is-initiating-anchor-expected.txt
    A 
LayoutTests/navigation-api/navigate-event-source-element-is-initiating-anchor.html
    M Source/WebCore/loader/FrameLoader.cpp

  Log Message:
  -----------
  [Navigation API] SourceElement is the element responsible for the navigation, 
not the deepest element that was clicked
https://bugs.webkit.org/show_bug.cgi?id=321490
rdar://184581613

Reviewed by Jessica Lee.

The HTML spec 
(https://html.spec.whatwg.org/multipage/links.html#following-hyperlinks)
says that sourceElement is the element responsible for the navigation (e.g. the 
<a>),
not the deepest node that happened to be clicked. This is already correctly set 
on the
FrameLoadRequest, so we reuse it. Fall back to the event target for callers 
that don't
supply an initiating element since that is the current behavior so these 
callers aren't
broken.

This makes us match Chrome and is covered by a new layout test:
navigate-event-source-element-is-initiating-anchor.html

* 
LayoutTests/navigation-api/navigate-event-source-element-is-initiating-anchor-expected.txt:
 Added.
* 
LayoutTests/navigation-api/navigate-event-source-element-is-initiating-anchor.html:
 Added.
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::dispatchNavigateEvent):

Canonical link: https://commits.webkit.org/319005@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to