mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
script: implement autofocus IDL reflection (#32170)
* script: implement autofocus IDL reflection * test: update wpt results files
This commit is contained in:
parent
6ca3bb440e
commit
3014e201ab
27 changed files with 45 additions and 24193 deletions
|
@ -591,6 +591,17 @@ impl HTMLElementMethods for HTMLElement {
|
|||
internals.set_attached();
|
||||
Ok(internals)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-fe-autofocus
|
||||
fn Autofocus(&self) -> bool {
|
||||
self.element.has_attribute(&local_name!("autofocus"))
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-fe-autofocus
|
||||
fn SetAutofocus(&self, autofocus: bool) {
|
||||
self.element
|
||||
.set_bool_attribute(&local_name!("autofocus"), autofocus);
|
||||
}
|
||||
}
|
||||
|
||||
fn append_text_node_to_fragment(document: &Document, fragment: &DocumentFragment, text: String) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::{namespace_url, ns, LocalName, Prefix};
|
||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
use js::rust::HandleObject;
|
||||
use style_traits::dom::ElementState;
|
||||
|
||||
|
@ -76,4 +76,15 @@ impl SVGElementMethods for SVGElement {
|
|||
)
|
||||
})
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-fe-autofocus
|
||||
fn Autofocus(&self) -> bool {
|
||||
self.element.has_attribute(&local_name!("autofocus"))
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-fe-autofocus
|
||||
fn SetAutofocus(&self, autofocus: bool) {
|
||||
self.element
|
||||
.set_bool_attribute(&local_name!("autofocus"), autofocus);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,3 +75,4 @@ HTMLElement includes GlobalEventHandlers;
|
|||
HTMLElement includes DocumentAndElementEventHandlers;
|
||||
HTMLElement includes ElementContentEditable;
|
||||
HTMLElement includes ElementCSSInlineStyle;
|
||||
HTMLElement includes HTMLOrSVGElement;
|
||||
|
|
20
components/script/dom/webidls/HTMLOrSVGElement.webidl
Normal file
20
components/script/dom/webidls/HTMLOrSVGElement.webidl
Normal file
|
@ -0,0 +1,20 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
/*
|
||||
* The origin of this IDL file is
|
||||
* https://html.spec.whatwg.org/multipage/#htmlorsvgelement
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface mixin HTMLOrSVGElement {
|
||||
// [SameObject] readonly attribute DOMStringMap dataset;
|
||||
// attribute DOMString nonce; // intentionally no [CEReactions]
|
||||
|
||||
[CEReactions] attribute boolean autofocus;
|
||||
// [CEReactions] attribute long tabIndex;
|
||||
// undefined focus(optional FocusOptions options = {});
|
||||
// undefined blur();
|
||||
};
|
|
@ -21,3 +21,4 @@ interface SVGElement : Element {
|
|||
//SVGElement includes GlobalEventHandlers;
|
||||
//SVGElement includes SVGElementInstance;
|
||||
SVGElement includes ElementCSSInlineStyle;
|
||||
SVGElement includes HTMLOrSVGElement;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue