mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Implement JSManaged for DOM objects.
This commit is contained in:
parent
061269f963
commit
625325434b
137 changed files with 3644 additions and 2778 deletions
|
@ -4,19 +4,34 @@
|
|||
|
||||
//! DOM bindings for `CharacterData`.
|
||||
|
||||
use dom::bindings::codegen::InheritTypes::CharacterDataDerived;
|
||||
use dom::bindings::js::JS;
|
||||
use dom::bindings::utils::{Fallible, ErrorResult};
|
||||
use dom::bindings::utils::{Reflectable, Reflector};
|
||||
use dom::document::AbstractDocument;
|
||||
use dom::node::{Node, NodeTypeId};
|
||||
use dom::document::Document;
|
||||
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
|
||||
use dom::node::{CommentNodeTypeId, Node, NodeTypeId, TextNodeTypeId, ProcessingInstructionNodeTypeId};
|
||||
use servo_util::str::DOMString;
|
||||
|
||||
#[deriving(Encodable)]
|
||||
pub struct CharacterData {
|
||||
node: Node,
|
||||
data: DOMString,
|
||||
}
|
||||
|
||||
impl CharacterDataDerived for EventTarget {
|
||||
fn is_characterdata(&self) -> bool {
|
||||
match self.type_id {
|
||||
NodeTargetTypeId(TextNodeTypeId) |
|
||||
NodeTargetTypeId(CommentNodeTypeId) |
|
||||
NodeTargetTypeId(ProcessingInstructionNodeTypeId) => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl CharacterData {
|
||||
pub fn new_inherited(id: NodeTypeId, data: DOMString, document: AbstractDocument) -> CharacterData {
|
||||
pub fn new_inherited(id: NodeTypeId, data: DOMString, document: JS<Document>) -> CharacterData {
|
||||
CharacterData {
|
||||
node: Node::new_inherited(id, document),
|
||||
data: data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue