mirror of
https://github.com/servo/servo.git
synced 2025-07-25 08:10:21 +01:00
Hook CE registry into element creation
This commit is contained in:
parent
3e4021ef1a
commit
6697f5469d
25 changed files with 146 additions and 240 deletions
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue