Skip to content

Commit

Permalink
Privatize Comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ttaubert committed Oct 13, 2014
1 parent 78fef7e commit e15f8cb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion components/script/dom/comment.rs
Expand Up @@ -18,8 +18,9 @@ use servo_util::str::DOMString;
/// An HTML comment.
#[jstraceable]
#[must_root]
#[privatize]
pub struct Comment {
pub characterdata: CharacterData,
characterdata: CharacterData,
}

impl CommentDerived for EventTarget {
Expand All @@ -44,6 +45,11 @@ impl Comment {
let document = global.as_window().Document().root();
Ok(Comment::new(data, *document))
}

#[inline]
pub fn characterdata<'a>(&'a self) -> &'a CharacterData {
&self.characterdata
}
}

impl Reflectable for Comment {
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/htmlserializer.rs
Expand Up @@ -69,7 +69,7 @@ pub fn serialize(iterator: &mut NodeIterator) -> String {

fn serialize_comment(comment: JSRef<Comment>, html: &mut String) {
html.push_str("<!--");
html.push_str(comment.characterdata.data().as_slice());
html.push_str(comment.characterdata().data().as_slice());
html.push_str("-->");
}

Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/node.rs
Expand Up @@ -1469,7 +1469,7 @@ impl Node {
},
CommentNodeTypeId => {
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)
},
DocumentNodeTypeId => {
Expand Down

0 comments on commit e15f8cb

Please sign in to comment.