mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Added document.activeElement attribute.
This commit is contained in:
parent
82f70c5d50
commit
7da356cd05
6 changed files with 43 additions and 9 deletions
|
@ -834,6 +834,19 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
self.url().serialize()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#dom-document-activeelement
|
||||
fn GetActiveElement(self) -> Option<Temporary<Element>> {
|
||||
// TODO: Step 2.
|
||||
|
||||
match self.get_focused_element() {
|
||||
Some(element) => Some(element), // Step 3. and 4.
|
||||
None => match self.GetBody() { // Step 5.
|
||||
Some(body) => Some(ElementCast::from_temporary(body)),
|
||||
None => self.GetDocumentElement(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-document-documenturi
|
||||
fn DocumentURI(self) -> DOMString {
|
||||
self.URL()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue