mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Privatize Comment
This commit is contained in:
parent
78fef7eec5
commit
e15f8cb37f
3 changed files with 9 additions and 3 deletions
|
@ -18,8 +18,9 @@ use servo_util::str::DOMString;
|
||||||
/// An HTML comment.
|
/// An HTML comment.
|
||||||
#[jstraceable]
|
#[jstraceable]
|
||||||
#[must_root]
|
#[must_root]
|
||||||
|
#[privatize]
|
||||||
pub struct Comment {
|
pub struct Comment {
|
||||||
pub characterdata: CharacterData,
|
characterdata: CharacterData,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CommentDerived for EventTarget {
|
impl CommentDerived for EventTarget {
|
||||||
|
@ -44,6 +45,11 @@ impl Comment {
|
||||||
let document = global.as_window().Document().root();
|
let document = global.as_window().Document().root();
|
||||||
Ok(Comment::new(data, *document))
|
Ok(Comment::new(data, *document))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn characterdata<'a>(&'a self) -> &'a CharacterData {
|
||||||
|
&self.characterdata
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Reflectable for Comment {
|
impl Reflectable for Comment {
|
||||||
|
|
|
@ -69,7 +69,7 @@ pub fn serialize(iterator: &mut NodeIterator) -> String {
|
||||||
|
|
||||||
fn serialize_comment(comment: JSRef<Comment>, html: &mut String) {
|
fn serialize_comment(comment: JSRef<Comment>, html: &mut String) {
|
||||||
html.push_str("<!--");
|
html.push_str("<!--");
|
||||||
html.push_str(comment.characterdata.data().as_slice());
|
html.push_str(comment.characterdata().data().as_slice());
|
||||||
html.push_str("-->");
|
html.push_str("-->");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1469,7 +1469,7 @@ impl Node {
|
||||||
},
|
},
|
||||||
CommentNodeTypeId => {
|
CommentNodeTypeId => {
|
||||||
let comment: JSRef<Comment> = CommentCast::to_ref(node).unwrap();
|
let comment: JSRef<Comment> = CommentCast::to_ref(node).unwrap();
|
||||||
let comment = Comment::new(comment.characterdata.data().clone(), *document);
|
let comment = Comment::new(comment.characterdata().data().clone(), *document);
|
||||||
NodeCast::from_temporary(comment)
|
NodeCast::from_temporary(comment)
|
||||||
},
|
},
|
||||||
DocumentNodeTypeId => {
|
DocumentNodeTypeId => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue