Bug 394442, Optimize ID, class and style getters, r=bz+sicking, sr=sicking, a=jst
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user