Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 79220593a514d9634da76dc774d6b357d2708605
https://github.com/WebKit/WebKit/commit/79220593a514d9634da76dc774d6b357d2708605
Author: Ahmad Saleem <[email protected]>
Date: 2026-10-06 (Tue, 06 Oct 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/global-attributes/dataset-get-invalid-names-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/global-attributes/dataset-get-invalid-names.html
M Source/WebCore/dom/DatasetDOMStringMap.cpp
Log Message:
-----------
element.dataset named getter matches non-data-* attributes and invalid
property names
https://bugs.webkit.org/show_bug.cgi?id=326462
rdar://189263319
Reviewed by Ryosuke Niwa.
This patch aligns WebKit with Gecko / Firefox.
DatasetDOMStringMap's single-attribute fast path stripped the first five
characters of any attribute name without checking for the "data-" prefix,
so <div aria-label=x> exposed dataset.label === "x". The multi-attribute
path converted the property name to an attribute name without validating
it, so dataset["foo-bar"] matched data-foo-bar.
Check isValidAttributeName() in the fast path and isValidPropertyName()
in the multi-attribute path, in both item() and isSupportedPropertyName().
Test:
imported/w3c/web-platform-tests/html/dom/elements/global-attributes/dataset-get-invalid-names.html
*
LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/global-attributes/dataset-get-invalid-names-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/global-attributes/dataset-get-invalid-names.html:
Added.
* Source/WebCore/dom/DatasetDOMStringMap.cpp:
(WebCore::DatasetDOMStringMap::isSupportedPropertyName const):
(WebCore::DatasetDOMStringMap::item const):
Canonical link: https://commits.webkit.org/322936@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications