Remove incorrect TODO comment in htmlinputelement.rs (#34970)

* Add doc comments to InputType

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Add doc comment to HtmlInputElement::checked_changed

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Remove incorrect TODO comment

The comment indicated that we should fire a change
event at a radio input when changed the checkedness.

This is incorrect, as events should only be fired as
part of the input element's activation behaviour.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-01-13 17:27:31 +01:00 committed by GitHub
parent 4332c1e405
commit e8e4cb726b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -85,32 +85,76 @@ const DEFAULT_SUBMIT_VALUE: &str = "Submit";
const DEFAULT_RESET_VALUE: &str = "Reset"; const DEFAULT_RESET_VALUE: &str = "Reset";
const PASSWORD_REPLACEMENT_CHAR: char = '●'; const PASSWORD_REPLACEMENT_CHAR: char = '●';
/// <https://html.spec.whatwg.org/multipage/#attr-input-type>
#[derive(Clone, Copy, Default, JSTraceable, PartialEq)] #[derive(Clone, Copy, Default, JSTraceable, PartialEq)]
#[allow(dead_code)] #[allow(dead_code)]
#[derive(MallocSizeOf)] #[derive(MallocSizeOf)]
pub(crate) enum InputType { pub(crate) enum InputType {
/// <https://html.spec.whatwg.org/multipage/#button-state-(type=button)>
Button, Button,
/// <https://html.spec.whatwg.org/multipage/#checkbox-state-(type=checkbox)>
Checkbox, Checkbox,
/// <https://html.spec.whatwg.org/multipage/#color-state-(type=color)>
Color, Color,
/// <https://html.spec.whatwg.org/multipage/#date-state-(type=date)>
Date, Date,
/// <https://html.spec.whatwg.org/multipage/#local-date-and-time-state-(type=datetime-local)>
DatetimeLocal, DatetimeLocal,
/// <https://html.spec.whatwg.org/multipage/#email-state-(type=email)>
Email, Email,
/// <https://html.spec.whatwg.org/multipage/#file-upload-state-(type=file)>
File, File,
/// <https://html.spec.whatwg.org/multipage/#hidden-state-(type=hidden)>
Hidden, Hidden,
/// <https://html.spec.whatwg.org/multipage/#image-button-state-(type=image)>
Image, Image,
/// <https://html.spec.whatwg.org/multipage/#month-state-(type=month)>
Month, Month,
/// <https://html.spec.whatwg.org/multipage/#number-state-(type=number)>
Number, Number,
/// <https://html.spec.whatwg.org/multipage/#password-state-(type=password)>
Password, Password,
/// <https://html.spec.whatwg.org/multipage/#radio-button-state-(type=radio)>
Radio, Radio,
/// <https://html.spec.whatwg.org/multipage/#range-state-(type=range)>
Range, Range,
/// <https://html.spec.whatwg.org/multipage/#reset-button-state-(type=reset)>
Reset, Reset,
/// <https://html.spec.whatwg.org/multipage/#text-(type=text)-state-and-search-state-(type=search)>
Search, Search,
/// <https://html.spec.whatwg.org/multipage/#submit-button-state-(type=submit)>
Submit, Submit,
/// <https://html.spec.whatwg.org/multipage/#telephone-state-(type=tel)>
Tel, Tel,
/// <https://html.spec.whatwg.org/multipage/#text-(type=text)-state-and-search-state-(type=search)>
#[default] #[default]
Text, Text,
/// <https://html.spec.whatwg.org/multipage/#time-state-(type=time)>
Time, Time,
/// <https://html.spec.whatwg.org/multipage/#url-state-(type=url)>
Url, Url,
/// <https://html.spec.whatwg.org/multipage/#week-state-(type=week)>
Week, Week,
} }
@ -242,6 +286,8 @@ enum StepDirection {
pub(crate) struct HTMLInputElement { pub(crate) struct HTMLInputElement {
htmlelement: HTMLElement, htmlelement: HTMLElement,
input_type: Cell<InputType>, input_type: Cell<InputType>,
/// <https://html.spec.whatwg.org/multipage/#concept-input-checked-dirty-flag>
checked_changed: Cell<bool>, checked_changed: Cell<bool>,
placeholder: DomRefCell<DOMString>, placeholder: DomRefCell<DOMString>,
size: Cell<u32>, size: Cell<u32>,
@ -1801,7 +1847,6 @@ impl HTMLInputElement {
} }
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage); self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
//TODO: dispatch change event
} }
// https://html.spec.whatwg.org/multipage/#concept-fe-mutable // https://html.spec.whatwg.org/multipage/#concept-fe-mutable