[webkit-changes] [WebKit/WebKit] e2e8c4: Element reflection attributes should be able to re...
Tyler Wilcock
noreply at github.com
Tue Aug 13 16:00:34 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e2e8c4d0c409bcc8195459ee8c2279a9174b95ea
https://github.com/WebKit/WebKit/commit/e2e8c4d0c409bcc8195459ee8c2279a9174b95ea
Author: Tyler Wilcock <tyler_w at apple.com>
Date: 2024-08-13 (Tue, 13 Aug 2024)
Changed paths:
M LayoutTests/imported/w3c/web-platform-tests/html/dom/aria-element-reflection-disconnected-expected.txt
M Source/WebCore/dom/Element.cpp
Log Message:
-----------
Element reflection attributes should be able to retrieve disconnected elements
https://bugs.webkit.org/show_bug.cgi?id=277956
rdar://133693674
Reviewed by Ryosuke Niwa.
Because disconnected elements are not stored in TreeScope::m_elementsById,
we failed to return them from element reflection getters `Element::getElementAttribute`
and `Element::getElementsArrayAttribute`. But the spec does not require elements
to be connected to be returned from these mechanisms:
https://html.spec.whatwg.org/#attr-associated-element
This patch fixes this by continuing to use TreeScope::getElementById() for connected elements,
and walking the tree to find the element-by-id for disconnected elements.
Inspired by https://github.com/chromium/chromium/commit/b237124847af1f6a8316af8fb5c78e35bd03df0a.
* LayoutTests/imported/w3c/web-platform-tests/html/dom/aria-element-reflection-disconnected-expected.txt:
Mark this test as passing.
* Source/WebCore/dom/Element.cpp:
(WebCore::getElementByIdIncludingDisconnected):
Added.
(WebCore::Element::getElementAttribute const):
(WebCore::Element::getElementsArrayAttribute const):
Handle disconnected nodes.
(WebCore::Element::customElementDefaultARIA):
Drive-by fix to spelling: deafult -> default
Canonical link: https://commits.webkit.org/282204@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list