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
Named form getter #25070
Merged
+231
−22
Merged
Named form getter #25070
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f73e145
uncomment the named getter from HTMLFormElement.webidl
2108a85
created sourced names w/o past names map part
2ee6150
Removed tidy-test errors
jaymodi98 5e67dbd
Fixed is_listed_element() call and DomRoot child reference
50fdae7
implemented NamedGetter and other suggestions
amj23897 7b968a3
NamedGetter completed and fixed issues
amj23897 16b9efc
updated past_names_map to save time info
amj23897 159194b
run tidy check and added comments
amj23897 575f7f5
partially implemented SupportedPropertyNames
amj23897 a935e00
sorting partially done for Step 6 of SupportedPropertyNames
amj23897 4682d92
sorting done for Step 6 of SupportedPropertyNames
amj23897 254bbc3
removed duplicate entries from sourcedNamesVec for step 7 of Supporte…
amj23897 ef8496c
updated expected test results in log
amj23897 File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
Loading status checks…
Removed tidy-test errors
- Loading branch information
commit 2ee6150990d2bb58ccf3bd634db640e155164eff
| @@ -256,18 +256,18 @@ impl HTMLFormElementMethods for HTMLFormElement { | ||
| elements.IndexedGetter(index) | ||
| } | ||
|
|
||
| // https://html.spec.whatwg.org/multipage/#the-form-element%3Adetermine-the-value-of-a-named-property | ||
| fn NamedGetter(&self, name: DOMString) -> Option<RadioNodeListOrElement> { | ||
| // return Option::Some::<RadioNodeListOrElement>; | ||
| unimplemented!(); | ||
| } | ||
|
|
||
| // https://html.spec.whatwg.org/multipage/forms.html#the-form-element:supported-property-names | ||
| // https://html.spec.whatwg.org/multipage/#the-form-element:supported-property-names | ||
| fn SupportedPropertyNames(&self) -> Vec<DOMString> { | ||
|
|
||
| enum SourcedNameSource { | ||
| Id, | ||
| Name, | ||
| Past(std::time::Duration) | ||
| Past(std::time::Duration), | ||
| } | ||
|
|
||
| struct SourcedName { | ||
| @@ -285,16 +285,23 @@ impl HTMLFormElementMethods for HTMLFormElement { | ||
| // controls - list of form elements | ||
| // check all listed elements first, push to sourcedNamesVec as per spec | ||
| for child in controls.iter() { | ||
|
|
||
| if child.is_html_element() { // if child.is_listed() | ||
| if child.is_html_element() { | ||
jdm
Member
|
||
| // if child.is_listed() | ||
|
|
||
| if child.has_attribute(&local_name!("id")) { | ||
| // https://learning-rust.github.io/docs/b2.structs.html | ||
| let entry = SourcedName {name: child.get_string_attribute(&local_name!("id")), element: child.root_element(), source: SourcedNameSource::Id}; | ||
| let entry = SourcedName { | ||
| name: child.get_string_attribute(&local_name!("id")), | ||
| element: child.root_element(), | ||
jdm
Member
|
||
| source: SourcedNameSource::Id, | ||
| }; | ||
| sourcedNamesVec.push(entry); | ||
| } | ||
| else if child.has_attribute(&local_name!("name")) { | ||
| let entry = SourcedName {name: child.get_string_attribute(&local_name!("name")), element: child.root_element(), source: SourcedNameSource::Name}; | ||
| } else if child.has_attribute(&local_name!("name")) { | ||
| let entry = SourcedName { | ||
| name: child.get_string_attribute(&local_name!("name")), | ||
| element: child.root_element(), | ||
| source: SourcedNameSource::Name, | ||
| }; | ||
| sourcedNamesVec.push(entry); | ||
| } | ||
| } | ||
| @@ -307,14 +314,20 @@ impl HTMLFormElementMethods for HTMLFormElement { | ||
|
|
||
| // https://users.rust-lang.org/t/how-check-type-of-variable/33845/7 | ||
| if child.is::<HTMLImageElement>() { | ||
|
|
||
| if child.has_attribute(&local_name!("id")) { | ||
| // https://learning-rust.github.io/docs/b2.structs.html | ||
| let entry = SourcedName {name: child.get_string_attribute(&local_name!("id")), element: child.root_element(), source: SourcedNameSource::Id}; | ||
| let entry = SourcedName { | ||
| name: child.get_string_attribute(&local_name!("id")), | ||
| element: child.root_element(), | ||
| source: SourcedNameSource::Id, | ||
| }; | ||
| sourcedNamesVec.push(entry); | ||
| } | ||
| else if child.has_attribute(&local_name!("name")) { | ||
| let entry = SourcedName {name: child.get_string_attribute(&local_name!("name")), element: child.root_element(), source: SourcedNameSource::Name}; | ||
| } else if child.has_attribute(&local_name!("name")) { | ||
| let entry = SourcedName { | ||
| name: child.get_string_attribute(&local_name!("name")), | ||
| element: child.root_element(), | ||
| source: SourcedNameSource::Name, | ||
| }; | ||
| sourcedNamesVec.push(entry); | ||
| } | ||
| } | ||
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
@jdm Is the function call
is_html_element()correct or we should useis_listed()? We weren't able to call the methodis_listed_element()as mentioned by you on the project page../mach checkwas showing error for function call on incorrect variable type.