mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Use HTMLElement interface for possible CEs
This commit is contained in:
parent
e83a0045f9
commit
37cbc85727
3 changed files with 5 additions and 8 deletions
|
@ -5,6 +5,7 @@
|
||||||
use dom::bindings::error::{report_pending_exception, throw_dom_exception};
|
use dom::bindings::error::{report_pending_exception, throw_dom_exception};
|
||||||
use dom::bindings::js::Root;
|
use dom::bindings::js::Root;
|
||||||
use dom::bindings::reflector::DomObject;
|
use dom::bindings::reflector::DomObject;
|
||||||
|
use dom::customelementregistry::is_valid_custom_element_name;
|
||||||
use dom::document::Document;
|
use dom::document::Document;
|
||||||
use dom::element::{CustomElementCreationMode, Element, ElementCreator};
|
use dom::element::{CustomElementCreationMode, Element, ElementCreator};
|
||||||
use dom::globalscope::GlobalScope;
|
use dom::globalscope::GlobalScope;
|
||||||
|
@ -184,6 +185,7 @@ pub fn create_native_html_element(name: QualName,
|
||||||
|
|
||||||
// This is a big match, and the IDs for inline-interned atoms are not very structured.
|
// This is a big match, and the IDs for inline-interned atoms are not very structured.
|
||||||
// Perhaps we should build a perfect hash from those IDs instead.
|
// Perhaps we should build a perfect hash from those IDs instead.
|
||||||
|
// https://html.spec.whatwg.org/multipage/#elements-in-the-dom
|
||||||
match name.local {
|
match name.local {
|
||||||
local_name!("a") => make!(HTMLAnchorElement),
|
local_name!("a") => make!(HTMLAnchorElement),
|
||||||
local_name!("abbr") => make!(HTMLElement),
|
local_name!("abbr") => make!(HTMLElement),
|
||||||
|
@ -326,7 +328,8 @@ pub fn create_native_html_element(name: QualName,
|
||||||
local_name!("video") => make!(HTMLVideoElement),
|
local_name!("video") => make!(HTMLVideoElement),
|
||||||
local_name!("wbr") => make!(HTMLElement),
|
local_name!("wbr") => make!(HTMLElement),
|
||||||
local_name!("xmp") => make!(HTMLPreElement),
|
local_name!("xmp") => make!(HTMLPreElement),
|
||||||
_ => make!(HTMLUnknownElement),
|
_ if is_valid_custom_element_name(&*name.local) => make!(HTMLElement),
|
||||||
|
_ => make!(HTMLUnknownElement),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -750,7 +750,7 @@ impl ElementQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/#valid-custom-element-name
|
/// https://html.spec.whatwg.org/multipage/#valid-custom-element-name
|
||||||
fn is_valid_custom_element_name(name: &str) -> bool {
|
pub fn is_valid_custom_element_name(name: &str) -> bool {
|
||||||
// Custom elment names must match:
|
// Custom elment names must match:
|
||||||
// PotentialCustomElementName ::= [a-z] (PCENChar)* '-' (PCENChar)*
|
// PotentialCustomElementName ::= [a-z] (PCENChar)* '-' (PCENChar)*
|
||||||
|
|
||||||
|
|
|
@ -42,12 +42,6 @@
|
||||||
[Interfaces for BASEFONT]
|
[Interfaces for BASEFONT]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[Interfaces for foo-bar]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Interfaces for FOO-BAR]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Interfaces for menuitem]
|
[Interfaces for menuitem]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue