Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e73be17fcf29f32a3ab98299d62a7f3ada3eeea9
https://github.com/WebKit/WebKit/commit/e73be17fcf29f32a3ab98299d62a7f3ada3eeea9
Author: Ahmad Saleem <[email protected]>
Date: 2026-09-29 (Tue, 29 Sep 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/svg/struct/scripted/autofocus-attribute-expected.txt
M Source/WebCore/dom/Document.cpp
Log Message:
-----------
document.activeElement should return the document element for bodyless
documents (SVG/XML)
https://bugs.webkit.org/show_bug.cgi?id=325615
rdar://188675160
Reviewed by Ryosuke Niwa.
Document::activeElement() fell back to bodyOrFrameset() when no element was
focused. For SVG documents (and any bodyless XML/HTML document) there is no
body element, so activeElement returned null instead of the document element.
The activeElement steps require, when nothing is focused, returning the body
element if present, and otherwise the document element:
https://html.spec.whatwg.org/C/#dom-documentorshadowroot-activeelement (step 6).
WebKit only implemented the body case.
Add the missing document-element fallback. A raw pointer is used rather than a
RefPtr because RefPtr::get() is lifetimebound, so returning it from a stack
local would be flagged as returning a dangling pointer.
*
LayoutTests/imported/w3c/web-platform-tests/svg/struct/scripted/autofocus-attribute-expected.txt:
Progression
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::activeElement):
Canonical link: https://commits.webkit.org/322233@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications