mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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, Node, TextNodeTypeId};
|
||||
use dom::window::Window;
|
||||
|
||||
|
@ -14,15 +15,15 @@ pub struct Text {
|
|||
|
||||
impl Text {
|
||||
/// Creates a new HTML text node.
|
||||
pub fn new(text: ~str) -> Text {
|
||||
pub fn new(text: ~str, document: AbstractDocument) -> Text {
|
||||
Text {
|
||||
element: CharacterData::new(TextNodeTypeId, text)
|
||||
element: CharacterData::new(TextNodeTypeId, text, document)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn Constructor(owner: @mut Window, text: &DOMString) -> Fallible<AbstractNode<ScriptView>> {
|
||||
let cx = owner.page.js_info.get_ref().js_compartment.cx.ptr;
|
||||
let text = @Text::new(null_str_as_empty(text));
|
||||
let text = @Text::new(null_str_as_empty(text), owner.Document());
|
||||
Ok(unsafe { Node::as_abstract_node(cx, text) })
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue