mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Auto merge of #17381 - cbrewster:custom_element_creation, r=jdm
Custom element creation <!-- Please describe your changes on the following line: --> This implements the CE-related steps when creating elements. `is` is now support by `document.createElement` and is stored on `Element`s. Only synchronously created autonomous elements are supported as async element creation and customized built-in elements both require custom element upgrade reactions. Spec: https://dom.spec.whatwg.org/#concept-create-element --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #17191 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17381) <!-- Reviewable:end -->
This commit is contained in:
commit
bc3ec0ce1b
34 changed files with 286 additions and 287 deletions
|
@ -2,10 +2,12 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::error::{report_pending_exception, throw_dom_exception};
|
||||
use dom::bindings::js::Root;
|
||||
use dom::bindings::reflector::DomObject;
|
||||
use dom::document::Document;
|
||||
use dom::element::Element;
|
||||
use dom::element::ElementCreator;
|
||||
use dom::element::{CustomElementCreationMode, Element, ElementCreator};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::htmlanchorelement::HTMLAnchorElement;
|
||||
use dom::htmlappletelement::HTMLAppletElement;
|
||||
use dom::htmlareaelement::HTMLAreaElement;
|
||||
|
@ -76,7 +78,8 @@ use dom::htmlulistelement::HTMLUListElement;
|
|||
use dom::htmlunknownelement::HTMLUnknownElement;
|
||||
use dom::htmlvideoelement::HTMLVideoElement;
|
||||
use dom::svgsvgelement::SVGSVGElement;
|
||||
use html5ever::{QualName, Prefix};
|
||||
use html5ever::{LocalName, Prefix, QualName};
|
||||
use js::jsapi::JSAutoCompartment;
|
||||
use servo_config::prefs::PREFS;
|
||||
|
||||
fn create_svg_element(name: QualName,
|
||||
|
@ -106,11 +109,55 @@ fn create_svg_element(name: QualName,
|
|||
}
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-create-element
|
||||
#[allow(unsafe_code)]
|
||||
fn create_html_element(name: QualName,
|
||||
prefix: Option<Prefix>,
|
||||
is: Option<LocalName>,
|
||||
document: &Document,
|
||||
creator: ElementCreator)
|
||||
creator: ElementCreator,
|
||||
mode: CustomElementCreationMode)
|
||||
-> Root<Element> {
|
||||
assert!(name.ns == ns!(html));
|
||||
|
||||
// Step 4
|
||||
let definition = document.lookup_custom_element_definition(name.local.clone(), is);
|
||||
|
||||
if let Some(definition) = definition {
|
||||
if definition.is_autonomous() {
|
||||
match mode {
|
||||
// TODO: Handle asynchronous CE creation. Relies on CE upgrades.
|
||||
CustomElementCreationMode::Asynchronous => {},
|
||||
CustomElementCreationMode::Synchronous => {
|
||||
let local_name = name.local.clone();
|
||||
return match definition.create_element(document, prefix.clone()) {
|
||||
Ok(element) => element,
|
||||
Err(error) => {
|
||||
// Step 6. Recovering from exception.
|
||||
let global = GlobalScope::current().unwrap_or_else(|| document.global());
|
||||
let cx = global.get_cx();
|
||||
|
||||
// Step 6.1.1
|
||||
unsafe {
|
||||
let _ac = JSAutoCompartment::new(cx, global.reflector().get_jsobject().get());
|
||||
throw_dom_exception(cx, &global, error);
|
||||
report_pending_exception(cx, true);
|
||||
}
|
||||
|
||||
// Step 6.1.2
|
||||
Root::upcast(HTMLUnknownElement::new(local_name, prefix, document))
|
||||
},
|
||||
};
|
||||
},
|
||||
}
|
||||
} else {
|
||||
let element = create_native_html_element(name, prefix, document, creator);
|
||||
element.set_is(definition.name.clone());
|
||||
// TODO: Enqueue custom element upgrade
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
||||
create_native_html_element(name, prefix, document, creator)
|
||||
}
|
||||
|
||||
|
@ -281,12 +328,14 @@ pub fn create_native_html_element(name: QualName,
|
|||
}
|
||||
|
||||
pub fn create_element(name: QualName,
|
||||
is: Option<LocalName>,
|
||||
document: &Document,
|
||||
creator: ElementCreator)
|
||||
creator: ElementCreator,
|
||||
mode: CustomElementCreationMode)
|
||||
-> Root<Element> {
|
||||
let prefix = name.prefix.clone();
|
||||
match name.ns {
|
||||
ns!(html) => create_html_element(name, prefix, document, creator),
|
||||
ns!(html) => create_html_element(name, prefix, is, document, creator, mode),
|
||||
ns!(svg) => create_svg_element(name, prefix, document),
|
||||
_ => Element::new(name.local, name.ns, prefix, document)
|
||||
}
|
||||
|
|
|
@ -7,23 +7,31 @@ use dom::bindings::cell::DOMRefCell;
|
|||
use dom::bindings::codegen::Bindings::CustomElementRegistryBinding;
|
||||
use dom::bindings::codegen::Bindings::CustomElementRegistryBinding::CustomElementRegistryMethods;
|
||||
use dom::bindings::codegen::Bindings::CustomElementRegistryBinding::ElementDefinitionOptions;
|
||||
use dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;
|
||||
use dom::bindings::codegen::Bindings::FunctionBinding::Function;
|
||||
use dom::bindings::error::{Error, ErrorResult};
|
||||
use dom::bindings::conversions::{ConversionResult, FromJSValConvertible};
|
||||
use dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||
use dom::bindings::inheritance::Castable;
|
||||
use dom::bindings::js::{JS, Root};
|
||||
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::document::Document;
|
||||
use dom::domexception::{DOMErrorName, DOMException};
|
||||
use dom::element::Element;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::Node;
|
||||
use dom::promise::Promise;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::LocalName;
|
||||
use html5ever::{LocalName, Prefix};
|
||||
use js::conversions::ToJSValConvertible;
|
||||
use js::jsapi::{IsConstructor, HandleObject, JS_GetProperty, JSAutoCompartment, JSContext};
|
||||
use js::jsval::{JSVal, UndefinedValue};
|
||||
use js::jsapi::{Construct1, IsConstructor, HandleValueArray, HandleObject};
|
||||
use js::jsapi::{JS_GetProperty, JSAutoCompartment, JSContext};
|
||||
use js::jsval::{JSVal, ObjectValue, UndefinedValue};
|
||||
use std::cell::Cell;
|
||||
use std::collections::HashMap;
|
||||
use std::ptr;
|
||||
use std::rc::Rc;
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#customelementregistry
|
||||
|
@ -34,12 +42,12 @@ pub struct CustomElementRegistry {
|
|||
window: JS<Window>,
|
||||
|
||||
#[ignore_heap_size_of = "Rc"]
|
||||
when_defined: DOMRefCell<HashMap<DOMString, Rc<Promise>>>,
|
||||
when_defined: DOMRefCell<HashMap<LocalName, Rc<Promise>>>,
|
||||
|
||||
element_definition_is_running: Cell<bool>,
|
||||
|
||||
#[ignore_heap_size_of = "Rc"]
|
||||
definitions: DOMRefCell<HashMap<DOMString, Rc<CustomElementDefinition>>>,
|
||||
definitions: DOMRefCell<HashMap<LocalName, Rc<CustomElementDefinition>>>,
|
||||
}
|
||||
|
||||
impl CustomElementRegistry {
|
||||
|
@ -65,6 +73,18 @@ impl CustomElementRegistry {
|
|||
self.when_defined.borrow_mut().clear()
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#look-up-a-custom-element-definition
|
||||
pub fn lookup_definition(&self,
|
||||
local_name: LocalName,
|
||||
is: Option<LocalName>)
|
||||
-> Option<Rc<CustomElementDefinition>> {
|
||||
self.definitions.borrow().values().find(|definition| {
|
||||
// Step 4-5
|
||||
definition.local_name == local_name &&
|
||||
(definition.name == local_name || Some(&definition.name) == is.as_ref())
|
||||
}).cloned()
|
||||
}
|
||||
|
||||
pub fn lookup_definition_by_constructor(&self, constructor: HandleObject) -> Option<Rc<CustomElementDefinition>> {
|
||||
self.definitions.borrow().values().find(|definition| {
|
||||
definition.constructor.callback() == constructor.get()
|
||||
|
@ -101,6 +121,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
|
|||
fn Define(&self, name: DOMString, constructor_: Rc<Function>, options: &ElementDefinitionOptions) -> ErrorResult {
|
||||
let global_scope = self.window.upcast::<GlobalScope>();
|
||||
rooted!(in(global_scope.get_cx()) let constructor = constructor_.callback());
|
||||
let name = LocalName::from(&*name);
|
||||
|
||||
// Step 1
|
||||
if unsafe { !IsConstructor(constructor.get()) } {
|
||||
|
@ -137,10 +158,10 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
|
|||
return Err(Error::NotSupported)
|
||||
}
|
||||
|
||||
extended_name
|
||||
LocalName::from(&**extended_name)
|
||||
} else {
|
||||
// Step 7.3
|
||||
&name
|
||||
name.clone()
|
||||
};
|
||||
|
||||
// Step 8
|
||||
|
@ -165,8 +186,8 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
|
|||
result?;
|
||||
|
||||
// Step 11
|
||||
let definition = CustomElementDefinition::new(LocalName::from(&*name),
|
||||
LocalName::from(&**local_name),
|
||||
let definition = CustomElementDefinition::new(name.clone(),
|
||||
local_name,
|
||||
constructor_);
|
||||
|
||||
// Step 12
|
||||
|
@ -188,7 +209,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
|
|||
/// https://html.spec.whatwg.org/multipage/#dom-customelementregistry-get
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn Get(&self, cx: *mut JSContext, name: DOMString) -> JSVal {
|
||||
match self.definitions.borrow().get(&name) {
|
||||
match self.definitions.borrow().get(&LocalName::from(&*name)) {
|
||||
Some(definition) => {
|
||||
rooted!(in(cx) let mut constructor = UndefinedValue());
|
||||
definition.constructor.to_jsval(cx, constructor.handle_mut());
|
||||
|
@ -202,6 +223,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
|
|||
#[allow(unrooted_must_root)]
|
||||
fn WhenDefined(&self, name: DOMString) -> Rc<Promise> {
|
||||
let global_scope = self.window.upcast::<GlobalScope>();
|
||||
let name = LocalName::from(&*name);
|
||||
|
||||
// Step 1
|
||||
if !is_valid_custom_element_name(&name) {
|
||||
|
@ -256,6 +278,56 @@ impl CustomElementDefinition {
|
|||
pub fn is_autonomous(&self) -> bool {
|
||||
self.name == self.local_name
|
||||
}
|
||||
|
||||
/// https://dom.spec.whatwg.org/#concept-create-element Step 6.1
|
||||
#[allow(unsafe_code)]
|
||||
pub fn create_element(&self, document: &Document, prefix: Option<Prefix>) -> Fallible<Root<Element>> {
|
||||
let window = document.window();
|
||||
let cx = window.get_cx();
|
||||
// Step 2
|
||||
rooted!(in(cx) let constructor = ObjectValue(self.constructor.callback()));
|
||||
rooted!(in(cx) let mut element = ptr::null_mut());
|
||||
{
|
||||
// Go into the constructor's compartment
|
||||
let _ac = JSAutoCompartment::new(cx, self.constructor.callback());
|
||||
let args = HandleValueArray::new();
|
||||
if unsafe { !Construct1(cx, constructor.handle(), &args, element.handle_mut()) } {
|
||||
return Err(Error::JSFailed);
|
||||
}
|
||||
}
|
||||
|
||||
rooted!(in(cx) let element_val = ObjectValue(element.get()));
|
||||
let element: Root<Element> = match unsafe { Root::from_jsval(cx, element_val.handle(), ()) } {
|
||||
Ok(ConversionResult::Success(element)) => element,
|
||||
Ok(ConversionResult::Failure(..)) =>
|
||||
return Err(Error::Type("Constructor did not return a DOM node".to_owned())),
|
||||
_ => return Err(Error::JSFailed),
|
||||
};
|
||||
|
||||
// Step 3
|
||||
if !element.is::<HTMLElement>() {
|
||||
return Err(Error::Type("Constructor did not return a DOM node".to_owned()));
|
||||
}
|
||||
|
||||
// Steps 4-9
|
||||
if element.HasAttributes() ||
|
||||
element.upcast::<Node>().children_count() > 0 ||
|
||||
element.upcast::<Node>().has_parent() ||
|
||||
&*element.upcast::<Node>().owner_doc() != document ||
|
||||
*element.namespace() != ns!(html) ||
|
||||
*element.local_name() != self.local_name
|
||||
{
|
||||
return Err(Error::NotSupported);
|
||||
}
|
||||
|
||||
// Step 10
|
||||
element.set_prefix(prefix);
|
||||
|
||||
// Step 11
|
||||
// Element's `is` is None by default
|
||||
|
||||
Ok(element)
|
||||
}
|
||||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#valid-custom-element-name
|
||||
|
|
|
@ -13,7 +13,7 @@ use dom::bindings::callback::ExceptionHandling;
|
|||
use dom::bindings::cell::DOMRefCell;
|
||||
use dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods;
|
||||
use dom::bindings::codegen::Bindings::DocumentBinding;
|
||||
use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState};
|
||||
use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState, ElementCreationOptions};
|
||||
use dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;
|
||||
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
|
||||
use dom::bindings::codegen::Bindings::EventHandlerBinding::OnErrorEventHandlerNonNull;
|
||||
|
@ -36,11 +36,13 @@ 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;
|
||||
use dom::domimplementation::DOMImplementation;
|
||||
use dom::element::{Element, ElementCreator, ElementPerformFullscreenEnter, ElementPerformFullscreenExit};
|
||||
use dom::element::CustomElementCreationMode;
|
||||
use dom::errorevent::ErrorEvent;
|
||||
use dom::event::{Event, EventBubbles, EventCancelable, EventDefault, EventStatus};
|
||||
use dom::eventtarget::EventTarget;
|
||||
|
@ -1996,6 +1998,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)]
|
||||
|
@ -2813,7 +2835,10 @@ impl DocumentMethods for Document {
|
|||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-createelement
|
||||
fn CreateElement(&self, mut local_name: DOMString) -> Fallible<Root<Element>> {
|
||||
fn CreateElement(&self,
|
||||
mut local_name: DOMString,
|
||||
options: &ElementCreationOptions)
|
||||
-> Fallible<Root<Element>> {
|
||||
if xml_name_type(&local_name) == InvalidXMLName {
|
||||
debug!("Not a valid element name");
|
||||
return Err(Error::InvalidCharacter);
|
||||
|
@ -2829,18 +2854,21 @@ impl DocumentMethods for Document {
|
|||
};
|
||||
|
||||
let name = QualName::new(None, ns, LocalName::from(local_name));
|
||||
Ok(Element::create(name, self, ElementCreator::ScriptCreated))
|
||||
let is = options.is.as_ref().map(|is| LocalName::from(&**is));
|
||||
Ok(Element::create(name, is, self, ElementCreator::ScriptCreated, CustomElementCreationMode::Synchronous))
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-createelementns
|
||||
fn CreateElementNS(&self,
|
||||
namespace: Option<DOMString>,
|
||||
qualified_name: DOMString)
|
||||
qualified_name: DOMString,
|
||||
options: &ElementCreationOptions)
|
||||
-> Fallible<Root<Element>> {
|
||||
let (namespace, prefix, local_name) = validate_and_extract(namespace,
|
||||
&qualified_name)?;
|
||||
let name = QualName::new(prefix, namespace, local_name);
|
||||
Ok(Element::create(name, self, ElementCreator::ScriptCreated))
|
||||
let is = options.is.as_ref().map(|is| LocalName::from(&**is));
|
||||
Ok(Element::create(name, is, self, ElementCreator::ScriptCreated, CustomElementCreationMode::Synchronous))
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-createattribute
|
||||
|
@ -3094,7 +3122,11 @@ impl DocumentMethods for Document {
|
|||
Some(elem) => Root::upcast::<Node>(elem),
|
||||
None => {
|
||||
let name = QualName::new(None, ns!(svg), local_name!("title"));
|
||||
let elem = Element::create(name, self, ElementCreator::ScriptCreated);
|
||||
let elem = Element::create(name,
|
||||
None,
|
||||
self,
|
||||
ElementCreator::ScriptCreated,
|
||||
CustomElementCreationMode::Synchronous);
|
||||
let parent = root.upcast::<Node>();
|
||||
let child = elem.upcast::<Node>();
|
||||
parent.InsertBefore(child, parent.GetFirstChild().r())
|
||||
|
@ -3112,8 +3144,10 @@ impl DocumentMethods for Document {
|
|||
Some(head) => {
|
||||
let name = QualName::new(None, ns!(html), local_name!("title"));
|
||||
let elem = Element::create(name,
|
||||
None,
|
||||
self,
|
||||
ElementCreator::ScriptCreated);
|
||||
ElementCreator::ScriptCreated,
|
||||
CustomElementCreationMode::Synchronous);
|
||||
head.upcast::<Node>()
|
||||
.AppendChild(elem.upcast())
|
||||
.unwrap()
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use document_loader::DocumentLoader;
|
||||
use dom::bindings::codegen::Bindings::DOMImplementationBinding;
|
||||
use dom::bindings::codegen::Bindings::DOMImplementationBinding::DOMImplementationMethods;
|
||||
use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
|
||||
use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, ElementCreationOptions};
|
||||
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||
use dom::bindings::error::Fallible;
|
||||
use dom::bindings::inheritance::Castable;
|
||||
|
@ -92,7 +92,8 @@ impl DOMImplementationMethods for DOMImplementation {
|
|||
let maybe_elem = if qname.is_empty() {
|
||||
None
|
||||
} else {
|
||||
match doc.upcast::<Document>().CreateElementNS(maybe_namespace, qname) {
|
||||
let options = ElementCreationOptions { is: None };
|
||||
match doc.upcast::<Document>().CreateElementNS(maybe_namespace, qname, &options) {
|
||||
Err(error) => return Err(error),
|
||||
Ok(elem) => Some(elem),
|
||||
}
|
||||
|
|
|
@ -126,9 +126,10 @@ pub struct Element {
|
|||
local_name: LocalName,
|
||||
tag_name: TagName,
|
||||
namespace: Namespace,
|
||||
prefix: Option<Prefix>,
|
||||
prefix: DOMRefCell<Option<Prefix>>,
|
||||
attrs: DOMRefCell<Vec<JS<Attr>>>,
|
||||
id_attribute: DOMRefCell<Option<Atom>>,
|
||||
is: DOMRefCell<Option<LocalName>>,
|
||||
#[ignore_heap_size_of = "Arc"]
|
||||
style_attribute: DOMRefCell<Option<Arc<Locked<PropertyDeclarationBlock>>>>,
|
||||
attr_list: MutNullableJS<NamedNodeMap>,
|
||||
|
@ -164,6 +165,11 @@ pub enum ElementCreator {
|
|||
ScriptCreated,
|
||||
}
|
||||
|
||||
pub enum CustomElementCreationMode {
|
||||
Synchronous,
|
||||
Asynchronous,
|
||||
}
|
||||
|
||||
impl ElementCreator {
|
||||
pub fn is_parser_created(&self) -> bool {
|
||||
match *self {
|
||||
|
@ -205,9 +211,12 @@ impl<'a> TryFrom<&'a str> for AdjacentPosition {
|
|||
//
|
||||
impl Element {
|
||||
pub fn create(name: QualName,
|
||||
document: &Document, creator: ElementCreator)
|
||||
is: Option<LocalName>,
|
||||
document: &Document,
|
||||
creator: ElementCreator,
|
||||
mode: CustomElementCreationMode)
|
||||
-> Root<Element> {
|
||||
create_element(name, document, creator)
|
||||
create_element(name, is, document, creator, mode)
|
||||
}
|
||||
|
||||
pub fn new_inherited(local_name: LocalName,
|
||||
|
@ -226,9 +235,10 @@ impl Element {
|
|||
local_name: local_name,
|
||||
tag_name: TagName::new(),
|
||||
namespace: namespace,
|
||||
prefix: prefix,
|
||||
prefix: DOMRefCell::new(prefix),
|
||||
attrs: DOMRefCell::new(vec![]),
|
||||
id_attribute: DOMRefCell::new(None),
|
||||
is: DOMRefCell::new(None),
|
||||
style_attribute: DOMRefCell::new(None),
|
||||
attr_list: Default::default(),
|
||||
class_list: Default::default(),
|
||||
|
@ -260,6 +270,14 @@ impl Element {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_is(&self, is: LocalName) {
|
||||
*self.is.borrow_mut() = Some(is);
|
||||
}
|
||||
|
||||
pub fn get_is(&self) -> Option<LocalName> {
|
||||
self.is.borrow().clone()
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom-view/#css-layout-box
|
||||
// Elements that have a computed value of the display property
|
||||
// that is table-column or table-column-group
|
||||
|
@ -820,8 +838,12 @@ impl Element {
|
|||
&self.namespace
|
||||
}
|
||||
|
||||
pub fn prefix(&self) -> Option<&Prefix> {
|
||||
self.prefix.as_ref()
|
||||
pub fn prefix(&self) -> Ref<Option<Prefix>> {
|
||||
self.prefix.borrow()
|
||||
}
|
||||
|
||||
pub fn set_prefix(&self, prefix: Option<Prefix>) {
|
||||
*self.prefix.borrow_mut() = prefix;
|
||||
}
|
||||
|
||||
pub fn attrs(&self) -> Ref<[JS<Attr>]> {
|
||||
|
@ -840,7 +862,9 @@ impl Element {
|
|||
// Steps 3-4.
|
||||
for element in inclusive_ancestor_elements {
|
||||
// Step 1.
|
||||
if element.namespace() != &ns!() && element.prefix().map(|p| &**p) == prefix.as_ref().map(|p| &**p) {
|
||||
if element.namespace() != &ns!() &&
|
||||
element.prefix().as_ref().map(|p| &**p) == prefix.as_ref().map(|p| &**p)
|
||||
{
|
||||
return element.namespace().clone();
|
||||
}
|
||||
|
||||
|
@ -1418,13 +1442,13 @@ impl ElementMethods for Element {
|
|||
|
||||
// https://dom.spec.whatwg.org/#dom-element-prefix
|
||||
fn GetPrefix(&self) -> Option<DOMString> {
|
||||
self.prefix.as_ref().map(|p| DOMString::from(&**p))
|
||||
self.prefix.borrow().as_ref().map(|p| DOMString::from(&**p))
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-tagname
|
||||
fn TagName(&self) -> DOMString {
|
||||
let name = self.tag_name.or_init(|| {
|
||||
let qualified_name = match self.prefix {
|
||||
let qualified_name = match *self.prefix.borrow() {
|
||||
Some(ref prefix) => {
|
||||
Cow::Owned(format!("{}:{}", &**prefix, &*self.local_name))
|
||||
},
|
||||
|
@ -1970,8 +1994,10 @@ impl ElementMethods for Element {
|
|||
// Step 4.
|
||||
NodeTypeId::DocumentFragment => {
|
||||
let body_elem = Element::create(QualName::new(None, ns!(html), local_name!("body")),
|
||||
None,
|
||||
&context_document,
|
||||
ElementCreator::ScriptCreated);
|
||||
ElementCreator::ScriptCreated,
|
||||
CustomElementCreationMode::Synchronous);
|
||||
Root::upcast(body_elem)
|
||||
},
|
||||
_ => context_node.GetParentElement().unwrap()
|
||||
|
|
|
@ -152,7 +152,7 @@ impl HTMLCollection {
|
|||
}
|
||||
|
||||
fn match_element(elem: &Element, qualified_name: &LocalName) -> bool {
|
||||
match elem.prefix() {
|
||||
match elem.prefix().as_ref() {
|
||||
None => elem.local_name() == qualified_name,
|
||||
Some(prefix) => qualified_name.starts_with(&**prefix) &&
|
||||
qualified_name.find(":") == Some(prefix.len()) &&
|
||||
|
|
|
@ -33,7 +33,7 @@ use dom::cssstylesheet::CSSStyleSheet;
|
|||
use dom::document::{Document, DocumentSource, HasBrowsingContext, IsHTMLDocument};
|
||||
use dom::documentfragment::DocumentFragment;
|
||||
use dom::documenttype::DocumentType;
|
||||
use dom::element::{Element, ElementCreator};
|
||||
use dom::element::{CustomElementCreationMode, Element, ElementCreator};
|
||||
use dom::eventtarget::EventTarget;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::htmlbodyelement::HTMLBodyElement;
|
||||
|
@ -428,6 +428,11 @@ impl Node {
|
|||
self.preceding_siblings().count() as u32
|
||||
}
|
||||
|
||||
/// Returns true if this node has a parent.
|
||||
pub fn has_parent(&self) -> bool {
|
||||
self.parent_node.get().is_some()
|
||||
}
|
||||
|
||||
pub fn children_count(&self) -> u32 {
|
||||
self.children_count.get()
|
||||
}
|
||||
|
@ -1818,12 +1823,15 @@ impl Node {
|
|||
NodeTypeId::Element(..) => {
|
||||
let element = node.downcast::<Element>().unwrap();
|
||||
let name = QualName {
|
||||
prefix: element.prefix().map(|p| Prefix::from(&**p)),
|
||||
prefix: element.prefix().as_ref().map(|p| Prefix::from(&**p)),
|
||||
ns: element.namespace().clone(),
|
||||
local: element.local_name().clone()
|
||||
};
|
||||
let element = Element::create(name,
|
||||
&document, ElementCreator::ScriptCreated);
|
||||
element.get_is(),
|
||||
&document,
|
||||
ElementCreator::ScriptCreated,
|
||||
CustomElementCreationMode::Asynchronous);
|
||||
Root::upcast::<Node>(element)
|
||||
},
|
||||
};
|
||||
|
@ -2284,7 +2292,7 @@ impl NodeMethods for Node {
|
|||
let element = node.downcast::<Element>().unwrap();
|
||||
let other_element = other.downcast::<Element>().unwrap();
|
||||
(*element.namespace() == *other_element.namespace()) &&
|
||||
(element.prefix() == other_element.prefix()) &&
|
||||
(*element.prefix() == *other_element.prefix()) &&
|
||||
(*element.local_name() == *other_element.local_name()) &&
|
||||
(element.attrs().len() == other_element.attrs().len())
|
||||
}
|
||||
|
|
|
@ -13,14 +13,14 @@ use dom::bindings::trace::JSTraceable;
|
|||
use dom::comment::Comment;
|
||||
use dom::document::Document;
|
||||
use dom::documenttype::DocumentType;
|
||||
use dom::element::{Element, ElementCreator};
|
||||
use dom::element::{CustomElementCreationMode, Element, ElementCreator};
|
||||
use dom::htmlformelement::{FormControlElementHelpers, HTMLFormElement};
|
||||
use dom::htmlscriptelement::HTMLScriptElement;
|
||||
use dom::htmltemplateelement::HTMLTemplateElement;
|
||||
use dom::node::Node;
|
||||
use dom::processinginstruction::ProcessingInstruction;
|
||||
use dom::virtualmethods::vtable_for;
|
||||
use html5ever::{Attribute, QualName, ExpandedName};
|
||||
use html5ever::{Attribute, LocalName, QualName, ExpandedName};
|
||||
use html5ever::buffer_queue::BufferQueue;
|
||||
use html5ever::tendril::StrTendril;
|
||||
use html5ever::tokenizer::{Tokenizer as HtmlTokenizer, TokenizerOpts, TokenizerResult};
|
||||
|
@ -245,8 +245,15 @@ impl Sink {
|
|||
self.insert_node(contents, JS::from_ref(template.Content().upcast()));
|
||||
}
|
||||
ParseOperation::CreateElement(id, name, attrs) => {
|
||||
let elem = Element::create(name, &*self.document,
|
||||
ElementCreator::ParserCreated(self.current_line));
|
||||
let is = attrs.iter()
|
||||
.find(|attr| attr.name.local.eq_str_ignore_ascii_case("is"))
|
||||
.map(|attr| LocalName::from(&*attr.value));
|
||||
|
||||
let elem = Element::create(name,
|
||||
is,
|
||||
&*self.document,
|
||||
ElementCreator::ParserCreated(self.current_line),
|
||||
CustomElementCreationMode::Synchronous);
|
||||
for attr in attrs {
|
||||
elem.set_attribute_from_parser(attr.name, DOMString::from(String::from(attr.value)), None);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ use dom::characterdata::CharacterData;
|
|||
use dom::comment::Comment;
|
||||
use dom::document::{Document, DocumentSource, HasBrowsingContext, IsHTMLDocument};
|
||||
use dom::documenttype::DocumentType;
|
||||
use dom::element::{Element, ElementCreator};
|
||||
use dom::element::{Element, ElementCreator, CustomElementCreationMode};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::htmlformelement::{FormControlElementHelpers, HTMLFormElement};
|
||||
use dom::htmlimageelement::HTMLImageElement;
|
||||
|
@ -29,7 +29,7 @@ use dom::processinginstruction::ProcessingInstruction;
|
|||
use dom::text::Text;
|
||||
use dom::virtualmethods::vtable_for;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::{Attribute, QualName, ExpandedName};
|
||||
use html5ever::{Attribute, ExpandedName, LocalName, QualName};
|
||||
use html5ever::buffer_queue::BufferQueue;
|
||||
use html5ever::tendril::{StrTendril, ByteTendril, IncompleteUtf8};
|
||||
use html5ever::tree_builder::{NodeOrText, TreeSink, NextParserState, QuirksMode, ElementFlags};
|
||||
|
@ -782,8 +782,15 @@ impl TreeSink for Sink {
|
|||
|
||||
fn create_element(&mut self, name: QualName, attrs: Vec<Attribute>, _flags: ElementFlags)
|
||||
-> JS<Node> {
|
||||
let elem = Element::create(name, &*self.document,
|
||||
ElementCreator::ParserCreated(self.current_line));
|
||||
let is = attrs.iter()
|
||||
.find(|attr| attr.name.local.eq_str_ignore_ascii_case("is"))
|
||||
.map(|attr| LocalName::from(&*attr.value));
|
||||
|
||||
let elem = Element::create(name,
|
||||
is,
|
||||
&*self.document,
|
||||
ElementCreator::ParserCreated(self.current_line),
|
||||
CustomElementCreationMode::Synchronous);
|
||||
|
||||
for attr in attrs {
|
||||
elem.set_attribute_from_parser(attr.name, DOMString::from(String::from(attr.value)), None);
|
||||
|
|
|
@ -33,9 +33,9 @@ interface Document : Node {
|
|||
HTMLCollection getElementsByClassName(DOMString classNames);
|
||||
|
||||
[NewObject, Throws]
|
||||
Element createElement(DOMString localName);
|
||||
Element createElement(DOMString localName, optional ElementCreationOptions options);
|
||||
[NewObject, Throws]
|
||||
Element createElementNS(DOMString? namespace, DOMString qualifiedName);
|
||||
Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional ElementCreationOptions options);
|
||||
[NewObject]
|
||||
DocumentFragment createDocumentFragment();
|
||||
[NewObject]
|
||||
|
@ -75,6 +75,10 @@ Document implements ParentNode;
|
|||
|
||||
enum DocumentReadyState { "loading", "interactive", "complete" };
|
||||
|
||||
dictionary ElementCreationOptions {
|
||||
DOMString is;
|
||||
};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#the-document-object
|
||||
// [OverrideBuiltins]
|
||||
partial /*sealed*/ interface Document {
|
||||
|
|
|
@ -31,10 +31,10 @@ macro_rules! sizeof_checker (
|
|||
// Update the sizes here
|
||||
sizeof_checker!(size_event_target, EventTarget, 40);
|
||||
sizeof_checker!(size_node, Node, 184);
|
||||
sizeof_checker!(size_element, Element, 344);
|
||||
sizeof_checker!(size_htmlelement, HTMLElement, 360);
|
||||
sizeof_checker!(size_div, HTMLDivElement, 360);
|
||||
sizeof_checker!(size_span, HTMLSpanElement, 360);
|
||||
sizeof_checker!(size_element, Element, 376);
|
||||
sizeof_checker!(size_htmlelement, HTMLElement, 392);
|
||||
sizeof_checker!(size_div, HTMLDivElement, 392);
|
||||
sizeof_checker!(size_span, HTMLSpanElement, 392);
|
||||
sizeof_checker!(size_text, Text, 216);
|
||||
sizeof_checker!(size_characterdata, CharacterData, 216);
|
||||
sizeof_checker!(size_servothreadsafelayoutnode, ServoThreadSafeLayoutNode, 16);
|
||||
|
|
|
@ -554206,7 +554206,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"custom-elements/Document-createElement.html": [
|
||||
"d9582ab3867b02e98da9b0da8e3398303d1833ab",
|
||||
"074c9f703cc7feb1dfc3d07aedd08460bd591d42",
|
||||
"testharness"
|
||||
],
|
||||
"custom-elements/HTMLElement-constructor.html": [
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
[CustomElementRegistry.html]
|
||||
type: testharness
|
||||
[customElements.define must not throw when defining another custom element in a different global object during Get(constructor, "prototype")]
|
||||
expected: FAIL
|
||||
|
||||
[customElements.define must get callbacks of the constructor prototype]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
[Document-createElement.html]
|
||||
type: testharness
|
||||
[document.createElement must create an instance of custom elements]
|
||||
expected: FAIL
|
||||
|
||||
[document.createElement must report a TypeError when the result of Construct is not a DOM node]
|
||||
expected: FAIL
|
||||
|
||||
[document.createElement must report a TypeError when the result of Construct is a TextNode]
|
||||
expected: FAIL
|
||||
|
||||
[document.createElement must report a NotSupportedError when attribute is added by setAttribute during construction]
|
||||
expected: FAIL
|
||||
|
||||
[document.createElement must report a NotSupportedError when attribute is added by attributes.setNamedItem during construction]
|
||||
expected: FAIL
|
||||
|
||||
[document.createElement must not report a NotSupportedError when attribute is added and removed during construction]
|
||||
expected: FAIL
|
||||
|
||||
[document.createElement must report a NotSupportedError when a Text child is added during construction]
|
||||
expected: FAIL
|
||||
|
||||
[document.createElement must report a NotSupportedError when a Comment child is added during construction]
|
||||
expected: FAIL
|
||||
|
||||
[document.createElement must report a NotSupportedError when an element child is added during construction]
|
||||
expected: FAIL
|
||||
|
||||
[document.createElement must not report a NotSupportedError when an element child is added and removed during construction]
|
||||
expected: FAIL
|
||||
|
||||
[document.createElement must report a NotSupportedError when the element gets inserted into another element during construction]
|
||||
expected: FAIL
|
||||
|
||||
[document.createElement must not report a NotSupportedError when the element is inserted and removed from another element during construction]
|
||||
expected: FAIL
|
||||
|
|
@ -1,8 +1,5 @@
|
|||
[parser-constructs-custom-element-in-document-write.html]
|
||||
type: testharness
|
||||
[HTML parser must instantiate custom elements inside document.write]
|
||||
expected: FAIL
|
||||
|
||||
[Custom Elements: Changes to the HTML parser]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
[parser-constructs-custom-element-synchronously.html]
|
||||
type: testharness
|
||||
[HTML parser must only append nodes that appear before a custom element before instantiating the custom element]
|
||||
expected: FAIL
|
||||
|
||||
[Custom Elements: Changes to the HTML parser]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[parser-constructs-custom-elements.html]
|
||||
type: testharness
|
||||
[HTML parser must create a defined custom element before executing inline scripts]
|
||||
expected: FAIL
|
||||
|
|
@ -1,8 +1,5 @@
|
|||
[parser-sets-attributes-and-children.html]
|
||||
type: testharness
|
||||
[HTML parser must set the attributes or append children before calling constructor]
|
||||
expected: FAIL
|
||||
|
||||
[Custom Elements: Changes to the HTML parser]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
[parser-uses-constructed-element.html]
|
||||
type: testharness
|
||||
[HTML parser must use the returned value of the custom element constructor instead of the one created before super() call]
|
||||
expected: FAIL
|
||||
|
||||
[HTML parser must use the returned value of the custom element constructor instead using the one created in super() call]
|
||||
expected: FAIL
|
||||
|
||||
[Custom Elements: HTML parser must construct a custom element instead of upgrading]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -9,3 +9,6 @@
|
|||
[Custom Elements: HTML parser must use the owner document's custom element registry]
|
||||
expected: FAIL
|
||||
|
||||
[HTML parser must not instantiate custom elements inside template elements]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
[setAttribute and removeAttribute must enqueue and invoke attributeChangedCallback]
|
||||
expected: FAIL
|
||||
|
||||
[Calling Node.prototype.cloneNode(false) must push a new element queue to the processing stack]
|
||||
expected: FAIL
|
||||
|
||||
[Custom Elements: Custom element reactions must be invoked before returning to author scripts]
|
||||
expected: FAIL
|
||||
|
||||
[Calling Node.prototype.cloneNode(false) must push a new element queue to the processing stack]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -3,6 +3,3 @@
|
|||
[value on Attr must enqueue an attributeChanged reaction when replacing an existing attribute]
|
||||
expected: FAIL
|
||||
|
||||
[value on Attr must not enqueue an attributeChanged reaction when replacing an existing unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -3,87 +3,45 @@
|
|||
[cssText on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute]
|
||||
expected: FAIL
|
||||
|
||||
[cssText on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed]
|
||||
expected: FAIL
|
||||
|
||||
[cssText on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute]
|
||||
expected: FAIL
|
||||
|
||||
[cssText on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed]
|
||||
expected: FAIL
|
||||
|
||||
[setProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setProperty on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed]
|
||||
expected: FAIL
|
||||
|
||||
[setProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setProperty on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed]
|
||||
expected: FAIL
|
||||
|
||||
[setProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it makes a property important and the style attribute is observed]
|
||||
expected: FAIL
|
||||
|
||||
[setProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it makes a property important but the style attribute is not observed]
|
||||
expected: FAIL
|
||||
|
||||
[setPropertyValue on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setPropertyValue on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed]
|
||||
expected: FAIL
|
||||
|
||||
[setPropertyValue on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setPropertyValue on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed]
|
||||
expected: FAIL
|
||||
|
||||
[setPropertyPriority on CSSStyleDeclaration must enqueue an attributeChanged reaction when it makes a property important and the style attribute is observed]
|
||||
expected: FAIL
|
||||
|
||||
[setPropertyPriority on CSSStyleDeclaration must enqueue an attributeChanged reaction when it makes a property important but the style attribute is not observed]
|
||||
expected: FAIL
|
||||
|
||||
[removeProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it removes a property from the observed style attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeProperty on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it removes a property from the style attribute but the style attribute is not observed]
|
||||
expected: FAIL
|
||||
|
||||
[cssFloat on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute]
|
||||
expected: FAIL
|
||||
|
||||
[cssFloat on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed]
|
||||
expected: FAIL
|
||||
|
||||
[A camel case attribute (borderWidth) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute]
|
||||
expected: FAIL
|
||||
|
||||
[A camel case attribute (borderWidth) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed]
|
||||
expected: FAIL
|
||||
|
||||
[A camel case attribute (borderWidth) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute]
|
||||
expected: FAIL
|
||||
|
||||
[A camel case attribute (borderWidth) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed]
|
||||
expected: FAIL
|
||||
|
||||
[A dashed property (border-width) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute]
|
||||
expected: FAIL
|
||||
|
||||
[A dashed property (border-width) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed]
|
||||
expected: FAIL
|
||||
|
||||
[A dashed property (border-width) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute]
|
||||
expected: FAIL
|
||||
|
||||
[A dashed property (border-width) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed]
|
||||
expected: FAIL
|
||||
|
||||
[A webkit prefixed camel case attribute (webkitFilter) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -3,24 +3,12 @@
|
|||
[setter on DOMStringMap must enqueue an attributeChanged reaction when adding an observed data attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setter on DOMStringMap must not enqueue an attributeChanged reaction when adding an unobserved data attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setter on DOMStringMap must enqueue an attributeChanged reaction when mutating the value of an observed data attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setter on DOMStringMap must enqueue an attributeChanged reaction when mutating the value of an observed data attribute to the same value]
|
||||
expected: FAIL
|
||||
|
||||
[setter on DOMStringMap must not enqueue an attributeChanged reaction when mutating the value of an unobserved data attribute]
|
||||
expected: FAIL
|
||||
|
||||
[deleter on DOMStringMap must enqueue an attributeChanged reaction when removing an observed data attribute]
|
||||
expected: FAIL
|
||||
|
||||
[deleter on DOMStringMap must not enqueue an attributeChanged reaction when removing an unobserved data attribute]
|
||||
expected: FAIL
|
||||
|
||||
[deleter on DOMStringMap must not enqueue an attributeChanged reaction when it does not remove a data attribute]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -3,15 +3,9 @@
|
|||
[add on DOMTokenList must enqueue an attributeChanged reaction when adding an attribute]
|
||||
expected: FAIL
|
||||
|
||||
[add on DOMTokenList must not enqueue an attributeChanged reaction when adding an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[add on DOMTokenList must enqueue an attributeChanged reaction when adding a value to an existing attribute]
|
||||
expected: FAIL
|
||||
|
||||
[add on DOMTokenList must not enqueue an attributeChanged reaction when adding a value to an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[add on DOMTokenList must enqueue exactly one attributeChanged reaction when adding multiple values to an attribute]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -24,9 +18,6 @@
|
|||
[remove on DOMTokenList must enqueue an attributeChanged reaction even when removing a non-existent value from an attribute]
|
||||
expected: FAIL
|
||||
|
||||
[remove on DOMTokenList must not enqueue an attributeChanged reaction when removing a value from an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[toggle on DOMTokenList must enqueue an attributeChanged reaction when adding a value to an attribute]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -39,21 +30,12 @@
|
|||
[replace on DOMTokenList must not enqueue an attributeChanged reaction when the token to replace does not exist in the attribute]
|
||||
expected: FAIL
|
||||
|
||||
[replace on DOMTokenList must not enqueue an attributeChanged reaction when replacing a value in an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[the stringifier of DOMTokenList must enqueue an attributeChanged reaction when adding an observed attribute]
|
||||
expected: FAIL
|
||||
|
||||
[the stringifier of DOMTokenList must not enqueue an attributeChanged reaction when adding an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[the stringifier of DOMTokenList must enqueue an attributeChanged reaction when mutating the value of an observed attribute]
|
||||
expected: FAIL
|
||||
|
||||
[the stringifier of DOMTokenList must not enqueue an attributeChanged reaction when mutating the value of an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[the stringifier of DOMTokenList must enqueue an attributeChanged reaction when the setter is called with the original value of the attribute]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
[Document.html]
|
||||
type: testharness
|
||||
[importNode on Document must not construct a new custom element when importing a custom element into a window-less document]
|
||||
expected: FAIL
|
||||
|
||||
[importNode on Document must construct a new custom element when importing a custom element from a template]
|
||||
expected: FAIL
|
||||
|
||||
[adoptNode on Document must enqueue an adopted reaction when importing a custom element]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -36,3 +30,6 @@
|
|||
[writeln on Document must enqueue connectedCallback after constructing a custom element]
|
||||
expected: FAIL
|
||||
|
||||
[importNode on Document must construct a new custom element when importing a custom element from a template]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -21,78 +21,36 @@
|
|||
[setAttribute on Element must enqueue an attributeChanged reaction when adding an attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setAttribute on Element must not enqueue an attributeChanged reaction when adding an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setAttribute on Element must enqueue an attributeChanged reaction when replacing an existing attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setAttribute on Element must enqueue an attributeChanged reaction when replacing an existing unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setAttributeNS on Element must enqueue an attributeChanged reaction when adding an attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setAttributeNS on Element must not enqueue an attributeChanged reaction when adding an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setAttributeNS on Element must enqueue an attributeChanged reaction when replacing an existing attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setAttributeNS on Element must enqueue an attributeChanged reaction when replacing an existing unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeAttribute on Element must not enqueue an attributeChanged reaction when removing an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeAttribute on Element must enqueue an attributeChanged reaction when removing an existing attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeAttribute on Element must not enqueue an attributeChanged reaction when removing an existing unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeAttributeNS on Element must not enqueue an attributeChanged reaction when removing an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeAttributeNS on Element must enqueue an attributeChanged reaction when removing an existing attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeAttributeNS on Element must not enqueue an attributeChanged reaction when removing an existing unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setAttributeNode on Element must enqueue an attributeChanged reaction when adding an attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setAttributeNode on Element must not enqueue an attributeChanged reaction when adding an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setAttributeNode on Element must enqueue an attributeChanged reaction when replacing an existing attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setAttributeNode on Element must enqueue an attributeChanged reaction when replacing an existing unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setAttributeNodeNS on Element must enqueue an attributeChanged reaction when adding an attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setAttributeNodeNS on Element must not enqueue an attributeChanged reaction when adding an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setAttributeNodeNS on Element must enqueue an attributeChanged reaction when replacing an existing attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setAttributeNodeNS on Element must enqueue an attributeChanged reaction when replacing an existing unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeAttributeNode on Element must not enqueue an attributeChanged reaction when removing an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeAttributeNode on Element must enqueue an attributeChanged reaction when removing an existing attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeAttributeNode on Element must not enqueue an attributeChanged reaction when removing an existing unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[insertAdjacentElement on Element must enqueue a connected reaction]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -3,42 +3,18 @@
|
|||
[setNamedItem on NamedNodeMap must enqueue an attributeChanged reaction when adding an attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setNamedItem on NamedNodeMap must not enqueue an attributeChanged reaction when adding an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setNamedItem on NamedNodeMap must enqueue an attributeChanged reaction when replacing an existing attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setNamedItem on NamedNodeMap must enqueue an attributeChanged reaction when replacing an existing unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setNamedItemNS on NamedNodeMap must enqueue an attributeChanged reaction when adding an attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setNamedItemNS on NamedNodeMap must not enqueue an attributeChanged reaction when adding an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setNamedItemNS on NamedNodeMap must enqueue an attributeChanged reaction when replacing an existing attribute]
|
||||
expected: FAIL
|
||||
|
||||
[setNamedItemNS on NamedNodeMap must enqueue an attributeChanged reaction when replacing an existing unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeNamedItem on NamedNodeMap must not enqueue an attributeChanged reaction when removing an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeNamedItem on NamedNodeMap must enqueue an attributeChanged reaction when removing an existing attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeNamedItem on NamedNodeMap must not enqueue an attributeChanged reaction when removing an existing unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeNamedItemNS on NamedNodeMap must not enqueue an attributeChanged reaction when removing an unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeNamedItemNS on NamedNodeMap must enqueue an attributeChanged reaction when removing an existing attribute]
|
||||
expected: FAIL
|
||||
|
||||
[removeNamedItemNS on NamedNodeMap must not enqueue an attributeChanged reaction when removing an existing unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -3,15 +3,9 @@
|
|||
[nodeValue on Node must enqueue an attributeChanged reaction when replacing an existing attribute]
|
||||
expected: FAIL
|
||||
|
||||
[nodeValue on Node must not enqueue an attributeChanged reaction when replacing an existing unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[textContent on Node must enqueue an attributeChanged reaction when replacing an existing attribute]
|
||||
expected: FAIL
|
||||
|
||||
[textContent on Node must not enqueue an attributeChanged reaction when replacing an existing unobserved attribute]
|
||||
expected: FAIL
|
||||
|
||||
[cloneNode on Node must enqueue an attributeChanged reaction when cloning an element with an observed attribute]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -36,9 +36,6 @@
|
|||
[Creating an element in an HTML document fetched by XHR and adopting back to a document with browsing context must enqueue a custom element upgrade reaction]
|
||||
expected: FAIL
|
||||
|
||||
[Creating an element in the document of an iframe must enqueue a custom element upgrade reaction if there is a matching definition]
|
||||
expected: FAIL
|
||||
|
||||
["define" in the document of an iframe must not enqueue a custom element upgrade reaction on a disconnected unresolved custom element]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,14 +1,5 @@
|
|||
[Node-cloneNode.html]
|
||||
type: testharness
|
||||
[Node.prototype.cloneNode(false) must be able to clone a custom element]
|
||||
expected: FAIL
|
||||
|
||||
[Node.prototype.cloneNode(false) must be able to clone a custom element inside an iframe]
|
||||
expected: FAIL
|
||||
|
||||
[Node.prototype.cloneNode(true) must be able to clone a descendent custom element]
|
||||
expected: FAIL
|
||||
|
||||
[Node.prototype.cloneNode(true) must set parentNode, previousSibling, and nextSibling before upgrading custom elements]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -24,3 +15,12 @@
|
|||
[Inserting an element must not try to upgrade a custom element when it had already failed to upgrade once]
|
||||
expected: FAIL
|
||||
|
||||
[Node.prototype.cloneNode(false) must be able to clone a custom element]
|
||||
expected: FAIL
|
||||
|
||||
[Node.prototype.cloneNode(false) must be able to clone a custom element inside an iframe]
|
||||
expected: FAIL
|
||||
|
||||
[Node.prototype.cloneNode(true) must be able to clone a descendent custom element]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
type: testharness
|
||||
[Fragment Navigation: Updating scroll position]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -3,3 +3,4 @@
|
|||
[Append iframe element to its own child document]
|
||||
bug: https://github.com/servo/servo/issues/17479
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<link rel="help" content="https://dom.spec.whatwg.org/#concept-create-element">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/custom-elements-helper.js"></script>
|
||||
<script src="resources/custom-elements-helpers.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue