mirror of
https://github.com/servo/servo.git
synced 2025-07-23 23:33:43 +01:00
Ensure that qualified-name segments start with a valid start character (#35530)
* Add spec comments to various methods Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Ensure that qualified-name segments start with a valid start character Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
b57eba2919
commit
29e0fad21e
6 changed files with 141 additions and 161 deletions
|
@ -18,7 +18,9 @@ use crate::dom::bindings::inheritance::Castable;
|
|||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::bindings::xmlname::{namespace_from_domstring, validate_qualified_name};
|
||||
use crate::dom::bindings::xmlname::{
|
||||
namespace_from_domstring, validate_and_extract_qualified_name,
|
||||
};
|
||||
use crate::dom::document::{Document, DocumentSource, HasBrowsingContext, IsHTMLDocument};
|
||||
use crate::dom::documenttype::DocumentType;
|
||||
use crate::dom::htmlbodyelement::HTMLBodyElement;
|
||||
|
@ -57,7 +59,7 @@ impl DOMImplementation {
|
|||
|
||||
// https://dom.spec.whatwg.org/#domimplementation
|
||||
impl DOMImplementationMethods<crate::DomTypeHolder> for DOMImplementation {
|
||||
// https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype
|
||||
/// <https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype>
|
||||
fn CreateDocumentType(
|
||||
&self,
|
||||
qualified_name: DOMString,
|
||||
|
@ -65,7 +67,9 @@ impl DOMImplementationMethods<crate::DomTypeHolder> for DOMImplementation {
|
|||
sysid: DOMString,
|
||||
can_gc: CanGc,
|
||||
) -> Fallible<DomRoot<DocumentType>> {
|
||||
validate_qualified_name(&qualified_name)?;
|
||||
// Step 1. Validate qualifiedName.
|
||||
validate_and_extract_qualified_name(&qualified_name)?;
|
||||
|
||||
Ok(DocumentType::new(
|
||||
qualified_name,
|
||||
Some(pubid),
|
||||
|
@ -75,7 +79,7 @@ impl DOMImplementationMethods<crate::DomTypeHolder> for DOMImplementation {
|
|||
))
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-domimplementation-createdocument
|
||||
/// <https://dom.spec.whatwg.org/#dom-domimplementation-createdocument>
|
||||
fn CreateDocument(
|
||||
&self,
|
||||
maybe_namespace: Option<DOMString>,
|
||||
|
@ -107,7 +111,10 @@ impl DOMImplementationMethods<crate::DomTypeHolder> for DOMImplementation {
|
|||
loader,
|
||||
Some(self.document.insecure_requests_policy()),
|
||||
);
|
||||
// Step 2-3.
|
||||
|
||||
// Step 2. Let element be null.
|
||||
// Step 3. If qualifiedName is not the empty string, then set element to the result of running
|
||||
// the internal createElementNS steps, given document, namespace, qualifiedName, and an empty dictionary.
|
||||
let maybe_elem = if qname.is_empty() {
|
||||
None
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue