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);
}
}
}