Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cec9d207c1b775717dcdd9b63460b99d7907e661
      
https://github.com/WebKit/WebKit/commit/cec9d207c1b775717dcdd9b63460b99d7907e661
  Author: Anne van Kesteren <[email protected]>
  Date:   2026-08-27 (Thu, 27 Aug 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/WEB_FEATURES.yml
    A 
LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/target-pseudo-after-adoption-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/target-pseudo-after-adoption.html
    M 
LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/target-pseudo-after-reinsertion-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/w3c-import.log
    A 
LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/document-with-fragment-removed-target-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/document-with-fragment-removed-target.html
    M 
LayoutTests/imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/w3c-import.log
    M Source/WebCore/dom/Element.cpp

  Log Message:
  -----------
  :target should keep matching a target element that is removed and reinserted
https://bugs.webkit.org/show_bug.cgi?id=322720

Reviewed by Tim Nguyen.

A Document's target element is only set by the scroll to the fragment
algorithm; nothing sets it to null when the element is removed from the
document. WebKit cleared it on removal since 2008 (23144@main) to avoid a
dangling raw pointer, which is no longer a concern now that m_cssTarget
is a WeakPtr. Gecko already behaved this way and Chromium made the same
change in 2024, so this aligns all engines with the HTML Standard.

Tests: 
imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/target-pseudo-after-adoption.html
       
imported/w3c/web-platform-tests/html/interaction/focus/the-autofocus-attribute/document-with-fragment-removed-target.html

WPT PR: https://github.com/web-platform-tests/wpt/pull/62238

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



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

Reply via email to