Bug 23106

Summary: HTMLFormCollection::namedItem ignores caseSensitive argument
Product: WebKit Reporter: Darin Adler <darin>
Component: DOMAssignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
patch andersca: review+

Darin Adler
Reported 2009-01-04 10:29:08 PST
I noticed this while looking at unused variable warnings.
Attachments
patch (24.56 KB, patch)
2009-01-05 00:12 PST, Darin Adler
andersca: review+
Darin Adler
Comment 1 2009-01-04 23:36:33 PST
It turns out this has no effect because the only collection that ever gets passed false for caseSensitive is the anchors collection. A much better way to do that would be to add a findAnchor function to Document for the two call sites that need it.
Darin Adler
Comment 2 2009-01-05 00:12:39 PST
Anders Carlsson
Comment 3 2009-01-05 09:14:00 PST
Comment on attachment 26426 [details] patch r=me!
Darin Adler
Comment 4 2009-01-05 09:32:25 PST
Adam Roben (:aroben)
Comment 5 2009-01-05 09:39:14 PST
Comment on attachment 26426 [details] patch > +Element* Document::findAnchor(const String& name) > +{ > + if (name.isEmpty()) > + return 0; > + if (Element* element = getElementById(name)) > + return element; Couldn't this return something other than an anchor element?
Darin Adler
Comment 6 2009-01-05 09:41:41 PST
(In reply to comment #5) > Couldn't this return something other than an anchor element? Yes. This function finds an "anchor", which is the site that a "#xxx" fragment navigates to; nowadays that can be any element with an ID although historically it could only be an anchor element. If this function returned only anchor elements, I would have made its return type be HTMLAnchorElement instead of Element.
Note You need to log in before you can comment on or make changes to this bug.