Bug 129316
| Summary: | Setting `element.id = null` should not remove the `id` attribute | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Mathias Bynens <mathias> |
| Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED CONFIGURATION CHANGED | ||
| Severity: | Normal | CC: | ahmad.saleem792, ap, bfulgham, mathias, rniwa |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | data:text/html,<p%20id=x></p><script>var%20el%20=%20x;%20el.id%20=%20null;%20document.write(el.id%20===%20'null'%20?%20'PASS'%20:%20'FAIL')</script> | ||
Mathias Bynens
Setting `element.id = null` should have the same result as `element.id = 'null'`. In Safari, this remove the `id` attribute instead.
Test case:
data:text/html,<p%20id=x></p><script>var%20el%20=%20x;%20el.id%20=%20null;%20document.write(el.id%20===%20'null'%20?%20'PASS'%20:%20'FAIL')</script>
Chrome, Opera, and Firefox get it right.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Ahmad Saleem
I took the test case from Comment 0 and replaced %20 with Space and then changed it into JSFiddle:
Link - https://jsfiddle.net/cwdjomup/
It shows "PASS" for all browsers (Chrome Canary 106, Firefox Nightly 105 and Safari 15.6 on macOS 12.5). I think something along the line fixed it. So I am marking this as "RESOLVED CONFIGURATION CHANGED". Thanks!