Socket
Socket
Sign inDemoInstall

htmlparser2

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

htmlparser2 - npm Package Compare versions

Comparing version 3.0.5 to 3.1.1

tests/Events/10-crazy-attrib.json

37

lib/Parser.js

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

param: true,
embed: true
embed: true,
command: true,
keygen: true,
source: true,
track: true,
wbr: true
};

@@ -98,3 +103,5 @@

Parser.prototype.onopentagname = function(name){
if(this._options.lowerCaseTags) name = name.toLowerCase();
if(!(this._options.xmlMode || "lowerCaseTags" in this._options) || this._options.lowerCaseTags){
name = name.toLowerCase();
}

@@ -132,3 +139,5 @@ this._tagname = name;

Parser.prototype.onclosetag = function(name){
if(this._options.lowerCaseTags) name = name.toLowerCase();
if(!(this._options.xmlMode || "lowerCaseTags" in this._options) || this._options.lowerCaseTags){
name = name.toLowerCase();
}
if(this._stack.length && (!(name in emptyTags) || this._options.xmlMode)){

@@ -164,3 +173,5 @@ var pos = this._stack.lastIndexOf(name);

if(this._attribname !== "") this.onattribvalue("");
if(this._options.lowerCaseAttributeNames) name = name.toLowerCase();
if(!(this._options.xmlMode || "lowerCaseAttributeNames" in this._options) || this._options.lowerCaseAttributeNames){
name = name.toLowerCase();
}
this._attribname = name;

@@ -178,3 +189,5 @@ };

var name = value.split(/\s|\//, 1)[0];
if(this._options.lowerCaseTags) name = name.toLowerCase();
if(!(this._options.xmlMode || "lowerCaseTags" in this._options) || this._options.lowerCaseTags){
name = name.toLowerCase();
}
this._cbs.onprocessinginstruction("!" + name, "!" + value);

@@ -187,3 +200,5 @@ }

var name = value.split(/\s|\//, 1)[0];
if(this._options.lowerCaseTags) name = name.toLowerCase();
if(!(this._options.xmlMode || "lowerCaseTags" in this._options) || this._options.lowerCaseTags){
name = name.toLowerCase();
}
this._cbs.onprocessinginstruction("?" + name, "?" + value);

@@ -199,5 +214,9 @@ }

Parser.prototype.oncdata = function(value){
if(this._cbs.oncdatastart) this._cbs.oncdatastart();
if(this._cbs.ontext) this._cbs.ontext(value);
if(this._cbs.oncdataend) this._cbs.oncdataend();
if(this._options.xmlMode){
if(this._cbs.oncdatastart) this._cbs.oncdatastart();
if(this._cbs.ontext) this._cbs.ontext(value);
if(this._cbs.oncdataend) this._cbs.oncdataend();
} else {
this.oncomment("[CDATA[" + value + "]]");
}
};

@@ -204,0 +223,0 @@

@@ -142,2 +142,5 @@ module.exports = Tokenizer;

this._state = BEFORE_SPECIAL_END;
} else {
this._state = TEXT;
this._index--;
}

@@ -547,2 +550,2 @@ } else {

this._sectionStart = -1;
};
};
{
"name": "htmlparser2",
"description": "Fast & forgiving HTML/XML/RSS parser",
"version": "3.0.5",
"version": "3.1.1",
"author": "Felix Boehm <me@feedic.com>",

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

@@ -5,3 +5,3 @@ {

"handler": {},
"parser": {}
"parser": {"xmlMode": true}
},

@@ -8,0 +8,0 @@ "html": "<tag><![CDATA[ asdf ><asdf></adsf><> fo]]></tag>",

@@ -9,3 +9,3 @@ {

"data": [
"!DOCTYPE",
"!doctype",
"!DOCTYPE html"

@@ -12,0 +12,0 @@ ]

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