Socket
Socket
Sign inDemoInstall

htmlparser2

Package Overview
Dependencies
8
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.2 to 3.1.3

tests/Events/12-long-comment-end.json

6

lib/Parser.js

@@ -148,3 +148,9 @@ var Tokenizer = require("./Tokenizer.js");

else this._stack.splice(pos);
} else if (name === "p" && !this._options.xmlMode) {
this.onopentagname(name);
this.onselfclosingtag();
}
} else if ((name === 'br' || name === 'p') && !this._options.xmlMode) {
this.onopentagname(name);
this.onselfclosingtag();
}

@@ -151,0 +157,0 @@ };

52

lib/Tokenizer.js

@@ -93,3 +93,3 @@ module.exports = Tokenizer;

if(c === "<"){
this._emitIfToken("text");
this._emitIfToken("ontext");
this._state = BEFORE_TAG_NAME;

@@ -124,7 +124,7 @@ this._sectionStart = this._index;

if(c === "/"){
this._emitToken("opentagname");
this._emitToken("onopentagname");
this._cbs.onselfclosingtag();
this._state = AFTER_CLOSING_TAG_NAME;
} else if(c === ">"){
this._emitToken("opentagname");
this._emitToken("onopentagname");
this._cbs.onopentagend();

@@ -134,3 +134,3 @@ this._state = TEXT;

} else if(whitespace(c)){
this._emitToken("opentagname");
this._emitToken("onopentagname");
this._state = BEFORE_ATTRIBUTE_NAME;

@@ -155,3 +155,3 @@ }

if(c === ">"){
this._emitToken("closetag");
this._emitToken("onclosetag");
this._state = TEXT;

@@ -161,3 +161,3 @@ this._sectionStart = this._index + 1;

} else if(whitespace(c)){
this._emitToken("closetag");
this._emitToken("onclosetag");
this._state = AFTER_CLOSING_TAG_NAME;

@@ -191,9 +191,9 @@ this._special = 0;

if(c === "="){
this._emitIfToken("attribname");
this._emitIfToken("onattribname");
this._state = BEFORE_ATTRIBUTE_VALUE;
} else if(whitespace(c)){
this._emitIfToken("attribname");
this._emitIfToken("onattribname");
this._state = AFTER_ATTRIBUTE_NAME;
} else if(c === "/" || c === ">"){
this._emitIfToken("attribname");
this._emitIfToken("onattribname");
this._state = BEFORE_ATTRIBUTE_NAME;

@@ -225,3 +225,3 @@ this._index--;

if(c === "\""){
this._emitToken("attribvalue");
this._emitToken("onattribvalue");
this._state = BEFORE_ATTRIBUTE_NAME;

@@ -231,8 +231,8 @@ }

if(c === "'"){
this._emitToken("attribvalue");
this._state = BEFORE_ATTRIBUTE_NAME;
this._emitToken("onattribvalue");
}
} else if(this._state === IN_ATTRIBUTE_VALUE_NO_QUOTES){
if(c === ">"){
this._emitToken("attribvalue");
this._emitToken("onattribvalue");
this._state = TEXT;

@@ -242,3 +242,3 @@ this._cbs.onopentagend();

} else if(whitespace(c)){
this._emitToken("attribvalue");
this._emitToken("onattribvalue");
this._state = BEFORE_ATTRIBUTE_NAME;

@@ -257,3 +257,3 @@ }

if(c === ">"){
this._emitToken("declaration");
this._emitToken("ondeclaration");
this._state = TEXT;

@@ -269,3 +269,3 @@ this._sectionStart = this._index + 1;

if(c === ">"){
this._emitToken("processinginstruction");
this._emitToken("onprocessinginstruction");
this._state = TEXT;

@@ -297,2 +297,4 @@ this._sectionStart = this._index + 1;

this._sectionStart = this._index + 1;
} else if (c === '-') {
// Keep the state at AFTER_COMMENT_2
} else {

@@ -339,3 +341,5 @@ this._state = IN_COMMENT;

this._sectionStart = this._index + 1;
} else {
} else if (c === ']') {
// Keep the state at AFTER_CDATA_2
}else {
this._state = IN_CDATA;

@@ -504,3 +508,3 @@ }

if(this._state === TEXT){
this._emitIfToken("text");
this._emitIfToken("ontext");
this._buffer = "";

@@ -535,11 +539,11 @@ this._index = 0;

else if(this._state === IN_CDATA || this._state === AFTER_CDATA_1 || this._state === AFTER_CDATA_2){
this._emitIfToken("cdata");
this._emitIfToken("oncdata");
} else if(this._state === IN_COMMENT || this._state === AFTER_COMMENT_1 || this._state === AFTER_COMMENT_2){
this._emitIfToken("comment");
this._emitIfToken("oncomment");
} else if(this._state === IN_TAG_NAME){
this._emitIfToken("opentagname");
this._emitIfToken("onopentagname");
} else if(this._state === IN_CLOSING_TAG_NAME){
this._emitIfToken("closetag");
this._emitIfToken("onclosetag");
} else {
this._emitIfToken("text");
this._emitIfToken("ontext");
}

@@ -555,3 +559,3 @@

Tokenizer.prototype._emitToken = function(name){
this._cbs["on" + name](this._buffer.substring(this._sectionStart, this._index));
this._cbs[name](this._buffer.substring(this._sectionStart, this._index));
this._sectionStart = -1;

@@ -562,5 +566,5 @@ };

if(this._index > this._sectionStart){
this._cbs["on" + name](this._buffer.substring(this._sectionStart, this._index));
this._cbs[name](this._buffer.substring(this._sectionStart, this._index));
}
this._sectionStart = -1;
};
{
"name": "htmlparser2",
"description": "Fast & forgiving HTML/XML/RSS parser",
"version": "3.1.2",
"version": "3.1.3",
"author": "Felix Boehm <me@feedic.com>",

@@ -6,0 +6,0 @@ "keywords": ["html", "parser", "streams", "xml", "dom", "rss", "feed", "atom"],

@@ -1,2 +0,2 @@

#htmlparser2 [![Build Status](https://secure.travis-ci.org/fb55/htmlparser2.png)](http://travis-ci.org/fb55/htmlparser2)
#htmlparser2 [![NPM version](https://badge.fury.io/js/htmlparser2.png)](https://npmjs.org/package/htmlparser2) [![Build Status](https://secure.travis-ci.org/fb55/htmlparser2.png)](http://travis-ci.org/fb55/htmlparser2) [![Dependency Status](https://david-dm.org/fb55/htmlparser2.png)](https://david-dm.org/fb55/htmlparser2)

@@ -3,0 +3,0 @@ A forgiving HTML/XML/RSS parser written in JS for NodeJS. The parser can handle streams (chunked data) and supports custom handlers for writing custom DOMs/output.

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc