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

Upgrade nodes to custom elements on insertion, even if they're not connected to a Document #25730

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Try to upgrade even when nodes aren't connected, but not in a template

  • Loading branch information
pshaughn committed Feb 11, 2020
commit b5c014d28c207c59108c093c53c9d90e1b3d837b
@@ -1758,10 +1758,17 @@ impl Element {
// https://w3c.github.io/DOM-Parsing/#parsing
pub fn parse_fragment(&self, markup: DOMString) -> Fallible<DomRoot<DocumentFragment>> {
// Steps 1-2.
let context_document = document_from_node(self);
// TODO(#11995): XML case.
let new_children = ServoParser::parse_html_fragment(self, markup);
// Step 3.
// w3c/DOM-Parsing#61
let context_document = {
if let Some(template) = self.downcast::<HTMLTemplateElement>() {
template.Content().upcast::<Node>().owner_doc()
} else {
document_from_node(self)
}
};
let fragment = DocumentFragment::new(&context_document);
// Step 4.
for child in new_children {
@@ -1939,19 +1939,17 @@ impl Node {
.traverse_preorder(ShadowIncluding::Yes)
.filter_map(DomRoot::downcast::<Element>)
{
// Step 7.7.2.
if descendant.is_connected() {
if descendant.get_custom_element_definition().is_some() {
// Step 7.7.2.1.
// Step 7.7.2, whatwg/dom#833
if descendant.get_custom_element_definition().is_some() {
if descendant.is_connected() {
ScriptThread::enqueue_callback_reaction(
&*descendant,
CallbackReaction::Connected,
None,
);
} else {
// Step 7.7.2.2.
try_upgrade_element(&*descendant);
}
} else {
try_upgrade_element(&*descendant);
}
}
}

This file was deleted.

This file was deleted.

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.