-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix elements with names from Object.prototype
Closes #3709.
- Loading branch information
Showing
2 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
test/web-platform-tests/to-upstream/html/syntax/parsing/Object-prototype-names.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Element with tag name "constructor", etc.</title> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<!-- Regression test for https://github.com/jsdom/jsdom/issues/3706 --> | ||
|
||
<body> | ||
<constructor></constructor> | ||
<hasOwnProperty></hasOwnProperty> | ||
<__proto__></__proto__> | ||
<toString></toString> | ||
|
||
<script> | ||
"use strict"; | ||
const propNames = ["constructor", "hasOwnProperty", "__proto__", "toString"]; | ||
|
||
test(() => { | ||
for (const name of propNames) { | ||
const el = document.createElement(name); | ||
assert_equals(el.localName, name.toLowerCase()); | ||
assert_equals(el.constructor, HTMLUnknownElement); | ||
} | ||
}, "Creating HTML elements with property names from Object.prototype should not be problematic"); | ||
|
||
test(() => { | ||
for (const name of propNames) { | ||
const el = document.createElementNS("https://example.com/", name); | ||
assert_equals(el.localName, name); | ||
assert_equals(el.constructor, Element); | ||
} | ||
}, "Creating XML elements with property names from Object.prototype should not be problematic"); | ||
</script> |