mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Implement 'labels' attribute on 'labelable elements'
This commit is contained in:
parent
37c03c7816
commit
9df375195e
22 changed files with 184 additions and 63 deletions
|
@ -25,6 +25,7 @@ use dom::htmlformelement::{ResetFrom, SubmittedFrom};
|
|||
use dom::keyboardevent::KeyboardEvent;
|
||||
use dom::node::{Node, NodeDamage};
|
||||
use dom::node::{document_from_node, window_from_node};
|
||||
use dom::nodelist::NodeList;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use msg::constellation_msg::ConstellationChan;
|
||||
use selectors::states::*;
|
||||
|
@ -333,6 +334,16 @@ impl HTMLInputElementMethods for HTMLInputElement {
|
|||
fn SetIndeterminate(&self, val: bool) {
|
||||
self.upcast::<Element>().set_state(IN_INDETERMINATE_STATE, val)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-lfe-labels
|
||||
fn Labels(&self) -> Root<NodeList> {
|
||||
if self.Type() == "hidden" {
|
||||
let window = window_from_node(self);
|
||||
NodeList::empty(&window)
|
||||
} else {
|
||||
self.upcast::<HTMLElement>().labels()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue