Bug 123890 - data-x-2="" not represented in dataset
Summary: data-x-2="" not represented in dataset
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-11-06 05:36 PST by Simon Pieters (:zcorpan)
Modified: 2022-08-20 21:13 PDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Pieters (:zcorpan) 2013-11-06 05:36:13 PST
Test case: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2622

<!doctype html>
<script data-x-2=x>document.write(document.querySelector("script").dataset.length == 1 ? 'PASS' : 'FAIL')</script> 

Spec: http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#dom-dataset

Note that the spec says ASCII *letter*, so step 3 is no-op for this case.

Similar issue in Blink: https://code.google.com/p/chromium/issues/detail?id=171175
Comment 1 Ahmad Saleem 2022-08-11 14:46:27 PDT
All browsers (Chrome Canary 106, Firefox Nightly 105 and Safari 15.6 on macOS 12.5) show "FAIL" for this test case. Is this something removed from Web-Spec or not implemented by all browsers. Just wanted to share updated status. Thanks!
Comment 2 Ryosuke Niwa 2022-08-11 14:49:01 PDT
All browsers agree -> config changed.
Comment 3 Alexey Proskuryakov 2022-08-19 19:44:56 PDT
Sadly no, this works in Firefox and in Chrome, but fails in Safari. 

The reason why the test fails in all browsers is that DOMStringMap doesn't have a length property, but if you look at document.querySelector("script").dataset in developer tools, other browsers have the correct value, and we have "x-2 -> undefined".
Comment 4 Ryosuke Niwa 2022-08-20 00:16:53 PDT
wow, this is so bad. DOMStringDataset has a different code just for when there is exactly one attribute and it's precisely why it fails in that particular case.
Comment 5 Ryosuke Niwa 2022-08-20 01:06:00 PDT
Pull request: https://github.com/WebKit/WebKit/pull/3498
Comment 6 EWS 2022-08-20 21:12:10 PDT
Committed 253625@main (8a40482a9c10): <https://commits.webkit.org/253625@main>

Reviewed commits have been landed. Closing PR #3498 and removing active labels.
Comment 7 Radar WebKit Bug Importer 2022-08-20 21:13:31 PDT
<rdar://problem/98937188>