Bug 77845

Summary: Use Element's hasName/hasID flags to avoid unnecessary work when looking up name/id attributes.
Product: WebKit Reporter: Andreas Kling <kling>
Component: DOMAssignee: Andreas Kling <kling>
Severity: Normal CC: andersca, eric, ggaren, sam, tkent, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Description Flags
ggaren: review+
Patch v2 none

Description Andreas Kling 2012-02-05 20:17:01 PST
HTMLCollection: Use Element's hasName/hasID flags to avoid unnecessary work.
Comment 1 Andreas Kling 2012-02-05 20:17:52 PST
Created attachment 125557 [details]
Comment 2 Geoffrey Garen 2012-02-08 08:46:39 PST
Comment on attachment 125557 [details]

This patch makes me think the following refactoring would be a good idea:

(1) Change getIdAttribute() to check hasID() for you;
(2) Add a getNameAttribute() that works just like getIdAttribute().

Now, as long as you use these functions when getting name and/or id, everything is fast, and you remove a lot of the code you've introduced in this patch.
Comment 3 Andreas Kling 2012-02-11 05:58:01 PST
Created attachment 126631 [details]
Patch v2

Better patch with getIdAttribute() and getNameAttribute() as suggested by Geoff.
Comment 4 Andreas Kling 2012-02-11 06:50:36 PST
Comment on attachment 126631 [details]
Patch v2

Clearing flags on attachment: 126631

Committed r107477: <http://trac.webkit.org/changeset/107477>
Comment 5 Andreas Kling 2012-02-11 06:50:45 PST
All reviewed patches have been landed.  Closing bug.