mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Add support for trait-based virtual methods on Nodes, and use it for before_remove_attr and after_set_attr.
This commit is contained in:
parent
ea2560ef20
commit
ca6cfb5bca
9 changed files with 173 additions and 65 deletions
|
@ -3,6 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::codegen::HTMLElementBinding;
|
||||
use dom::bindings::codegen::InheritTypes::ElementCast;
|
||||
use dom::bindings::codegen::InheritTypes::HTMLElementDerived;
|
||||
use dom::bindings::js::JS;
|
||||
use dom::bindings::error::{ErrorResult, Fallible};
|
||||
|
@ -10,6 +11,7 @@ use dom::document::Document;
|
|||
use dom::element::{Element, ElementTypeId, HTMLElementTypeId};
|
||||
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
|
||||
use dom::node::{Node, ElementNodeTypeId};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use js::jsapi::JSContext;
|
||||
use js::jsval::{JSVal, NullValue};
|
||||
use servo_util::namespace;
|
||||
|
@ -160,3 +162,10 @@ impl HTMLElement {
|
|||
0
|
||||
}
|
||||
}
|
||||
|
||||
impl VirtualMethods for JS<HTMLElement> {
|
||||
fn super_type(&self) -> Option<~VirtualMethods:> {
|
||||
let element: JS<Element> = ElementCast::from(self);
|
||||
Some(~element as ~VirtualMethods:)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue