Hook CE registry into element creation

This commit is contained in:
Connor Brewster 2017-06-09 18:23:27 -06:00
parent 3e4021ef1a
commit 6697f5469d
25 changed files with 146 additions and 240 deletions

View file

@ -36,6 +36,7 @@ use dom::bindings::xmlname::{namespace_from_domstring, validate_and_extract, xml
use dom::bindings::xmlname::XMLName::InvalidXMLName;
use dom::closeevent::CloseEvent;
use dom::comment::Comment;
use dom::customelementregistry::CustomElementDefinition;
use dom::customevent::CustomEvent;
use dom::documentfragment::DocumentFragment;
use dom::documenttype::DocumentType;
@ -1996,6 +1997,26 @@ impl Document {
self.window.layout().nodes_from_point_response()
}
/// https://html.spec.whatwg.org/multipage/#look-up-a-custom-element-definition
pub fn lookup_custom_element_definition(&self,
local_name: LocalName,
is: Option<LocalName>)
-> Option<Rc<CustomElementDefinition>> {
if !PREFS.get("dom.customelements.enabled").as_boolean().unwrap_or(false) {
return None;
}
// Step 2
if !self.has_browsing_context {
return None;
}
// Step 3
let registry = self.window.CustomElements();
registry.lookup_definition(local_name, is)
}
}
#[derive(PartialEq, HeapSizeOf)]