Closed Bug 209780 Opened 21 years ago Closed 21 years ago
.get Element By Id converts ucs2 to utf8 too often
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
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
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.
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..
Comment on attachment 125908 [details] [diff] [review] speedup MatchElementId sr=jst
Attachment #125908 - Flags: superreview?(jst) → superreview+
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.