Skip to content

Commit

Permalink
perf: reduce the frequency at which we clear attribValue
Browse files Browse the repository at this point in the history
We initialize it to the empty string at the start and then clear it after each
processed attribute. We do not need to additionally clear it after getting an
attribute name.
  • Loading branch information
lddubeau committed Sep 3, 2018
1 parent 00536cc commit 1570615
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lib/saxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,6 @@ class SaxesParser {
}
if (isNameStartChar(c)) {
this.name = String.fromCodePoint(c);
this.attribValue = "";
this.state = S_ATTRIB_NAME;
}
else if (c === GREATER) {
Expand Down Expand Up @@ -1439,7 +1438,6 @@ class SaxesParser {
else if (isNameStartChar(c)) {
this.fail("no whitespace between attributes.");
this.name = String.fromCodePoint(c);
this.attribValue = "";
this.state = S_ATTRIB_NAME;
}
else if (c === GREATER) {
Expand Down

0 comments on commit 1570615

Please sign in to comment.