mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Support arbitrary protos when wrapping DOM objects with constructors.
This commit is contained in:
parent
d9600ff50f
commit
dbff26bce0
197 changed files with 2028 additions and 586 deletions
|
@ -11,6 +11,7 @@ use crate::dom::document::Document;
|
|||
use crate::dom::node::Node;
|
||||
use crate::dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use js::rust::HandleObject;
|
||||
|
||||
/// An HTML comment.
|
||||
#[dom_struct]
|
||||
|
@ -25,13 +26,13 @@ impl Comment {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(text: DOMString, document: &Document) -> DomRoot<Comment> {
|
||||
Node::reflect_node(Box::new(Comment::new_inherited(text, document)), document)
|
||||
pub fn new(text: DOMString, document: &Document, proto: Option<HandleObject>) -> DomRoot<Comment> {
|
||||
Node::reflect_node_with_proto(Box::new(Comment::new_inherited(text, document)), document, proto)
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub fn Constructor(window: &Window, data: DOMString) -> Fallible<DomRoot<Comment>> {
|
||||
pub fn Constructor(window: &Window, proto: Option<HandleObject>, data: DOMString) -> Fallible<DomRoot<Comment>> {
|
||||
let document = window.Document();
|
||||
Ok(Comment::new(data, &document))
|
||||
Ok(Comment::new(data, &document, proto))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue