Bug 210111 - documentFragment.getElementById() should not work for empty-string IDs
Summary: documentFragment.getElementById() should not work for empty-string IDs
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-04-07 07:28 PDT by Domenic Denicola
Modified: 2020-04-07 11:41 PDT (History)
9 users (show)

See Also:


Attachments
Patch (6.18 KB, patch)
2020-04-07 10:28 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Domenic Denicola 2020-04-07 07:28:02 PDT
(This is tested using the bots on wpt.fyi; I do not have a Mac available in these working from home times.)

URL: http://wpt.live/dom/nodes/DocumentFragment-getElementById.html

Per spec, documentFragment.getElementById("") should return null, even if there is a <div id=""></div> inside the DocumentFragment. Safari passes the same test for document.getElementById(""): http://wpt.live/dom/nodes/Document-getElementById.html .

Other browsers: Chrome fails, Firefox passes

Spec reference: https://dom.spec.whatwg.org/#concept-id ("value is null or the empty string").
Comment 1 Chris Dumez 2020-04-07 10:28:44 PDT
Created attachment 395702 [details]
Patch
Comment 2 Geoffrey Garen 2020-04-07 11:19:59 PDT
Comment on attachment 395702 [details]
Patch

r=me
Comment 3 EWS 2020-04-07 11:40:12 PDT
Committed r259651: <https://trac.webkit.org/changeset/259651>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 395702 [details].
Comment 4 Radar WebKit Bug Importer 2020-04-07 11:41:19 PDT
<rdar://problem/61402774>