Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow more characters in document.createElement #38503

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions dom/nodes/valid-names.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<link rel=author href="mailto:[email protected]">
<link rel=help href="https://github.com/whatwg/dom/issues/769">
<link rel=help href="https://github.com/whatwg/dom/issues/849">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<script>
const testTagName = 'TEST-\u{1f602}';
const testAttributeValue = 'hello world';
const testNamespace = 'http://example.com';

test(() => {
const element = document.createElement(testTagName);
assert_equals(element.tagName, testTagName);
}, 'document.createElement should accept emojis.');

test(() => {
const element = document.createElementNS(testNamespace, 'test-\u{1f602}');
assert_equals(element.tagName, testTagName);
}, 'document.createElementNS should accept emojis.');

test(() => {
const element = document.createElement('div');
element.setAttribute(testTagName, testAttributeValue);
assert_equals(element.getAttribute(testTagName), testAttributeValue);
}, 'element.setAttribute should accept emojis.');

test(() => {
const element = document.createElement('div');
element.setAttributeNS(testNamespace, testTagName, testAttributeValue);
assert_equals(element.getAttributeNS(testNamespace, testTagName), testAttributeValue);
}, 'element.setAttributeNS should accept emojis.');

test(() => {
const element = document.createElement('div');
element.toggleAttribute(testTagName);
assert_true(element.hasAttribute(testTagName));
}, 'element.toggleAttribute should accept emojis.');

test(() => {
const attr = document.createAttribute(testTagName);
assert_equals(attr.name, testTagName, 'attr.name should return the requested name.');
assert_equals(attr.localName, testTagName, 'attr.tagName should return the requested name.');
}, 'document.createAttribute should accept emojis.');

test(() => {
const attr = document.createAttributeNS(testNamespace, testTagName);
assert_equals(attr.name, testTagName, 'attr.name should return the requested name.');
assert_equals(attr.localName, testTagName, 'attr.tagName should return the requested name.');
}, 'document.createAttributeNS should accept emojis.');

test(() => {
document.implementation.createDocument(testNamespace, testTagName);
// TODO how do i check the document's name?
}, 'createDocument should accept emojis.');
</script>