Closed
Bug 209780
Opened 22 years ago
Closed 22 years ago
document.getElementById converts ucs2 to utf8 too often
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: axel, Assigned: alecf)
References
Details
(Keywords: perf)
Attachments
(1 file)
3.04 KB,
patch
|
dbaron
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
This is another side effect of alecf's utf8 atoms. We compare the id atom
of a nsIXMLContent to the ucs2 encoded id value. We should convert that to
utf8 once and compare that. See the code in MatchElementId,
http://lxr.mozilla.org/seamonkey/source/content/xml/document/src/nsXMLDocument.cpp#1022
Assignee | ||
Comment 1•22 years ago
|
||
ooh, this is an easy fix... just make MatchElementId take a UTF8 string instead,
and then fix the caller to create the UTF8 string early on... the real problem
is that GetElementById does a recursive descent on the dom tree.
I'll even do the work, since I caused the regression.
Assignee: dom_bugs → alecf
Assignee | ||
Comment 2•22 years ago
|
||
and here's the speedup
note that I kept both the UTF16 and the UTF8 strings around - the reason is
that for HTML elements, we do a direct string compare out of GetAttr() - so we
need the UTF16 version... but when checking against the atom value, we can use
the UTF8 version.
looking for reviews.
Assignee | ||
Comment 3•22 years ago
|
||
Comment on attachment 125908 [details] [diff] [review]
speedup MatchElementId
And here's the fix, pretty short - requesting reviews from dbaron/jst but would
also accept an r= from axel..
Attachment #125908 -
Flags: superreview?(jst)
Attachment #125908 -
Flags: review?(dbaron)
Comment 4•22 years ago
|
||
Comment on attachment 125908 [details] [diff] [review]
speedup MatchElementId
sr=jst
Attachment #125908 -
Flags: superreview?(jst) → superreview+
Attachment #125908 -
Flags: review?(dbaron) → review+
Assignee | ||
Comment 5•22 years ago
|
||
fixed!
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•