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

custom-elements: Support cloneNode() for customized built-in elements #9491

Merged
merged 1 commit into from
Feb 13, 2018
Merged
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
13 changes: 12 additions & 1 deletion custom-elements/builtin-coverage.html
Original file line number Diff line number Diff line change
Expand Up @@ -800,17 +800,26 @@
test(() => {
let customized = new t.klass();
assert_equals(customized.constructor, t.klass);
// cloneNode() won't create a customized built-in element due to no
// 'is' attribute. https://github.com/whatwg/html/issues/3402
assert_not_equals(customized.cloneNode().constructor, t.klass,
'Cloning a customized built-in element should NOT succeed.');
}, `${t.tag}: Operator 'new' should instantiate a customized built-in element`);

test(() => {
let customized = document.createElement(t.tag, { is: name });
assert_equals(customized.constructor, t.klass);
assert_equals(customized.cloneNode().constructor, t.klass,
'Cloning a customized built-in element should succeed.');
}, `${t.tag}: document.createElement() should instantiate a customized built-in element`);

if (t.parsing == 'document') {
let test = async_test(`${t.tag}: document parser should instantiate a customized built-in element`);
window.addEventListener('load', test.step_func_done(() => {
assert_equals(document.querySelector(t.tag).constructor, t.klass);
let customized = document.querySelector(t.tag);
assert_equals(customized.constructor, t.klass);
assert_equals(customized.cloneNode().constructor, t.klass,
'Cloning a customized built-in element should succeed.');
}));
return;
}
Expand All @@ -823,6 +832,8 @@
}
let customized = document.getElementById(name);
assert_equals(customized.constructor, t.klass);
assert_equals(customized.cloneNode().constructor, t.klass,
'Cloning a customized built-in element should succeed.');
}, `${t.tag}: innerHTML should instantiate a customized built-in element`);

}, `${t.tag}: Define a customized built-in element`);
Expand Down