mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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>
This commit is contained in:
parent
82df628a11
commit
695e5fe5f1
3 changed files with 13 additions and 6 deletions
|
@ -58,6 +58,7 @@ pub(crate) enum CustomElementState {
|
||||||
Failed,
|
Failed,
|
||||||
#[default]
|
#[default]
|
||||||
Uncustomized,
|
Uncustomized,
|
||||||
|
Precustomized,
|
||||||
Custom,
|
Custom,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,6 +925,8 @@ fn run_upgrade_constructor(
|
||||||
let _ac = JSAutoRealm::new(*cx, constructor.callback());
|
let _ac = JSAutoRealm::new(*cx, constructor.callback());
|
||||||
let args = HandleValueArray::empty();
|
let args = HandleValueArray::empty();
|
||||||
// Step 8.2. Set element's custom element state to "precustomized".
|
// Step 8.2. Set element's custom element state to "precustomized".
|
||||||
|
element.set_custom_element_state(CustomElementState::Precustomized);
|
||||||
|
|
||||||
if unsafe {
|
if unsafe {
|
||||||
!Construct1(
|
!Construct1(
|
||||||
*cx,
|
*cx,
|
||||||
|
|
|
@ -13,6 +13,7 @@ use script_layout_interface::QueryMsg;
|
||||||
use style::attr::AttrValue;
|
use style::attr::AttrValue;
|
||||||
use style_dom::ElementState;
|
use style_dom::ElementState;
|
||||||
|
|
||||||
|
use super::customelementregistry::CustomElementState;
|
||||||
use crate::dom::activation::Activatable;
|
use crate::dom::activation::Activatable;
|
||||||
use crate::dom::attr::Attr;
|
use crate::dom::attr::Attr;
|
||||||
use crate::dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterData_Binding::CharacterDataMethods;
|
use crate::dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterData_Binding::CharacterDataMethods;
|
||||||
|
@ -618,6 +619,15 @@ impl HTMLElementMethods<crate::DomTypeHolder> for HTMLElement {
|
||||||
return Err(Error::NotSupported);
|
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() {
|
if self.is_form_associated_custom_element() {
|
||||||
element.init_state_for_internals();
|
element.init_state_for_internals();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,5 @@
|
||||||
[ElementInternals.shadowRoot allows access to closed shadow root]
|
[ElementInternals.shadowRoot allows access to closed shadow root]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[ElementInternals cannot be called before constructor, upgrade case]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[ElementInternals *can* be called after constructor, upgrade case]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[ElementInternals.shadowRoot doesn't reveal pre-attached closed shadowRoot]
|
[ElementInternals.shadowRoot doesn't reveal pre-attached closed shadowRoot]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue