Bug 1376695 - Check HasName() before CanHaveName(). r=ehsan

We should check HasName() first because HasName() should be cheaper and would
typically be false.

MozReview-Commit-ID: 8l7WQR7Lcxj
This commit is contained in:
Jessica Jong
2017-07-29 11:56:53 -04:00
parent 8581f79ffd
commit 5b01fb8b01
2 changed files with 2 additions and 2 deletions

View File

@@ -487,7 +487,7 @@ nsGenericHTMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (aDocument) {
RegAccessKey();
if (CanHaveName(NodeInfo()->NameAtom()) && HasName()) {
if (HasName() && CanHaveName(NodeInfo()->NameAtom())) {
aDocument->
AddToNameTable(this, GetParsedAttr(nsGkAtoms::name)->GetAtomValue());
}