diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-07-27 22:05:30 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-07-27 22:54:01 +0200 |
commit | e34bcaaa5fbb3637ebdd4ff79af2322997455efa (patch) | |
tree | 3af512257c2cda6b07afcf845bb4314c3bfababc /src/components/script/dom/htmlcollection.rs | |
parent | 4b516c184dd07d9f53f415e7ef775a3c3d3b94a3 (diff) | |
download | servo-e34bcaaa5fbb3637ebdd4ff79af2322997455efa.tar.gz servo-e34bcaaa5fbb3637ebdd4ff79af2322997455efa.zip |
Pass a non-nullable string to NamedGetter.
There is no actual reason to use a nullable string here; all callers have a
string they want to pass.
The issue dates back to the time that DOMString was inherently nullable
(before #1215); this API was not converted back to the non-nullable DOMString
type after that landed.
Diffstat (limited to 'src/components/script/dom/htmlcollection.rs')
-rw-r--r-- | src/components/script/dom/htmlcollection.rs | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/components/script/dom/htmlcollection.rs b/src/components/script/dom/htmlcollection.rs index a1d37700af6..65a617a10f6 100644 --- a/src/components/script/dom/htmlcollection.rs +++ b/src/components/script/dom/htmlcollection.rs @@ -124,7 +124,7 @@ pub trait HTMLCollectionMethods { fn Item(&self, index: u32) -> Option<Temporary<Element>>; fn NamedItem(&self, key: DOMString) -> Option<Temporary<Element>>; fn IndexedGetter(&self, index: u32, found: &mut bool) -> Option<Temporary<Element>>; - fn NamedGetter(&self, maybe_name: Option<DOMString>, found: &mut bool) -> Option<Temporary<Element>>; + fn NamedGetter(&self, name: DOMString, found: &mut bool) -> Option<Temporary<Element>>; } impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> { @@ -202,18 +202,10 @@ impl<'a> HTMLCollectionMethods for JSRef<'a, HTMLCollection> { maybe_elem } - fn NamedGetter(&self, maybe_name: Option<DOMString>, found: &mut bool) -> Option<Temporary<Element>> { - match maybe_name { - Some(name) => { - let maybe_elem = self.NamedItem(name); - *found = maybe_elem.is_some(); - maybe_elem - }, - None => { - *found = false; - None - } - } + fn NamedGetter(&self, name: DOMString, found: &mut bool) -> Option<Temporary<Element>> { + let maybe_elem = self.NamedItem(name); + *found = maybe_elem.is_some(); + maybe_elem } } |