Closed
Bug 355451
Opened 18 years ago
Closed 18 years ago
Be more efficient about creating HTML element
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: sicking, Assigned: sicking)
References
Details
Attachments
(1 file)
16.03 KB,
patch
|
jst
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
NS_NewHTMLElement acts case insensivly to the local name of the nodeinfo passed in when creating HTML elements. So that means that if you create a nodeinfo with an uppercase name 'INPUT' we'll still create an nsHTMLInputElement, as well as give it a nodeinfo with a lowercase localname. However it's much more efficient to lowercase the name before creating the nodeinfo. First of all callers run the risk of looking up the localname atom and the nodeinfo in vain since we'll just dicard them inside NS_NewHTMLElement. Also, it create inconsistent behaviour since only 'supported' element names are lowercased, if you try to create a 'FOOBAR' html element you'll get one with an uppercase localname atom. Additionally all callers lowercase the name for known elements anyway. The only caller the doesn't lowercase names is nsHTMLFragmentContentSink, which doesn't lowercase names for unknown elements. Patch to change this so that all callers lowercase and making NS_NewHTMLElement not lowercase comming up. I also removed nsDocument::CreateElement since NS_NewElement does the exact same thing (although with arguments in reverse order).
Assignee | ||
Comment 1•18 years ago
|
||
Attachment #241253 -
Flags: superreview?(jst)
Attachment #241253 -
Flags: review?(jst)
Comment 2•18 years ago
|
||
Comment on attachment 241253 [details] [diff] [review] Patch to fix r+sr=jst
Attachment #241253 -
Flags: superreview?(jst)
Attachment #241253 -
Flags: superreview+
Attachment #241253 -
Flags: review?(jst)
Attachment #241253 -
Flags: review+
Assignee | ||
Comment 3•18 years ago
|
||
Checked in.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Updated•18 years ago
|
Summary: Be more efficitent about creating HTML element → Be more efficient about creating HTML element
Comment 4•18 years ago
|
||
Comment on attachment 241253 [details] [diff] [review] Patch to fix >+ NS_ASSERTION(aNodeType <= NS_HTML_TAG_MAX, "aNodeType is out of bounds"); So what does it mean if I hit this assertion? Minimal testcase is <o:p></o:p>
Comment 5•18 years ago
|
||
(In reply to comment #4) > (From update of attachment 241253 [details] [diff] [review] [edit]) > >+ NS_ASSERTION(aNodeType <= NS_HTML_TAG_MAX, "aNodeType is out of bounds"); > So what does it mean if I hit this assertion? Minimal testcase is <o:p></o:p> That the assertion is wrong, since eHTMLTag_userdefined > NS_HTML_TAG_MAX.
Assignee | ||
Comment 6•18 years ago
|
||
Checked in a fix for the assertion.
Comment 7•14 years ago
|
||
Comment on attachment 241253 [details] [diff] [review] Patch to fix >- rv = CreateElement(nodeInfo, nodeInfo->NamespaceID(), >- getter_AddRefs(content)); >+ NS_NewElement(getter_AddRefs(content), nodeInfo->NamespaceID(), nodeInfo); > NS_ENSURE_SUCCESS(rv, rv); Oops.
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•