Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/dom/documents/dom-tree-accessors/nameditem-supported-property-names-order.html - WPT Dashboard Interop Dashboard
<!doctype html>
<meta charset="utf-8">
<title>Named items: id values precede name values from the same element</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<img id="id-value" name="name-value">
<script>
"use strict";
test(() => {
const names = Object.getOwnPropertyNames(document);
assert_array_equals(
names.filter(name => name === "id-value" || name === "name-value"),
["id-value", "name-value"]
);
}, "Values from id attributes precede values from name attributes when the same element contributes both");
</script>