Bug 394442, Optimize ID, class and style getters, r=bz+sicking, sr=sicking, a=jst

This commit is contained in:
2007-09-18 01:38:24 -07:00
parent 99c443ad77
commit d90077a7de
6 changed files with 66 additions and 4 deletions

View File

@@ -2268,6 +2268,10 @@ nsGenericElement::DispatchDOMEvent(nsEvent* aEvent,
nsIAtom*
nsGenericElement::GetID() const
{
if (!HasFlag(NODE_MAY_HAVE_ID)) {
return nsnull;
}
nsIAtom* IDName = GetIDAttributeName();
if (IDName) {
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(IDName);
@@ -3683,6 +3687,7 @@ nsGenericElement::ParseAttribute(PRInt32 aNamespaceID,
{
if (aNamespaceID == kNameSpaceID_None &&
aAttribute == GetIDAttributeName() && !aValue.IsEmpty()) {
SetFlags(NODE_MAY_HAVE_ID);
// Store id as an atom. id="" means that the element has no id,
// not that it has an emptystring as the id.
aResult.ParseAtom(aValue);