diff options
author | Patrick Shaughnessy <pshaughn@comcast.net> | 2020-01-21 11:06:31 -0500 |
---|---|---|
committer | Patrick Shaughnessy <pshaughn@comcast.net> | 2020-02-13 11:21:46 -0500 |
commit | f29e22f131291ed1bcd581cb9be6807c66c1534e (patch) | |
tree | cdc19a2442457a09caef9b661c97a3bb2d823364 /components/script/dom/htmlformcontrolscollection.rs | |
parent | 43c558fa597901f30f6994e2d99858f2954fdce2 (diff) | |
download | servo-f29e22f131291ed1bcd581cb9be6807c66c1534e.tar.gz servo-f29e22f131291ed1bcd581cb9be6807c66c1534e.zip |
Names should now be consistently atoms
Diffstat (limited to 'components/script/dom/htmlformcontrolscollection.rs')
-rw-r--r-- | components/script/dom/htmlformcontrolscollection.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/components/script/dom/htmlformcontrolscollection.rs b/components/script/dom/htmlformcontrolscollection.rs index 410244c52c1..59d6b923616 100644 --- a/components/script/dom/htmlformcontrolscollection.rs +++ b/components/script/dom/htmlformcontrolscollection.rs @@ -18,6 +18,7 @@ use crate::dom::node::Node; use crate::dom::radionodelist::RadioNodeList; use crate::dom::window::Window; use dom_struct::dom_struct; +use servo_atoms::Atom; #[dom_struct] pub struct HTMLFormControlsCollection { @@ -67,9 +68,11 @@ impl HTMLFormControlsCollectionMethods for HTMLFormControlsCollection { return None; } + let name = Atom::from(name); + let mut filter_map = self.collection.elements_iter().filter_map(|elem| { - if elem.get_string_attribute(&local_name!("name")) == name || - elem.get_string_attribute(&local_name!("id")) == name + if elem.get_name().map_or(false, |n| n == name) || + elem.get_id().map_or(false, |i| i == name) { Some(elem) } else { @@ -90,7 +93,7 @@ impl HTMLFormControlsCollectionMethods for HTMLFormControlsCollection { // specifically HTMLFormElement::Elements(), // and the collection filter excludes image inputs. Some(RadioNodeListOrElement::RadioNodeList( - RadioNodeList::new_controls_except_image_inputs(window, &*self.form, name), + RadioNodeList::new_controls_except_image_inputs(window, &*self.form, &name), )) } // Step 3 |