-
-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ignore unparsed entity logic for std xml entities
PR-URL: #266 Credit: @SethFalco Close: #266 Reviewed-by: @HeikoTheissen
- Loading branch information
Showing
4 changed files
with
63 additions
and
3 deletions.
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
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require(__dirname).test({ | ||
opt: {unparsedEntities: true}, | ||
xml: '<svg>' + | ||
'<text>' + | ||
'&' + | ||
'</text>' + | ||
'</svg>', | ||
expect: [ | ||
['opentagstart', {'name': 'SVG', attributes: {}}], | ||
['opentag', {'name': 'SVG', attributes: {}, isSelfClosing: false}], | ||
['opentagstart', {'name': 'TEXT', attributes: {}}], | ||
['opentag', {'name': 'TEXT', attributes: {}, isSelfClosing: false}], | ||
['text', '&'], | ||
['closetag', 'TEXT'], | ||
['closetag', 'SVG'] | ||
] | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var sax = require('../lib/sax'); | ||
sax.ENTITIES.entity_reference = "<text>entity reference</text>"; | ||
sax.ENTITIES.escaped_entity_reference = "<text>escaped entity reference</text>"; | ||
require(__dirname).test({ | ||
opt: {unparsedEntities: true}, | ||
xml: '<svg>' + | ||
'<text>' + | ||
'<text>escaped literal</text>' + | ||
'</text>' + | ||
'&entity_reference;' + | ||
'<text>' + | ||
'&escaped_entity_reference;' + | ||
'</text>' + | ||
'</svg>', | ||
expect: [ | ||
['opentagstart', {'name': 'SVG', attributes: {}}], | ||
['opentag', {'name': 'SVG', attributes: {}, isSelfClosing: false}], | ||
['opentagstart', {'name': 'TEXT', attributes: {}}], | ||
['opentag', {'name': 'TEXT', attributes: {}, isSelfClosing: false}], | ||
['text', '<text>escaped literal</text>'], | ||
['closetag', 'TEXT'], | ||
['opentagstart', {'name': 'TEXT', attributes: {}}], | ||
['opentag', {'name': 'TEXT', attributes: {}, isSelfClosing: false}], | ||
['text', 'entity reference'], | ||
['closetag', 'TEXT'], | ||
['opentagstart', {'name': 'TEXT', attributes: {}}], | ||
['opentag', {'name': 'TEXT', attributes: {}, isSelfClosing: false}], | ||
['text', '<text>escaped entity reference</text>'], | ||
['closetag', 'TEXT'], | ||
['closetag', 'SVG'] | ||
] | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require(__dirname).test({ | ||
opt: {unparsedEntities: true}, | ||
xml: '<doc a=""">' + | ||
'</doc>', | ||
expect: [ | ||
['opentagstart', {'name': 'DOC', attributes: {}}], | ||
['attribute', { name: 'A', value: '"'} ], | ||
['opentag', {'name': 'DOC', attributes: {A: '"'}, isSelfClosing: false}], | ||
['closetag', 'DOC'] | ||
] | ||
}) |