mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Added document.activeElement attribute.
This commit is contained in:
parent
82f70c5d50
commit
7da356cd05
6 changed files with 43 additions and 9 deletions
|
@ -435,6 +435,7 @@ pub trait ElementHelpers<'a> {
|
|||
fn get_inline_style_declaration(self, property: &Atom) -> Option<PropertyDeclaration>;
|
||||
fn get_important_inline_style_declaration(self, property: &Atom) -> Option<PropertyDeclaration>;
|
||||
fn serialize(self, traversal_scope: TraversalScope) -> Fallible<DOMString>;
|
||||
fn get_root_element(self) -> Option<Temporary<Element>>;
|
||||
}
|
||||
|
||||
impl<'a> ElementHelpers<'a> for JSRef<'a, Element> {
|
||||
|
@ -593,6 +594,15 @@ impl<'a> ElementHelpers<'a> for JSRef<'a, Element> {
|
|||
Err(_) => panic!("Cannot serialize element"),
|
||||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/infrastructure.html#root-element
|
||||
fn get_root_element(self) -> Option<Temporary<Element>> {
|
||||
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||
match node.ancestors().last().map(ElementCast::to_ref) {
|
||||
Some(n) => n.map(Temporary::from_rooted),
|
||||
None => Some(self).map(Temporary::from_rooted),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait AttributeHandlers {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue