Bug 23106 - HTMLFormCollection::namedItem ignores caseSensitive argument
Summary: HTMLFormCollection::namedItem ignores caseSensitive argument
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Darin Adler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-04 10:29 PST by Darin Adler
Modified: 2009-01-05 09:41 PST (History)
0 users

See Also:


Attachments
patch (24.56 KB, patch)
2009-01-05 00:12 PST, Darin Adler
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2009-01-04 10:29:08 PST
I noticed this while looking at unused variable warnings.
Comment 1 Darin Adler 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.
Comment 2 Darin Adler 2009-01-05 00:12:39 PST
Created attachment 26426 [details]
patch
Comment 3 Anders Carlsson 2009-01-05 09:14:00 PST
Comment on attachment 26426 [details]
patch

r=me!
Comment 4 Darin Adler 2009-01-05 09:32:25 PST
http://trac.webkit.org/changeset/39603
Comment 5 Adam Roben (:aroben) 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?
Comment 6 Darin Adler 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.