New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement range input sanitization #21952
Changes from 1 commit
File filter...
Jump to…
Add a way not to sanitize values in an input until its creation is done
- Loading branch information
| @@ -14,6 +14,7 @@ use dom::bindings::codegen::Bindings::ElementBinding; | ||
| use dom::bindings::codegen::Bindings::ElementBinding::ElementMethods; | ||
| use dom::bindings::codegen::Bindings::EventBinding::EventMethods; | ||
| use dom::bindings::codegen::Bindings::FunctionBinding::Function; | ||
| use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementBinding::HTMLInputElementMethods; | ||
| use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods; | ||
| use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods; | ||
| use dom::bindings::codegen::Bindings::WindowBinding::{ScrollBehavior, ScrollToOptions}; | ||
| @@ -159,6 +160,7 @@ pub struct Element { | ||
| custom_element_definition: DomRefCell<Option<Rc<CustomElementDefinition>>>, | ||
| /// <https://dom.spec.whatwg.org/#concept-element-custom-element-state> | ||
| custom_element_state: Cell<CustomElementState>, | ||
| done_creating: Cell<bool>, | ||
| } | ||
|
|
||
| impl fmt::Debug for Element { | ||
| @@ -243,6 +245,18 @@ impl Element { | ||
| document: &Document, | ||
| creator: ElementCreator, | ||
| mode: CustomElementCreationMode, | ||
| ) -> DomRoot<Element> { | ||
| let el = Element::create_unfinished(name, is, document, creator, mode); | ||
| el.done_creating(); | ||
| el | ||
| } | ||
|
|
||
| pub fn create_unfinished( | ||
| name: QualName, | ||
| is: Option<LocalName>, | ||
| document: &Document, | ||
| creator: ElementCreator, | ||
| mode: CustomElementCreationMode, | ||
| ) -> DomRoot<Element> { | ||
| create_element(name, is, document, creator, mode) | ||
| } | ||
| @@ -286,9 +300,21 @@ impl Element { | ||
| custom_element_reaction_queue: Default::default(), | ||
| custom_element_definition: Default::default(), | ||
| custom_element_state: Cell::new(CustomElementState::Uncustomized), | ||
| done_creating: Cell::new(false), | ||
| } | ||
| } | ||
|
|
||
| pub fn done_creating(&self) { | ||
| self.done_creating.set(true); | ||
| if let Some(el) = self.downcast::<HTMLInputElement>() { | ||
| el.refresh_value(el.Value()); | ||
nox
Member
|
||
| } | ||
| } | ||
|
|
||
| pub fn is_done_creating(&self) -> bool { | ||
| self.done_creating.get() | ||
| } | ||
|
|
||
| pub fn new( | ||
| local_name: LocalName, | ||
| namespace: Namespace, | ||
| @@ -1120,13 +1120,15 @@ fn create_element_for_token( | ||
| } else { | ||
| CustomElementCreationMode::Asynchronous | ||
| }; | ||
| let element = Element::create(name, is, document, creator, creation_mode); | ||
| let element = Element::create_unfinished(name, is, document, creator, creation_mode); | ||
|
|
||
| // Step 8. | ||
| for attr in attrs { | ||
| element.set_attribute_from_parser(attr.name, attr.value, None); | ||
| } | ||
|
|
||
| element.done_creating(); | ||
Eijebong
Author
Member
|
||
|
|
||
| // Step 9. | ||
| if will_execute_script { | ||
| // Steps 9.1 - 9.2. | ||
This seems to have become substeps of step 9, could you renumber the steps and add a todo for the now missing part?