mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Auto merge of #5590 - nox:document-createattributens, r=Ms2ger
This commit is contained in:
commit
9b7bf415d7
9 changed files with 116 additions and 217 deletions
|
@ -7,14 +7,17 @@
|
||||||
use dom::bindings::codegen::PrototypeList;
|
use dom::bindings::codegen::PrototypeList;
|
||||||
use dom::bindings::codegen::PrototypeList::MAX_PROTO_CHAIN_LENGTH;
|
use dom::bindings::codegen::PrototypeList::MAX_PROTO_CHAIN_LENGTH;
|
||||||
use dom::bindings::conversions::{native_from_reflector_jsmanaged, is_dom_class};
|
use dom::bindings::conversions::{native_from_reflector_jsmanaged, is_dom_class};
|
||||||
use dom::bindings::error::throw_type_error;
|
use dom::bindings::error::{Error, ErrorResult, Fallible, throw_type_error};
|
||||||
use dom::bindings::global::GlobalRef;
|
use dom::bindings::global::GlobalRef;
|
||||||
use dom::bindings::js::{Temporary, Root};
|
use dom::bindings::js::{Temporary, Root};
|
||||||
use dom::browsercontext;
|
use dom::browsercontext;
|
||||||
use dom::window;
|
use dom::window;
|
||||||
|
use util::namespace;
|
||||||
|
use util::str::DOMString;
|
||||||
|
|
||||||
use libc;
|
use libc;
|
||||||
use libc::c_uint;
|
use libc::c_uint;
|
||||||
|
use std::borrow::ToOwned;
|
||||||
use std::boxed;
|
use std::boxed;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
@ -43,6 +46,7 @@ use js::rust::with_compartment;
|
||||||
use js::{JSPROP_ENUMERATE, JSPROP_READONLY, JSPROP_PERMANENT};
|
use js::{JSPROP_ENUMERATE, JSPROP_READONLY, JSPROP_PERMANENT};
|
||||||
use js::JSFUN_CONSTRUCTOR;
|
use js::JSFUN_CONSTRUCTOR;
|
||||||
use js;
|
use js;
|
||||||
|
use string_cache::{Atom, Namespace};
|
||||||
|
|
||||||
/// Proxy handler for a WindowProxy.
|
/// Proxy handler for a WindowProxy.
|
||||||
pub struct WindowProxyHandler(pub *const libc::c_void);
|
pub struct WindowProxyHandler(pub *const libc::c_void);
|
||||||
|
@ -604,6 +608,68 @@ pub unsafe fn delete_property_by_id(cx: *mut JSContext, object: *mut JSObject,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Validate a qualified name. See https://dom.spec.whatwg.org/#validate for details.
|
||||||
|
pub fn validate_qualified_name(qualified_name: &str) -> ErrorResult {
|
||||||
|
match xml_name_type(qualified_name) {
|
||||||
|
XMLName::InvalidXMLName => {
|
||||||
|
// Step 1.
|
||||||
|
return Err(Error::InvalidCharacter);
|
||||||
|
},
|
||||||
|
XMLName::Name => {
|
||||||
|
// Step 2.
|
||||||
|
return Err(Error::Namespace);
|
||||||
|
},
|
||||||
|
XMLName::QName => Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Validate a namespace and qualified name and extract their parts.
|
||||||
|
/// See https://dom.spec.whatwg.org/#validate-and-extract for details.
|
||||||
|
pub fn validate_and_extract(namespace: Option<DOMString>, qualified_name: &str)
|
||||||
|
-> Fallible<(Namespace, Option<DOMString>, Atom)> {
|
||||||
|
// Step 1.
|
||||||
|
let namespace = namespace::from_domstring(namespace);
|
||||||
|
|
||||||
|
// Step 2.
|
||||||
|
try!(validate_qualified_name(qualified_name));
|
||||||
|
|
||||||
|
let (prefix, local_name) = if qualified_name.contains(":") {
|
||||||
|
// Step 5.
|
||||||
|
let mut parts = qualified_name.splitn(1, ':');
|
||||||
|
let prefix = parts.next().unwrap();
|
||||||
|
debug_assert!(!prefix.is_empty());
|
||||||
|
let local_name = parts.next().unwrap();
|
||||||
|
debug_assert!(!local_name.contains(":"));
|
||||||
|
(Some(prefix), local_name)
|
||||||
|
} else {
|
||||||
|
(None, qualified_name)
|
||||||
|
};
|
||||||
|
|
||||||
|
match (namespace, prefix) {
|
||||||
|
(ns!(""), Some(_)) => {
|
||||||
|
// Step 6.
|
||||||
|
Err(Error::Namespace)
|
||||||
|
},
|
||||||
|
(ref ns, Some("xml")) if ns != &ns!(XML) => {
|
||||||
|
// Step 7.
|
||||||
|
Err(Error::Namespace)
|
||||||
|
},
|
||||||
|
(ref ns, p) if ns != &ns!(XMLNS) &&
|
||||||
|
(qualified_name == "xmlns" || p == Some("xmlns")) => {
|
||||||
|
// Step 8.
|
||||||
|
Err(Error::Namespace)
|
||||||
|
},
|
||||||
|
(ns!(XMLNS), p) if qualified_name != "xmlns" && p != Some("xmlns") => {
|
||||||
|
// Step 9.
|
||||||
|
Err(Error::Namespace)
|
||||||
|
},
|
||||||
|
(ns, p) => {
|
||||||
|
// Step 10.
|
||||||
|
Ok((ns, p.map(|s| s.to_owned()), Atom::from_slice(local_name)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Results of `xml_name_type`.
|
/// Results of `xml_name_type`.
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
|
|
|
@ -21,20 +21,20 @@ use dom::bindings::codegen::InheritTypes::{HTMLFormElementDerived, HTMLImageElem
|
||||||
use dom::bindings::codegen::InheritTypes::{HTMLScriptElementDerived};
|
use dom::bindings::codegen::InheritTypes::{HTMLScriptElementDerived};
|
||||||
use dom::bindings::error::{ErrorResult, Fallible};
|
use dom::bindings::error::{ErrorResult, Fallible};
|
||||||
use dom::bindings::error::Error::{NotSupported, InvalidCharacter, Security};
|
use dom::bindings::error::Error::{NotSupported, InvalidCharacter, Security};
|
||||||
use dom::bindings::error::Error::{HierarchyRequest, Namespace};
|
use dom::bindings::error::Error::HierarchyRequest;
|
||||||
use dom::bindings::global::GlobalRef;
|
use dom::bindings::global::GlobalRef;
|
||||||
use dom::bindings::js::{MutNullableJS, JS, JSRef, LayoutJS, Temporary, TemporaryPushable};
|
use dom::bindings::js::{MutNullableJS, JS, JSRef, LayoutJS, Temporary, TemporaryPushable};
|
||||||
use dom::bindings::js::{OptionalRootable, RootedReference};
|
use dom::bindings::js::{OptionalRootable, RootedReference};
|
||||||
use dom::bindings::refcounted::Trusted;
|
use dom::bindings::refcounted::Trusted;
|
||||||
use dom::bindings::utils::reflect_dom_object;
|
use dom::bindings::utils::reflect_dom_object;
|
||||||
use dom::bindings::utils::xml_name_type;
|
use dom::bindings::utils::{xml_name_type, validate_and_extract};
|
||||||
use dom::bindings::utils::XMLName::{QName, Name, InvalidXMLName};
|
use dom::bindings::utils::XMLName::InvalidXMLName;
|
||||||
use dom::comment::Comment;
|
use dom::comment::Comment;
|
||||||
use dom::customevent::CustomEvent;
|
use dom::customevent::CustomEvent;
|
||||||
use dom::documentfragment::DocumentFragment;
|
use dom::documentfragment::DocumentFragment;
|
||||||
use dom::documenttype::DocumentType;
|
use dom::documenttype::DocumentType;
|
||||||
use dom::domimplementation::DOMImplementation;
|
use dom::domimplementation::DOMImplementation;
|
||||||
use dom::element::{Element, ElementCreator, AttributeHandlers, get_attribute_parts};
|
use dom::element::{Element, ElementCreator, AttributeHandlers};
|
||||||
use dom::element::{ElementTypeId, ActivationElementHelpers};
|
use dom::element::{ElementTypeId, ActivationElementHelpers};
|
||||||
use dom::event::{Event, EventBubbles, EventCancelable, EventHelpers};
|
use dom::event::{Event, EventBubbles, EventCancelable, EventHelpers};
|
||||||
use dom::eventtarget::{EventTarget, EventTargetTypeId, EventTargetHelpers};
|
use dom::eventtarget::{EventTarget, EventTargetTypeId, EventTargetHelpers};
|
||||||
|
@ -67,7 +67,7 @@ use net_traits::CookieSource::NonHTTP;
|
||||||
use net_traits::ControlMsg::{SetCookiesForUrl, GetCookiesForUrl};
|
use net_traits::ControlMsg::{SetCookiesForUrl, GetCookiesForUrl};
|
||||||
use script_task::Runnable;
|
use script_task::Runnable;
|
||||||
use script_traits::{MouseButton, UntrustedNodeAddress};
|
use script_traits::{MouseButton, UntrustedNodeAddress};
|
||||||
use util::{opts, namespace};
|
use util::opts;
|
||||||
use util::str::{DOMString, split_html_space_chars};
|
use util::str::{DOMString, split_html_space_chars};
|
||||||
use layout_interface::{ReflowGoal, ReflowQueryType};
|
use layout_interface::{ReflowGoal, ReflowQueryType};
|
||||||
|
|
||||||
|
@ -975,45 +975,10 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
fn CreateElementNS(self,
|
fn CreateElementNS(self,
|
||||||
namespace: Option<DOMString>,
|
namespace: Option<DOMString>,
|
||||||
qualified_name: DOMString) -> Fallible<Temporary<Element>> {
|
qualified_name: DOMString) -> Fallible<Temporary<Element>> {
|
||||||
let ns = namespace::from_domstring(namespace);
|
let (namespace, prefix, local_name) =
|
||||||
match xml_name_type(&qualified_name) {
|
try!(validate_and_extract(namespace, &qualified_name));
|
||||||
InvalidXMLName => {
|
let name = QualName::new(namespace, local_name);
|
||||||
debug!("Not a valid element name");
|
Ok(Element::create(name, prefix, self, ElementCreator::ScriptCreated))
|
||||||
return Err(InvalidCharacter);
|
|
||||||
},
|
|
||||||
Name => {
|
|
||||||
debug!("Not a valid qualified element name");
|
|
||||||
return Err(Namespace);
|
|
||||||
},
|
|
||||||
QName => {}
|
|
||||||
}
|
|
||||||
|
|
||||||
let (prefix_from_qname, local_name_from_qname) = get_attribute_parts(&qualified_name);
|
|
||||||
match (&ns, prefix_from_qname, local_name_from_qname) {
|
|
||||||
// throw if prefix is not null and namespace is null
|
|
||||||
(&ns!(""), Some(_), _) => {
|
|
||||||
debug!("Namespace can't be null with a non-null prefix");
|
|
||||||
return Err(Namespace);
|
|
||||||
},
|
|
||||||
// throw if prefix is "xml" and namespace is not the XML namespace
|
|
||||||
(_, Some(ref prefix), _) if "xml" == *prefix && ns != ns!(XML) => {
|
|
||||||
debug!("Namespace must be the xml namespace if the prefix is 'xml'");
|
|
||||||
return Err(Namespace);
|
|
||||||
},
|
|
||||||
// throw if namespace is the XMLNS namespace and neither qualifiedName nor prefix is
|
|
||||||
// "xmlns"
|
|
||||||
(&ns!(XMLNS), Some(ref prefix), _) if "xmlns" == *prefix => {},
|
|
||||||
(&ns!(XMLNS), _, "xmlns") => {},
|
|
||||||
(&ns!(XMLNS), _, _) => {
|
|
||||||
debug!("The prefix or the qualified name must be 'xmlns' if namespace is the XMLNS namespace ");
|
|
||||||
return Err(Namespace);
|
|
||||||
},
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
|
|
||||||
let name = QualName::new(ns, Atom::from_slice(local_name_from_qname));
|
|
||||||
Ok(Element::create(name, prefix_from_qname.map(|s| s.to_owned()), self,
|
|
||||||
ElementCreator::ScriptCreated))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-createattribute
|
// http://dom.spec.whatwg.org/#dom-document-createattribute
|
||||||
|
@ -1032,6 +997,18 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
Ok(Attr::new(window.r(), name, value, l_name, ns!(""), None, None))
|
Ok(Attr::new(window.r(), name, value, l_name, ns!(""), None, None))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// http://dom.spec.whatwg.org/#dom-document-createattributens
|
||||||
|
fn CreateAttributeNS(self, namespace: Option<DOMString>, qualified_name: DOMString)
|
||||||
|
-> Fallible<Temporary<Attr>> {
|
||||||
|
let (namespace, prefix, local_name) =
|
||||||
|
try!(validate_and_extract(namespace, &qualified_name));
|
||||||
|
let window = self.window.root();
|
||||||
|
let value = AttrValue::String("".to_owned());
|
||||||
|
let qualified_name = Atom::from_slice(&qualified_name);
|
||||||
|
Ok(Attr::new(window.r(), local_name, value, qualified_name,
|
||||||
|
namespace, prefix, None))
|
||||||
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-document-createdocumentfragment
|
// http://dom.spec.whatwg.org/#dom-document-createdocumentfragment
|
||||||
fn CreateDocumentFragment(self) -> Temporary<DocumentFragment> {
|
fn CreateDocumentFragment(self) -> Temporary<DocumentFragment> {
|
||||||
DocumentFragment::new(self)
|
DocumentFragment::new(self)
|
||||||
|
|
|
@ -8,12 +8,10 @@ use dom::bindings::codegen::Bindings::DOMImplementationBinding::DOMImplementatio
|
||||||
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||||
use dom::bindings::codegen::InheritTypes::NodeCast;
|
use dom::bindings::codegen::InheritTypes::NodeCast;
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
use dom::bindings::error::Error::{InvalidCharacter, Namespace};
|
|
||||||
use dom::bindings::global::GlobalRef;
|
use dom::bindings::global::GlobalRef;
|
||||||
use dom::bindings::js::{JS, JSRef, Root, Temporary, OptionalRootable};
|
use dom::bindings::js::{JS, JSRef, Root, Temporary, OptionalRootable};
|
||||||
use dom::bindings::utils::{Reflector, reflect_dom_object};
|
use dom::bindings::utils::{Reflector, reflect_dom_object};
|
||||||
use dom::bindings::utils::xml_name_type;
|
use dom::bindings::utils::validate_qualified_name;
|
||||||
use dom::bindings::utils::XMLName::{QName, Name, InvalidXMLName};
|
|
||||||
use dom::document::{Document, DocumentHelpers, IsHTMLDocument};
|
use dom::document::{Document, DocumentHelpers, IsHTMLDocument};
|
||||||
use dom::document::DocumentSource;
|
use dom::document::DocumentSource;
|
||||||
use dom::documenttype::DocumentType;
|
use dom::documenttype::DocumentType;
|
||||||
|
@ -52,18 +50,11 @@ impl DOMImplementation {
|
||||||
// http://dom.spec.whatwg.org/#domimplementation
|
// http://dom.spec.whatwg.org/#domimplementation
|
||||||
impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
|
impl<'a> DOMImplementationMethods for JSRef<'a, DOMImplementation> {
|
||||||
// http://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype
|
// http://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype
|
||||||
fn CreateDocumentType(self, qname: DOMString, pubid: DOMString, sysid: DOMString) -> Fallible<Temporary<DocumentType>> {
|
fn CreateDocumentType(self, qualified_name: DOMString, pubid: DOMString, sysid: DOMString)
|
||||||
match xml_name_type(&qname) {
|
-> Fallible<Temporary<DocumentType>> {
|
||||||
// Step 1.
|
try!(validate_qualified_name(&qualified_name));
|
||||||
InvalidXMLName => Err(InvalidCharacter),
|
let document = self.document.root();
|
||||||
// Step 2.
|
Ok(DocumentType::new(qualified_name, Some(pubid), Some(sysid), document.r()))
|
||||||
Name => Err(Namespace),
|
|
||||||
// Step 3.
|
|
||||||
QName => {
|
|
||||||
let document = self.document.root();
|
|
||||||
Ok(DocumentType::new(qname, Some(pubid), Some(sysid), document.r()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-domimplementation-createdocument
|
// http://dom.spec.whatwg.org/#dom-domimplementation-createdocument
|
||||||
|
|
|
@ -24,14 +24,13 @@ use dom::bindings::codegen::InheritTypes::{HTMLTableRowElementDerived, HTMLTextA
|
||||||
use dom::bindings::codegen::InheritTypes::{HTMLTableSectionElementDerived, NodeCast};
|
use dom::bindings::codegen::InheritTypes::{HTMLTableSectionElementDerived, NodeCast};
|
||||||
use dom::bindings::codegen::InheritTypes::HTMLAnchorElementCast;
|
use dom::bindings::codegen::InheritTypes::HTMLAnchorElementCast;
|
||||||
use dom::bindings::error::{ErrorResult, Fallible};
|
use dom::bindings::error::{ErrorResult, Fallible};
|
||||||
use dom::bindings::error::Error;
|
|
||||||
use dom::bindings::error::Error::{InvalidCharacter, Syntax};
|
use dom::bindings::error::Error::{InvalidCharacter, Syntax};
|
||||||
use dom::bindings::error::Error::NoModificationAllowed;
|
use dom::bindings::error::Error::NoModificationAllowed;
|
||||||
use dom::bindings::js::{MutNullableJS, JS, JSRef, LayoutJS, Temporary, TemporaryPushable};
|
use dom::bindings::js::{MutNullableJS, JS, JSRef, LayoutJS, Temporary, TemporaryPushable};
|
||||||
use dom::bindings::js::{OptionalRootable, RootedReference};
|
use dom::bindings::js::{OptionalRootable, RootedReference};
|
||||||
use dom::bindings::trace::RootedVec;
|
use dom::bindings::trace::RootedVec;
|
||||||
use dom::bindings::utils::xml_name_type;
|
use dom::bindings::utils::{xml_name_type, validate_and_extract};
|
||||||
use dom::bindings::utils::XMLName::{QName, Name, InvalidXMLName};
|
use dom::bindings::utils::XMLName::InvalidXMLName;
|
||||||
use dom::create::create_element;
|
use dom::create::create_element;
|
||||||
use dom::domrect::DOMRect;
|
use dom::domrect::DOMRect;
|
||||||
use dom::domrectlist::DOMRectList;
|
use dom::domrectlist::DOMRectList;
|
||||||
|
@ -1037,58 +1036,14 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||||
|
|
||||||
// http://dom.spec.whatwg.org/#dom-element-setattributens
|
// http://dom.spec.whatwg.org/#dom-element-setattributens
|
||||||
fn SetAttributeNS(self,
|
fn SetAttributeNS(self,
|
||||||
namespace_url: Option<DOMString>,
|
namespace: Option<DOMString>,
|
||||||
name: DOMString,
|
qualified_name: DOMString,
|
||||||
value: DOMString) -> ErrorResult {
|
value: DOMString) -> ErrorResult {
|
||||||
// Step 1.
|
let (namespace, prefix, local_name) =
|
||||||
let namespace = namespace::from_domstring(namespace_url);
|
try!(validate_and_extract(namespace, &qualified_name));
|
||||||
|
let qualified_name = Atom::from_slice(&qualified_name);
|
||||||
let name_type = xml_name_type(&name);
|
|
||||||
match name_type {
|
|
||||||
// Step 2.
|
|
||||||
InvalidXMLName => return Err(InvalidCharacter),
|
|
||||||
// Step 3.
|
|
||||||
Name => return Err(Error::Namespace),
|
|
||||||
QName => {}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 4.
|
|
||||||
let (prefix, local_name) = get_attribute_parts(&name);
|
|
||||||
|
|
||||||
if let Some(ref prefix_str) = prefix {
|
|
||||||
// Step 5.
|
|
||||||
if namespace == ns!("") {
|
|
||||||
return Err(Error::Namespace);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 6.
|
|
||||||
if "xml" == *prefix_str && namespace != ns!(XML) {
|
|
||||||
return Err(Error::Namespace);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 7b.
|
|
||||||
if "xmlns" == *prefix_str && namespace != ns!(XMLNS) {
|
|
||||||
return Err(Error::Namespace);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let name = Atom::from_slice(&name);
|
|
||||||
let local_name = Atom::from_slice(local_name);
|
|
||||||
let xmlns = atom!("xmlns");
|
|
||||||
|
|
||||||
// Step 7a.
|
|
||||||
if xmlns == name && namespace != ns!(XMLNS) {
|
|
||||||
return Err(Error::Namespace);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 8.
|
|
||||||
if namespace == ns!(XMLNS) && xmlns != name && Some("xmlns") != prefix {
|
|
||||||
return Err(Error::Namespace);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 9.
|
|
||||||
let value = self.parse_attribute(&namespace, &local_name, value);
|
let value = self.parse_attribute(&namespace, &local_name, value);
|
||||||
self.do_set_attribute(local_name.clone(), value, name,
|
self.do_set_attribute(local_name.clone(), value, qualified_name,
|
||||||
namespace.clone(), prefix.map(|s| s.to_owned()),
|
namespace.clone(), prefix.map(|s| s.to_owned()),
|
||||||
|attr| {
|
|attr| {
|
||||||
*attr.local_name() == local_name &&
|
*attr.local_name() == local_name &&
|
||||||
|
@ -1293,17 +1248,6 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_attribute_parts<'a>(name: &'a str) -> (Option<&'a str>, &'a str) {
|
|
||||||
//FIXME: Throw for XML-invalid names
|
|
||||||
//FIXME: Throw for XMLNS-invalid names
|
|
||||||
if name.contains(":") {
|
|
||||||
let mut parts = name.splitn(1, ':');
|
|
||||||
(Some(parts.next().unwrap()), parts.next().unwrap())
|
|
||||||
} else {
|
|
||||||
(None, name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> VirtualMethods for JSRef<'a, Element> {
|
impl<'a> VirtualMethods for JSRef<'a, Element> {
|
||||||
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
fn super_type<'b>(&'b self) -> Option<&'b VirtualMethods> {
|
||||||
let node: &JSRef<Node> = NodeCast::from_borrowed_ref(self);
|
let node: &JSRef<Node> = NodeCast::from_borrowed_ref(self);
|
||||||
|
|
|
@ -27,27 +27,33 @@ interface Document : Node {
|
||||||
HTMLCollection getElementsByClassName(DOMString classNames);
|
HTMLCollection getElementsByClassName(DOMString classNames);
|
||||||
Element? getElementById(DOMString elementId);
|
Element? getElementById(DOMString elementId);
|
||||||
|
|
||||||
[Throws]
|
[NewObject, Throws]
|
||||||
Element createElement(DOMString localName);
|
Element createElement(DOMString localName);
|
||||||
[Throws]
|
[NewObject, Throws]
|
||||||
Element createElementNS(DOMString? namespace, DOMString qualifiedName);
|
Element createElementNS(DOMString? namespace, DOMString qualifiedName);
|
||||||
|
[NewObject]
|
||||||
DocumentFragment createDocumentFragment();
|
DocumentFragment createDocumentFragment();
|
||||||
|
[NewObject]
|
||||||
Text createTextNode(DOMString data);
|
Text createTextNode(DOMString data);
|
||||||
|
[NewObject]
|
||||||
Comment createComment(DOMString data);
|
Comment createComment(DOMString data);
|
||||||
[Throws]
|
[NewObject, Throws]
|
||||||
ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
|
ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
|
||||||
|
|
||||||
[Throws]
|
[NewObject, Throws]
|
||||||
Attr createAttribute(DOMString localName);
|
|
||||||
|
|
||||||
[Throws]
|
|
||||||
Node importNode(Node node, optional boolean deep = false);
|
Node importNode(Node node, optional boolean deep = false);
|
||||||
[Throws]
|
[Throws]
|
||||||
Node adoptNode(Node node);
|
Node adoptNode(Node node);
|
||||||
|
|
||||||
[Throws]
|
[NewObject, Throws]
|
||||||
|
Attr createAttribute(DOMString localName);
|
||||||
|
[NewObject, Throws]
|
||||||
|
Attr createAttributeNS(DOMString? namespace, DOMString localName);
|
||||||
|
|
||||||
|
[NewObject, Throws]
|
||||||
Event createEvent(DOMString interface_);
|
Event createEvent(DOMString interface_);
|
||||||
|
|
||||||
|
[NewObject]
|
||||||
Range createRange();
|
Range createRange();
|
||||||
|
|
||||||
// NodeFilter.SHOW_ALL = 0xFFFFFFFF
|
// NodeFilter.SHOW_ALL = 0xFFFFFFFF
|
||||||
|
|
|
@ -90,9 +90,6 @@
|
||||||
[Document interface: operation importNode(Node,boolean)]
|
[Document interface: operation importNode(Node,boolean)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[Document interface: operation createAttributeNS(DOMString,DOMString)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Document interface: operation createNodeIterator(Node,unsigned long,NodeFilter)]
|
[Document interface: operation createNodeIterator(Node,unsigned long,NodeFilter)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -132,9 +129,6 @@
|
||||||
[Document interface: xmlDoc must inherit property "origin" with the proper type (3)]
|
[Document interface: xmlDoc must inherit property "origin" with the proper type (3)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[Document interface: calling createAttributeNS(DOMString,DOMString) on xmlDoc with too few arguments must throw TypeError]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Document interface: calling createNodeIterator(Node,unsigned long,NodeFilter) on xmlDoc with too few arguments must throw TypeError]
|
[Document interface: calling createNodeIterator(Node,unsigned long,NodeFilter) on xmlDoc with too few arguments must throw TypeError]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -969,9 +963,6 @@
|
||||||
[DOMTokenList interface object length]
|
[DOMTokenList interface object length]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[Document interface: xmlDoc must inherit property "createAttributeNS" with the proper type (22)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Document interface: xmlDoc must inherit property "createNodeIterator" with the proper type (25)]
|
[Document interface: xmlDoc must inherit property "createNodeIterator" with the proper type (25)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
[DOMImplementation-createDocument.html]
|
|
||||||
type: testharness
|
|
||||||
[createDocument test 23: null,"xmlns",null,"NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createDocument test 41: undefined,"xmlns",null,"NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createDocument test 64: "http://example.com/","xmlns",null,"NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createDocument test 69: "http://example.com/","xmlns:foo",null,"NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createDocument test 108: "/","xmlns",null,"NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createDocument test 111: "/","xmlns:foo",null,"NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createDocument test 121: "http://www.w3.org/XML/1998/namespace","xmlns",null,"NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createDocument test 124: "http://www.w3.org/XML/1998/namespace","xmlns:foo",null,"NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createDocument test 141: "http://www.w3.org/2000/xmlns/","foo:xmlns",null,"NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createDocument test 150: "foo:","xmlns",null,"NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createDocument test 153: "foo:","xmlns:foo",null,"NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
[Document-createElementNS.html]
|
|
||||||
type: testharness
|
|
||||||
[createElementNS test 23: null,"xmlns","NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createElementNS test 41: undefined,"xmlns","NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createElementNS test 64: "http://example.com/","xmlns","NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createElementNS test 69: "http://example.com/","xmlns:foo","NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createElementNS test 108: "/","xmlns","NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createElementNS test 111: "/","xmlns:foo","NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createElementNS test 121: "http://www.w3.org/XML/1998/namespace","xmlns","NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createElementNS test 124: "http://www.w3.org/XML/1998/namespace","xmlns:foo","NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createElementNS test 141: "http://www.w3.org/2000/xmlns/","foo:xmlns","NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createElementNS test 150: "foo:","xmlns","NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[createElementNS test 153: "foo:","xmlns:foo","NAMESPACE_ERR"]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1035,12 +1035,6 @@
|
||||||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "origin" with the proper type (3)]
|
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "origin" with the proper type (3)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "createAttributeNS" with the proper type (22)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Document interface: calling createAttributeNS(DOMString,DOMString) on document.implementation.createDocument(null, "", null) with too few arguments must throw TypeError]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "createNodeIterator" with the proper type (25)]
|
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "createNodeIterator" with the proper type (25)]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue