mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
Issue #888 - Node's owner document should never be None.
This commit is contained in:
parent
59d2d345c8
commit
04319fdb68
18 changed files with 144 additions and 135 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
use dom::bindings::utils::{DOMString, Fallible, null_str_as_empty};
|
||||
use dom::characterdata::CharacterData;
|
||||
use dom::document::AbstractDocument;
|
||||
use dom::node::{AbstractNode, ScriptView, CommentNodeTypeId, Node};
|
||||
use dom::window::Window;
|
||||
|
||||
|
@ -14,16 +15,16 @@ pub struct Comment {
|
|||
|
||||
impl Comment {
|
||||
/// Creates a new HTML comment.
|
||||
pub fn new(text: ~str) -> Comment {
|
||||
pub fn new(text: ~str, document: AbstractDocument) -> Comment {
|
||||
Comment {
|
||||
element: CharacterData::new(CommentNodeTypeId, text)
|
||||
element: CharacterData::new(CommentNodeTypeId, text, document)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn Constructor(owner: @mut Window, data: &DOMString) -> Fallible<AbstractNode<ScriptView>> {
|
||||
let s = null_str_as_empty(data);
|
||||
let cx = (*owner.page).js_info.get_ref().js_compartment.cx.ptr;
|
||||
let comment = @Comment::new(s);
|
||||
let comment = @Comment::new(s, owner.Document());
|
||||
Ok(unsafe { Node::as_abstract_node(cx, comment) })
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue