-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
14 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ var STATE_ATTR_EQ = 6 | |
var STATE_ATTR_QUOT = 7 | ||
var STATE_ATTR_VALUE = 8 | ||
var STATE_CDATA = 9 | ||
var STATE_IGNORE_CDATA = 10 | ||
|
||
var SaxLtx = module.exports = function SaxLtx () { | ||
EventEmitter.call(this) | ||
|
@@ -83,6 +84,13 @@ var SaxLtx = module.exports = function SaxLtx () { | |
if (endcomment !== -1) { | ||
pos = endcomment + 2 // target the '>' character | ||
} | ||
} else if (state === STATE_IGNORE_CDATA) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
sonnyp
Author
Member
|
||
// if we're looping through a CDATA, fast-forward using | ||
// indexOf to the first end-CDATA character ]]> | ||
var endCDATA = data.indexOf(']]>', pos) | ||
if (endCDATA !== -1) { | ||
pos = endCDATA + 2 // target the '>' character | ||
} | ||
} | ||
|
||
var c = data.charCodeAt(pos) | ||
|
@@ -104,7 +112,7 @@ var SaxLtx = module.exports = function SaxLtx () { | |
if (cData) { | ||
this.emit('text', cData) | ||
} | ||
state = STATE_IGNORE_COMMENT | ||
state = STATE_TEXT | ||
} | ||
break | ||
case STATE_TAG_NAME: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For my own education: constant
STATE_IGNORE_CDATA
is declared above as 10, checked ifstate
is equal to it in one place, yet it is never assigned tostate
. How is it supposed to work?