Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/dom/documents/dom-tree-accessors/nameditem-img-name-added.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset=utf-8>
<title>Named items: img becomes exposed by id when a name is added</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<img id="bar">
<script>
test(function() {
let img = document.querySelector("img#bar");
assert_equals(document.bar, undefined, "before adding a name");
img.setAttribute("name", "whatever");
assert_equals(document.bar, img, "after adding a name");
}, "An img with an id but no name becomes exposed by its id once a name attribute is added.");
</script>