Implement HTMLStyleElement.disabled attribute (#31682)

https://html.spec.whatwg.org/multipage/#dom-style-disabled
This commit is contained in:
Oriol Brufau 2024-03-15 00:48:29 +01:00 committed by GitHub
parent ad37a54f59
commit bc4f1c217d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 15 additions and 31 deletions

View file

@ -276,8 +276,21 @@ impl StylesheetOwner for HTMLStyleElement {
}
impl HTMLStyleElementMethods for HTMLStyleElement {
// https://drafts.csswg.org/cssom/#dom-linkstyle-sheet
/// <https://drafts.csswg.org/cssom/#dom-linkstyle-sheet>
fn GetSheet(&self) -> Option<DomRoot<DOMStyleSheet>> {
self.get_cssom_stylesheet().map(DomRoot::upcast)
}
/// <https://html.spec.whatwg.org/multipage/#dom-style-disabled>
fn Disabled(&self) -> bool {
self.get_cssom_stylesheet()
.map_or(false, |sheet| sheet.disabled())
}
/// <https://html.spec.whatwg.org/multipage/#dom-style-disabled>
fn SetDisabled(&self, value: bool) {
if let Some(sheet) = self.get_cssom_stylesheet() {
sheet.set_disabled(value);
}
}
}

View file

@ -7,6 +7,7 @@
interface HTMLStyleElement : HTMLElement {
[HTMLConstructor] constructor();
attribute boolean disabled;
// [CEReactions]
// attribute DOMString media;
// [CEReactions]

View file

@ -11,6 +11,3 @@
[StyleSheet_property_values]
expected: FAIL
[disabled attribute getter/setter]
expected: FAIL

View file

@ -4863,15 +4863,9 @@
[HTMLLinkElement interface: document.createElement("link") must inherit property "blocking" with the proper type]
expected: FAIL
[HTMLStyleElement interface: attribute disabled]
expected: FAIL
[HTMLStyleElement interface: attribute blocking]
expected: FAIL
[HTMLStyleElement interface: document.createElement("style") must inherit property "disabled" with the proper type]
expected: FAIL
[HTMLStyleElement interface: document.createElement("style") must inherit property "blocking" with the proper type]
expected: FAIL

View file

@ -1,5 +0,0 @@
[style_disabled.html]
type: testharness
[The style is not applied when it is disabled]
expected: FAIL

View file

@ -1,2 +0,0 @@
[table-anonymous-objects-015.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[table-anonymous-objects-016.xht]
expected: FAIL

View file

@ -10,6 +10,3 @@
[StyleSheet_property_values]
expected: FAIL
[disabled attribute getter/setter]
expected: FAIL

View file

@ -4581,15 +4581,9 @@
[HTMLLinkElement interface: document.createElement("link") must inherit property "blocking" with the proper type]
expected: FAIL
[HTMLStyleElement interface: attribute disabled]
expected: FAIL
[HTMLStyleElement interface: attribute blocking]
expected: FAIL
[HTMLStyleElement interface: document.createElement("style") must inherit property "disabled" with the proper type]
expected: FAIL
[HTMLStyleElement interface: document.createElement("style") must inherit property "blocking" with the proper type]
expected: FAIL

View file

@ -1,3 +0,0 @@
[style_disabled.html]
[The style is not applied when it is disabled]
expected: FAIL