Skip to content

Commit

Permalink
perf: minor optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
lddubeau committed Aug 14, 2018
1 parent d416760 commit c7e36bf
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/saxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -860,11 +860,9 @@ class SaxesParser {

/** @private */
sDoctypeQuoted(chunkState) {
const c = this.captureWhile(chunkState, cx => cx !== this.q, "doctype");
if (!c) {
return;
}
if (c !== this.q) {
const { q } = this;
const c = this.captureWhile(chunkState, cx => cx !== q, "doctype");
if (!c || c !== q) {
return;
}

Expand Down Expand Up @@ -894,13 +892,14 @@ class SaxesParser {

/** @private */
sDoctypeDTDQuoted(chunkState) {
const c = this.captureWhile(chunkState, cx => cx !== this.q, "doctype");
const { q } = this;
const c = this.captureWhile(chunkState, cx => cx !== q, "doctype");
if (!c) {
return;
}

this.doctype += String.fromCodePoint(c);
if (c === this.q) {
if (c === q) {
this.state = S_DOCTYPE_DTD;
this.q = null;
}
Expand Down Expand Up @@ -1400,13 +1399,14 @@ class SaxesParser {

/** @private */
sAttribValueQuoted(chunkState) {
const { q } = this;
const c = this.captureWhile(
chunkState,
(cx) => {
if (cx === LESS) {
this.fail("disallowed character.");
}
return cx !== this.q && cx !== AMP;
return cx !== q && cx !== AMP;
},
"attribValue");
if (c === AMP) {
Expand Down

0 comments on commit c7e36bf

Please sign in to comment.