WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
58997
Qualified names used for all TagName access, yet namespace usage is rare
https://bugs.webkit.org/show_bug.cgi?id=58997
Summary
Qualified names used for all TagName access, yet namespace usage is rare
Michael Saboff
Reported
2011-04-20 08:50:37 PDT
Node::getElementsByTagName and Node::getElementsByTagNameNS always use qualified names yet few websites actually use namespaces. Given that most access is without namespaces, will split into two paths. A missing or "*" namespace can use the simple name instead of a fully qualified name.
Attachments
Patch to use only local name when namespace is empty or "*"
(8.48 KB, patch)
2011-04-20 09:16 PDT
,
Michael Saboff
mjs
: review-
Details
Formatted Diff
Diff
Patch with updates to address reviewer's issues
(8.69 KB, patch)
2011-04-21 05:29 PDT
,
Michael Saboff
mjs
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Michael Saboff
Comment 1
2011-04-20 09:16:40 PDT
Created
attachment 90347
[details]
Patch to use only local name when namespace is empty or "*"
Maciej Stachowiak
Comment 2
2011-04-20 12:33:54 PDT
Comment on
attachment 90347
[details]
Patch to use only local name when namespace is empty or "*" View in context:
https://bugs.webkit.org/attachment.cgi?id=90347&action=review
r-
> Source/WebCore/dom/Node.cpp:1736 > + if (namespaceURI.isEmpty() || namespaceURI == starAtom) > + return getElementsByTagName(localName);
I'm not sure that this is correct. getElementsByTagName is supposed to return all elements with a given localName, so forwarding the "*" namespace URI to getElementsByTagName is right. However, getElementsByTagName with an empty namespace URI is only supposed to match elements with the given localName in the null namespace. That is not the same behavior as getElementsByTagName. Here is a test case that illustrates the difference: <div id="testContainer"> </div> <pre> <script> var testContainer = document.getElementById("testContainer"); var div1 = document.createElementNS(null, "div"); var div2 = document.createElementNS("
http://madeupnamespace.com
", "div"); testContainer.appendChild(div1); testContainer.appendChild(div2); document.writeln(testContainer.getElementsByTagName("div").length); document.writeln(testContainer.getElementsByTagNameNS("*", "div").length); document.writeln(testContainer.getElementsByTagNameNS(null, "div").length); </script> </pre>
Michael Saboff
Comment 3
2011-04-21 05:29:24 PDT
Created
attachment 90513
[details]
Patch with updates to address reviewer's issues Changed Node:getElementsByTagName to process namespace with implied "*" and changed Node::getElementsByTagNameNS to handle null namespaces. No apparent impact on performance speed up.
Maciej Stachowiak
Comment 4
2011-04-21 17:55:41 PDT
Comment on
attachment 90513
[details]
Patch with updates to address reviewer's issues r=me
Michael Saboff
Comment 5
2011-04-21 18:42:16 PDT
Committed
r84586
: <
http://trac.webkit.org/changeset/84586
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug