mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Cleanup access to CharacterData nodes
This commit is contained in:
parent
45b490c977
commit
8f73b452fb
9 changed files with 60 additions and 69 deletions
|
@ -41,11 +41,12 @@ use opaque_node::OpaqueNodeMethods;
|
||||||
|
|
||||||
use cssparser::RGBA;
|
use cssparser::RGBA;
|
||||||
use gfx::display_list::OpaqueNode;
|
use gfx::display_list::OpaqueNode;
|
||||||
use script::dom::bindings::codegen::InheritTypes::{ElementCast, HTMLIFrameElementCast};
|
use script::dom::bindings::codegen::InheritTypes::{CharacterDataCast, ElementCast};
|
||||||
use script::dom::bindings::codegen::InheritTypes::{HTMLCanvasElementCast, HTMLImageElementCast};
|
use script::dom::bindings::codegen::InheritTypes::{HTMLIFrameElementCast, HTMLCanvasElementCast};
|
||||||
use script::dom::bindings::codegen::InheritTypes::{HTMLInputElementCast, HTMLTextAreaElementCast};
|
use script::dom::bindings::codegen::InheritTypes::{HTMLImageElementCast, HTMLInputElementCast};
|
||||||
use script::dom::bindings::codegen::InheritTypes::{NodeCast, TextCast};
|
use script::dom::bindings::codegen::InheritTypes::{HTMLTextAreaElementCast, NodeCast, TextCast};
|
||||||
use script::dom::bindings::js::LayoutJS;
|
use script::dom::bindings::js::LayoutJS;
|
||||||
|
use script::dom::characterdata::LayoutCharacterDataHelpers;
|
||||||
use script::dom::element::{Element, ElementTypeId};
|
use script::dom::element::{Element, ElementTypeId};
|
||||||
use script::dom::element::{LayoutElementHelpers, RawLayoutElementHelpers};
|
use script::dom::element::{LayoutElementHelpers, RawLayoutElementHelpers};
|
||||||
use script::dom::htmlelement::HTMLElementTypeId;
|
use script::dom::htmlelement::HTMLElementTypeId;
|
||||||
|
@ -222,9 +223,8 @@ impl<'ln> TLayoutNode for LayoutNode<'ln> {
|
||||||
let text: Option<LayoutJS<Text>> = TextCast::to_layout_js(self.get_jsmanaged());
|
let text: Option<LayoutJS<Text>> = TextCast::to_layout_js(self.get_jsmanaged());
|
||||||
if let Some(text) = text {
|
if let Some(text) = text {
|
||||||
return vec![
|
return vec![
|
||||||
ContentItem::String((*text.unsafe_get()).characterdata()
|
ContentItem::String(
|
||||||
.data_for_layout()
|
CharacterDataCast::from_layout_js(&text).data_for_layout().to_owned())
|
||||||
.to_owned())
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
let input: Option<LayoutJS<HTMLInputElement>> =
|
let input: Option<LayoutJS<HTMLInputElement>> =
|
||||||
|
@ -961,7 +961,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
||||||
None => return false
|
None => return false
|
||||||
};
|
};
|
||||||
|
|
||||||
if !is_whitespace((*text.unsafe_get()).characterdata().data_for_layout()) {
|
if !is_whitespace(CharacterDataCast::from_layout_js(&text).data_for_layout()) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ use dom::bindings::codegen::InheritTypes::{CharacterDataDerived, ElementCast};
|
||||||
use dom::bindings::codegen::InheritTypes::NodeCast;
|
use dom::bindings::codegen::InheritTypes::NodeCast;
|
||||||
use dom::bindings::error::{Fallible, ErrorResult};
|
use dom::bindings::error::{Fallible, ErrorResult};
|
||||||
use dom::bindings::error::Error::IndexSize;
|
use dom::bindings::error::Error::IndexSize;
|
||||||
use dom::bindings::js::{JSRef, Temporary};
|
use dom::bindings::js::{JSRef, LayoutJS, Temporary};
|
||||||
use dom::document::Document;
|
use dom::document::Document;
|
||||||
use dom::element::Element;
|
use dom::element::Element;
|
||||||
use dom::eventtarget::{EventTarget, EventTargetTypeId};
|
use dom::eventtarget::{EventTarget, EventTargetTypeId};
|
||||||
|
@ -45,23 +45,6 @@ impl CharacterData {
|
||||||
data: DOMRefCell::new(data),
|
data: DOMRefCell::new(data),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn node<'a>(&'a self) -> &'a Node {
|
|
||||||
&self.node
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn data(&self) -> Ref<DOMString> {
|
|
||||||
self.data.borrow()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
|
||||||
#[allow(unsafe_code)]
|
|
||||||
pub unsafe fn data_for_layout<'a>(&'a self) -> &'a str {
|
|
||||||
self.data.borrow_for_layout().as_slice()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
||||||
|
@ -144,3 +127,26 @@ impl<'a> CharacterDataMethods for JSRef<'a, CharacterData> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub trait CharacterDataHelpers<'a> {
|
||||||
|
fn data(self) -> Ref<'a, DOMString>;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> CharacterDataHelpers<'a> for JSRef<'a, CharacterData> {
|
||||||
|
#[inline]
|
||||||
|
fn data(self) -> Ref<'a, DOMString> {
|
||||||
|
self.extended_deref().data.borrow()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unsafe_code)]
|
||||||
|
pub trait LayoutCharacterDataHelpers {
|
||||||
|
unsafe fn data_for_layout<'a>(&'a self) -> &'a str;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unsafe_code)]
|
||||||
|
impl LayoutCharacterDataHelpers for LayoutJS<CharacterData> {
|
||||||
|
#[inline]
|
||||||
|
unsafe fn data_for_layout<'a>(&'a self) -> &'a str {
|
||||||
|
&(*self.unsafe_get()).data.borrow_for_layout()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -42,10 +42,5 @@ impl Comment {
|
||||||
let document = global.as_window().Document().root();
|
let document = global.as_window().Document().root();
|
||||||
Ok(Comment::new(data, document.r()))
|
Ok(Comment::new(data, document.r()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn characterdata<'a>(&'a self) -> &'a CharacterData {
|
|
||||||
&self.characterdata
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLAnchorElementCas
|
||||||
use dom::bindings::codegen::InheritTypes::{HTMLAnchorElementDerived, HTMLAppletElementDerived};
|
use dom::bindings::codegen::InheritTypes::{HTMLAnchorElementDerived, HTMLAppletElementDerived};
|
||||||
use dom::bindings::codegen::InheritTypes::{HTMLAreaElementDerived, HTMLEmbedElementDerived};
|
use dom::bindings::codegen::InheritTypes::{HTMLAreaElementDerived, HTMLEmbedElementDerived};
|
||||||
use dom::bindings::codegen::InheritTypes::{HTMLFormElementDerived, HTMLImageElementDerived};
|
use dom::bindings::codegen::InheritTypes::{HTMLFormElementDerived, HTMLImageElementDerived};
|
||||||
use dom::bindings::codegen::InheritTypes::{HTMLScriptElementDerived};
|
use dom::bindings::codegen::InheritTypes::{HTMLScriptElementDerived, CharacterDataCast};
|
||||||
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;
|
use dom::bindings::error::Error::HierarchyRequest;
|
||||||
|
@ -29,6 +29,7 @@ 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, validate_and_extract};
|
use dom::bindings::utils::{xml_name_type, validate_and_extract};
|
||||||
use dom::bindings::utils::XMLName::InvalidXMLName;
|
use dom::bindings::utils::XMLName::InvalidXMLName;
|
||||||
|
use dom::characterdata::CharacterDataHelpers;
|
||||||
use dom::comment::Comment;
|
use dom::comment::Comment;
|
||||||
use dom::customevent::CustomEvent;
|
use dom::customevent::CustomEvent;
|
||||||
use dom::documentfragment::DocumentFragment;
|
use dom::documentfragment::DocumentFragment;
|
||||||
|
@ -1125,7 +1126,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
||||||
for child in title_element.children() {
|
for child in title_element.children() {
|
||||||
let child = child.root();
|
let child = child.root();
|
||||||
if let Some(text) = TextCast::to_ref(child.r()) {
|
if let Some(text) = TextCast::to_ref(child.r()) {
|
||||||
title.push_str(&text.characterdata().data());
|
title.push_str(&CharacterDataCast::from_ref(text).data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,9 @@ use dom::bindings::codegen::Bindings::HTMLTitleElementBinding;
|
||||||
use dom::bindings::codegen::Bindings::HTMLTitleElementBinding::HTMLTitleElementMethods;
|
use dom::bindings::codegen::Bindings::HTMLTitleElementBinding::HTMLTitleElementMethods;
|
||||||
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||||
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLTitleElementDerived, NodeCast};
|
use dom::bindings::codegen::InheritTypes::{HTMLElementCast, HTMLTitleElementDerived, NodeCast};
|
||||||
use dom::bindings::codegen::InheritTypes::{TextCast};
|
use dom::bindings::codegen::InheritTypes::{CharacterDataCast, TextCast};
|
||||||
use dom::bindings::js::{JSRef, Temporary};
|
use dom::bindings::js::{JSRef, Temporary};
|
||||||
|
use dom::characterdata::CharacterDataHelpers;
|
||||||
use dom::document::{Document, DocumentHelpers};
|
use dom::document::{Document, DocumentHelpers};
|
||||||
use dom::eventtarget::{EventTarget, EventTargetTypeId};
|
use dom::eventtarget::{EventTarget, EventTargetTypeId};
|
||||||
use dom::element::ElementTypeId;
|
use dom::element::ElementTypeId;
|
||||||
|
@ -51,7 +52,7 @@ impl<'a> HTMLTitleElementMethods for JSRef<'a, HTMLTitleElement> {
|
||||||
let child = child.root();
|
let child = child.root();
|
||||||
let text: Option<JSRef<Text>> = TextCast::to_ref(child.r());
|
let text: Option<JSRef<Text>> = TextCast::to_ref(child.r());
|
||||||
match text {
|
match text {
|
||||||
Some(text) => content.push_str(text.characterdata().data().as_slice()),
|
Some(text) => content.push_str(&CharacterDataCast::from_ref(text).data()),
|
||||||
None => (),
|
None => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,12 +13,11 @@ use dom::bindings::codegen::Bindings::NamedNodeMapBinding::NamedNodeMapMethods;
|
||||||
use dom::bindings::codegen::Bindings::NodeBinding::{NodeConstants, NodeMethods};
|
use dom::bindings::codegen::Bindings::NodeBinding::{NodeConstants, NodeMethods};
|
||||||
use dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods;
|
use dom::bindings::codegen::Bindings::NodeListBinding::NodeListMethods;
|
||||||
use dom::bindings::codegen::Bindings::ProcessingInstructionBinding::ProcessingInstructionMethods;
|
use dom::bindings::codegen::Bindings::ProcessingInstructionBinding::ProcessingInstructionMethods;
|
||||||
use dom::bindings::codegen::InheritTypes::{CommentCast, DocumentCast, DocumentTypeCast};
|
use dom::bindings::codegen::InheritTypes::{CharacterDataCast, DocumentCast, DocumentTypeCast};
|
||||||
use dom::bindings::codegen::InheritTypes::{ElementCast, TextCast, NodeCast, ElementDerived};
|
use dom::bindings::codegen::InheritTypes::{ElementCast, NodeCast, ElementDerived, EventTargetCast};
|
||||||
use dom::bindings::codegen::InheritTypes::{CharacterDataCast, NodeBase, NodeDerived};
|
|
||||||
use dom::bindings::codegen::InheritTypes::{ProcessingInstructionCast, EventTargetCast};
|
|
||||||
use dom::bindings::codegen::InheritTypes::{HTMLLegendElementDerived, HTMLFieldSetElementDerived};
|
use dom::bindings::codegen::InheritTypes::{HTMLLegendElementDerived, HTMLFieldSetElementDerived};
|
||||||
use dom::bindings::codegen::InheritTypes::HTMLOptGroupElementDerived;
|
use dom::bindings::codegen::InheritTypes::{HTMLOptGroupElementDerived, NodeBase, NodeDerived};
|
||||||
|
use dom::bindings::codegen::InheritTypes::{ProcessingInstructionCast, TextCast};
|
||||||
use dom::bindings::conversions;
|
use dom::bindings::conversions;
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
use dom::bindings::error::Error::{NotFound, HierarchyRequest, Syntax};
|
use dom::bindings::error::Error::{NotFound, HierarchyRequest, Syntax};
|
||||||
|
@ -29,7 +28,7 @@ use dom::bindings::js::{ResultRootable, OptionalRootable, MutNullableJS};
|
||||||
use dom::bindings::trace::JSTraceable;
|
use dom::bindings::trace::JSTraceable;
|
||||||
use dom::bindings::trace::RootedVec;
|
use dom::bindings::trace::RootedVec;
|
||||||
use dom::bindings::utils::{Reflectable, reflect_dom_object};
|
use dom::bindings::utils::{Reflectable, reflect_dom_object};
|
||||||
use dom::characterdata::CharacterData;
|
use dom::characterdata::{CharacterData, CharacterDataHelpers};
|
||||||
use dom::comment::Comment;
|
use dom::comment::Comment;
|
||||||
use dom::document::{Document, DocumentHelpers, IsHTMLDocument, DocumentSource};
|
use dom::document::{Document, DocumentHelpers, IsHTMLDocument, DocumentSource};
|
||||||
use dom::documentfragment::DocumentFragment;
|
use dom::documentfragment::DocumentFragment;
|
||||||
|
@ -1601,8 +1600,8 @@ impl Node {
|
||||||
NodeCast::from_temporary(doc_fragment)
|
NodeCast::from_temporary(doc_fragment)
|
||||||
},
|
},
|
||||||
NodeTypeId::Comment => {
|
NodeTypeId::Comment => {
|
||||||
let comment: JSRef<Comment> = CommentCast::to_ref(node).unwrap();
|
let cdata = CharacterDataCast::to_ref(node).unwrap();
|
||||||
let comment = Comment::new(comment.characterdata().data().clone(), document.r());
|
let comment = Comment::new(cdata.Data(), document.r());
|
||||||
NodeCast::from_temporary(comment)
|
NodeCast::from_temporary(comment)
|
||||||
},
|
},
|
||||||
NodeTypeId::Document => {
|
NodeTypeId::Document => {
|
||||||
|
@ -1629,14 +1628,14 @@ impl Node {
|
||||||
NodeCast::from_temporary(element)
|
NodeCast::from_temporary(element)
|
||||||
},
|
},
|
||||||
NodeTypeId::Text => {
|
NodeTypeId::Text => {
|
||||||
let text: JSRef<Text> = TextCast::to_ref(node).unwrap();
|
let cdata = CharacterDataCast::to_ref(node).unwrap();
|
||||||
let text = Text::new(text.characterdata().data().clone(), document.r());
|
let text = Text::new(cdata.Data(), document.r());
|
||||||
NodeCast::from_temporary(text)
|
NodeCast::from_temporary(text)
|
||||||
},
|
},
|
||||||
NodeTypeId::ProcessingInstruction => {
|
NodeTypeId::ProcessingInstruction => {
|
||||||
let pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(node).unwrap();
|
let pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(node).unwrap();
|
||||||
let pi = ProcessingInstruction::new(pi.target().clone(),
|
let pi = ProcessingInstruction::new(pi.target().clone(),
|
||||||
pi.characterdata().data().clone(), document.r());
|
CharacterDataCast::from_ref(pi).Data(), document.r());
|
||||||
NodeCast::from_temporary(pi)
|
NodeCast::from_temporary(pi)
|
||||||
},
|
},
|
||||||
}.root();
|
}.root();
|
||||||
|
@ -1696,7 +1695,7 @@ impl Node {
|
||||||
let node = node.root();
|
let node = node.root();
|
||||||
let text = TextCast::to_ref(node.r());
|
let text = TextCast::to_ref(node.r());
|
||||||
match text {
|
match text {
|
||||||
Some(text) => content.push_str(text.characterdata().data().as_slice()),
|
Some(text) => content.push_str(&CharacterDataCast::from_ref(text).Data()),
|
||||||
None => (),
|
None => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2123,7 +2122,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
||||||
let pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(node).unwrap();
|
let pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(node).unwrap();
|
||||||
let other_pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(other).unwrap();
|
let other_pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(other).unwrap();
|
||||||
(*pi.target() == *other_pi.target()) &&
|
(*pi.target() == *other_pi.target()) &&
|
||||||
(*pi.characterdata().data() == *other_pi.characterdata().data())
|
(*CharacterDataCast::from_ref(pi).data() == *CharacterDataCast::from_ref(other_pi).data())
|
||||||
}
|
}
|
||||||
fn is_equal_characterdata(node: JSRef<Node>, other: JSRef<Node>) -> bool {
|
fn is_equal_characterdata(node: JSRef<Node>, other: JSRef<Node>) -> bool {
|
||||||
let characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(node).unwrap();
|
let characterdata: JSRef<CharacterData> = CharacterDataCast::to_ref(node).unwrap();
|
||||||
|
|
|
@ -38,10 +38,6 @@ impl ProcessingInstruction {
|
||||||
document, ProcessingInstructionBinding::Wrap)
|
document, ProcessingInstructionBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn characterdata<'a>(&'a self) -> &'a CharacterData {
|
|
||||||
&self.characterdata
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn target<'a>(&'a self) -> &'a DOMString {
|
pub fn target<'a>(&'a self) -> &'a DOMString {
|
||||||
&self.target
|
&self.target
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,10 +42,5 @@ impl Text {
|
||||||
let document = global.as_window().Document().root();
|
let document = global.as_window().Document().root();
|
||||||
Ok(Text::new(text, document.r()))
|
Ok(Text::new(text, document.r()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn characterdata<'a>(&'a self) -> &'a CharacterData {
|
|
||||||
&self.characterdata
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,14 @@
|
||||||
use dom::attr::AttrHelpers;
|
use dom::attr::AttrHelpers;
|
||||||
use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
|
use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
|
||||||
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||||
use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast, HTMLScriptElementCast};
|
use dom::bindings::codegen::InheritTypes::{CharacterDataCast, DocumentTypeCast};
|
||||||
use dom::bindings::codegen::InheritTypes::{DocumentTypeCast, TextCast, CommentCast};
|
use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLScriptElementCast};
|
||||||
|
use dom::bindings::codegen::InheritTypes::{HTMLFormElementDerived, NodeCast};
|
||||||
use dom::bindings::codegen::InheritTypes::ProcessingInstructionCast;
|
use dom::bindings::codegen::InheritTypes::ProcessingInstructionCast;
|
||||||
use dom::bindings::codegen::InheritTypes::HTMLFormElementDerived;
|
|
||||||
use dom::bindings::js::{JS, JSRef, Temporary, OptionalRootable, Root};
|
use dom::bindings::js::{JS, JSRef, Temporary, OptionalRootable, Root};
|
||||||
use dom::bindings::js::RootedReference;
|
use dom::bindings::js::RootedReference;
|
||||||
use dom::bindings::trace::RootedVec;
|
use dom::bindings::trace::RootedVec;
|
||||||
|
use dom::characterdata::CharacterDataHelpers;
|
||||||
use dom::comment::Comment;
|
use dom::comment::Comment;
|
||||||
use dom::document::{Document, DocumentHelpers};
|
use dom::document::{Document, DocumentHelpers};
|
||||||
use dom::document::{DocumentSource, IsHTMLDocument};
|
use dom::document::{DocumentSource, IsHTMLDocument};
|
||||||
|
@ -234,22 +235,19 @@ impl<'a> Serializable for JSRef<'a, Node> {
|
||||||
},
|
},
|
||||||
|
|
||||||
(IncludeNode, NodeTypeId::Text) => {
|
(IncludeNode, NodeTypeId::Text) => {
|
||||||
let text: JSRef<Text> = TextCast::to_ref(node).unwrap();
|
let cdata = CharacterDataCast::to_ref(node).unwrap();
|
||||||
let data = text.characterdata().data();
|
serializer.write_text(&cdata.data())
|
||||||
serializer.write_text(data.as_slice())
|
|
||||||
},
|
},
|
||||||
|
|
||||||
(IncludeNode, NodeTypeId::Comment) => {
|
(IncludeNode, NodeTypeId::Comment) => {
|
||||||
let comment: JSRef<Comment> = CommentCast::to_ref(node).unwrap();
|
let cdata = CharacterDataCast::to_ref(node).unwrap();
|
||||||
let data = comment.characterdata().data();
|
serializer.write_comment(&cdata.data())
|
||||||
serializer.write_comment(data.as_slice())
|
|
||||||
},
|
},
|
||||||
|
|
||||||
(IncludeNode, NodeTypeId::ProcessingInstruction) => {
|
(IncludeNode, NodeTypeId::ProcessingInstruction) => {
|
||||||
let pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(node).unwrap();
|
let pi: JSRef<ProcessingInstruction> = ProcessingInstructionCast::to_ref(node).unwrap();
|
||||||
let data = pi.characterdata().data();
|
let data = CharacterDataCast::from_ref(pi).data();
|
||||||
serializer.write_processing_instruction(pi.target().as_slice(),
|
serializer.write_processing_instruction(&pi.target(), &data)
|
||||||
data.as_slice())
|
|
||||||
},
|
},
|
||||||
|
|
||||||
(IncludeNode, NodeTypeId::DocumentFragment) => Ok(()),
|
(IncludeNode, NodeTypeId::DocumentFragment) => Ok(()),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue