Socket
Socket
Sign inDemoInstall

htmljs-parser

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

htmljs-parser - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

2

notify-util.js

@@ -63,3 +63,3 @@ var CODE_NEWLINE = 10;

message: message,
startPos: pos,
pos: pos,
endPos: parser.pos,

@@ -66,0 +66,0 @@ lineNumber: lineNumber

@@ -36,3 +36,3 @@ {

},
"version": "1.0.4"
"version": "1.0.5"
}

@@ -52,3 +52,2 @@ 'use strict';

var tagPos;
var placeholderPos;
var withinTag = false;

@@ -89,3 +88,2 @@ // This is a simple stack that we use to handle parsing

tagPos = undefined;
placeholderPos = undefined;
withinTag = false;

@@ -238,2 +236,3 @@ expressionStack = [];

placeholder.handler = currentState.placeholder;
placeholder.pos = parser.pos; // Move to the index of the `$` character

@@ -277,6 +276,2 @@ if (len) {

if (nextCode === CODE_LEFT_CURLY_BRACE) {
placeholderPos = parser.pos;
parser.skip(1);
_enterPlaceholderState({

@@ -286,2 +281,4 @@ escape: true,

});
parser.skip(1);
return true;

@@ -291,6 +288,2 @@ } else if (nextCode === CODE_EXCLAMATION) {

if (afterExclamationCode === CODE_LEFT_CURLY_BRACE) {
placeholderPos = parser.pos;
parser.skip(2);
_enterPlaceholderState({

@@ -300,2 +293,4 @@ escape: false,

});
parser.skip(2);
return true;

@@ -368,2 +363,8 @@ }

function PLACEHOLDER_EOF_HANDLER() {
_notifyError(currentPlaceholder.pos,
'MALFORMED_PLACEHOLDER',
'EOF reached while parsing placeholder.');
}
// In STATE_HTML_CONTENT we are looking for tags and placeholders but

@@ -379,7 +380,3 @@ // everything in between is treated as text.

eof: function() {
_notifyError(placeholderPos,
'MALFORMED_PLACEHOLDER',
'EOF reached while parsing placeholder.');
}
eof: PLACEHOLDER_EOF_HANDLER
},

@@ -995,5 +992,3 @@

eof: function() {
expressionHandler.eof();
}
eof: PLACEHOLDER_EOF_HANDLER
},

@@ -1000,0 +995,0 @@

@@ -237,3 +237,4 @@ var chai = require('chai');

expression: 'text',
escape: true
escape: true,
pos: 229
},

@@ -734,3 +735,3 @@ {

expression: '.5',
literalValue: .5
literalValue: 0.5
},

@@ -765,3 +766,3 @@ {

expression: '-.5',
literalValue: -.5
literalValue: -0.5
},

@@ -939,3 +940,4 @@ {

expression: 'xyz',
escape: true
escape: true,
pos: 6
},

@@ -965,3 +967,4 @@ {

expression: 'xyz',
escape: true
escape: true,
pos: 14
},

@@ -995,3 +998,4 @@ {

expression: 'xyz',
escape: true
escape: true,
pos: 21
},

@@ -1111,3 +1115,4 @@ {

expression: 'date',
escape: true
escape: true,
pos: 21
},

@@ -1141,3 +1146,4 @@ {

expression: 'date',
escape: false
escape: false,
pos: 21
},

@@ -1230,3 +1236,4 @@ {

expression: 'data.name',
escape: true
escape: true,
pos: 9
},

@@ -1236,3 +1243,4 @@ {

expression: '("Hello "+(data.name)+"!")',
escape: true
escape: true,
pos: 0
}

@@ -1255,3 +1263,4 @@ ]);

expression: '("Hello "+(escapeXml(data.name))+"!")',
escape: false
escape: false,
pos: 0
}

@@ -1406,3 +1415,3 @@ ]);

message: 'Element can only have one argument.',
startPos: 0,
pos: 0,
type: 'error'

@@ -1427,3 +1436,3 @@ },

message: 'Attribute can only have one argument.',
startPos: 0,
pos: 0,
endPos: 33,

@@ -1461,3 +1470,3 @@ type: 'error'

lineNumber: 1,
startPos:3,
pos:3,
endPos: 5

@@ -1480,3 +1489,3 @@ }

lineNumber: 1,
startPos:3,
pos:3,
endPos: 14

@@ -1499,3 +1508,3 @@ }

lineNumber: 1,
startPos:3,
pos:3,
endPos: 34

@@ -1518,3 +1527,3 @@ }

lineNumber: 1,
startPos:3,
pos:3,
endPos: 33

@@ -1532,3 +1541,3 @@ }

lineNumber: 1,
startPos: 0,
pos: 0,
endPos: 9

@@ -1577,3 +1586,3 @@ }

lineNumber: 1,
startPos: 0,
pos: 0,
endPos: 21

@@ -1593,3 +1602,3 @@ }

lineNumber: 1,
startPos: 0,
pos: 0,
endPos: 19

@@ -1641,3 +1650,3 @@ }

lineNumber: 2,
startPos:6,
pos:6,
endPos: 12

@@ -1661,3 +1670,3 @@ }

lineNumber: 1,
startPos:6,
pos:6,
endPos: 11

@@ -1686,3 +1695,3 @@ }

lineNumber: 1,
startPos:14,
pos:14,
endPos: 20

@@ -1711,3 +1720,3 @@ }

lineNumber: 1,
startPos:14,
pos:14,
endPos: 19

@@ -1731,3 +1740,3 @@ }

lineNumber: 1,
startPos: 6,
pos: 6,
endPos: 9

@@ -1747,3 +1756,3 @@ }

lineNumber: 1,
startPos:0,
pos:0,
endPos: 12

@@ -1753,3 +1762,18 @@ }

});
it('should handle an attribute with an invalid placeholder', function() {
parse([
'<foo invalid="${;"></foo>'
], [
{
type: 'error',
code: 'MALFORMED_PLACEHOLDER',
message: 'EOF reached while parsing placeholder.',
lineNumber: 1,
pos: 14,
endPos: 25
}
]);
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc