diff options
author | Taym Haddadi <haddadi.taym@gmail.com> | 2025-02-12 13:57:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-12 12:57:52 +0000 |
commit | 695e5fe5f1e137001c37b38b192c5c115676b6cc (patch) | |
tree | 8a5baf099a5a328a03d9519a795056d6fa9c29f9 /components/script/dom/htmlelement.rs | |
parent | 82df628a11356330f957f83494c52f328f33a061 (diff) | |
download | servo-695e5fe5f1e137001c37b38b192c5c115676b6cc.tar.gz servo-695e5fe5f1e137001c37b38b192c5c115676b6cc.zip |
Add Precustomized state to CustomElementState (#35392)
* add Precustomized state to CustomElementState
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
* Update test expectation
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
---------
Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
Diffstat (limited to 'components/script/dom/htmlelement.rs')
-rw-r--r-- | components/script/dom/htmlelement.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 346b15ef009..6c8a29c4f22 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -13,6 +13,7 @@ use script_layout_interface::QueryMsg; use style::attr::AttrValue; use style_dom::ElementState; +use super::customelementregistry::CustomElementState; use crate::dom::activation::Activatable; use crate::dom::attr::Attr; use crate::dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterData_Binding::CharacterDataMethods; @@ -618,6 +619,15 @@ impl HTMLElementMethods<crate::DomTypeHolder> for HTMLElement { return Err(Error::NotSupported); } + // Step 6: If this's custom element state is not "precustomized" or "custom", + // then throw a "NotSupportedError" DOMException. + if !matches!( + element.get_custom_element_state(), + CustomElementState::Precustomized | CustomElementState::Custom + ) { + return Err(Error::NotSupported); + } + if self.is_form_associated_custom_element() { element.init_state_for_internals(); } |