mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Implement CDATASection interface and createCDATASection method
This commit is contained in:
parent
431423388e
commit
4b8282b3b1
18 changed files with 106 additions and 112 deletions
|
@ -35,6 +35,7 @@ use crate::dom::bindings::xmlname::XMLName::InvalidXMLName;
|
|||
use crate::dom::bindings::xmlname::{
|
||||
namespace_from_domstring, validate_and_extract, xml_name_type,
|
||||
};
|
||||
use crate::dom::cdatasection::CDATASection;
|
||||
use crate::dom::closeevent::CloseEvent;
|
||||
use crate::dom::comment::Comment;
|
||||
use crate::dom::compositionevent::CompositionEvent;
|
||||
|
@ -3610,6 +3611,22 @@ impl DocumentMethods for Document {
|
|||
Text::new(data, self)
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-createcdatasection
|
||||
fn CreateCDATASection(&self, data: DOMString) -> Fallible<DomRoot<CDATASection>> {
|
||||
// Step 1
|
||||
if self.is_html_document {
|
||||
return Err(Error::NotSupported);
|
||||
}
|
||||
|
||||
// Step 2
|
||||
if data.contains("]]>") {
|
||||
return Err(Error::InvalidCharacter);
|
||||
}
|
||||
|
||||
// Step 3
|
||||
Ok(CDATASection::new(data, self))
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-createcomment
|
||||
fn CreateComment(&self, data: DOMString) -> DomRoot<Comment> {
|
||||
Comment::new(data, self)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue