Socket
Socket
Sign inDemoInstall

htmlparser2

Package Overview
Dependencies
0
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.1 to 2.1.2

tests/HTML/22-lowercase_tags.js

7

lib/DefaultHandler.js

@@ -8,4 +8,7 @@ var ElementType = require("./ElementType.js");

this._tagStack = [];
if(options) this._options = options; //otherwise, the prototype is used
if(callback) this._callback = callback;
if(typeof callback === "object") this._options = callback;
else {
if(options) this._options = options; //otherwise, the prototype is used
if(callback) this._callback = callback;
}
}

@@ -12,0 +15,0 @@

@@ -18,3 +18,3 @@ var ElementType = require("./ElementType.js");

if(recurse && (childs = arr[i].children)){
childs = filterArray(test, childs, limit);
childs = filterArray(test, childs, recurse, limit);
arrayPush.apply(result, childs);

@@ -140,2 +140,2 @@ limit -= childs.length;

}
};
};
module.exports = {
Parser: require("./Parser.js"),
DefaultHandler: require("./DefaultHandler.js"),
FeedHandler: require("./FeedHandler.js"),
ElementType: require("./ElementType.js"),
DomUtils: require("./DomUtils.js")
get Parser(){
Object.defineProperty(this, "Parser", {value:require("./Parser.js")});
return this.Parser;
},
get DefaultHandler(){
Object.defineProperty(this, "DefaultHandler", {value:require("./DefaultHandler.js")});
return this.DefaultHandler;
},
get FeedHandler(){
Object.defineProperty(this, "FeedHandler", {value:require("./FeedHandler.js")});
return this.FeedHandler;
},
get ElementType(){
Object.defineProperty(this, "ElementType", {value:require("./ElementType.js")});
return ElementType;
},
get DomUtils(){
Object.defineProperty(this, "DomUtils", {value:require("./DomUtils.js")});
return this.DomUtils;
}
}

@@ -15,3 +15,2 @@ var ElementType = require("./ElementType.js");

//**"Static"**//
//Regular expressions used for cleaning up and parsing (stateless)

@@ -36,4 +35,2 @@ var _reTagName = /[^\s\/]+/; //matches tag names

//**Public**//
//Methods//
//Parses a complete HTML and pushes it to the handler

@@ -57,6 +54,7 @@ Parser.prototype.parseComplete = function(data){

if(this._done) return;
if(chunk) this.write(chunk);
this._done = true;
//Parse the buffer to its end
if(chunk) this._buffer += chunk;
if(this._buffer) this._parseTags(true);

@@ -77,4 +75,3 @@

//**Private**//
//Takes an element and adds an "attribs" property for any element attributes found
//parses the attribute string
var parseAttributes = function(data){

@@ -86,4 +83,4 @@ var pos = data.search(/\w\s/) + 1, attrs = {}; //Find any whitespace

_reAttrib.lastIndex = 0;
var match;
while(match = _reAttrib.exec(attribRaw)){

@@ -93,3 +90,3 @@ if(match[1]) attrs[match[1]] = match[2] || match[3] || match[4];

}
return attrs;

@@ -111,3 +108,3 @@ };

//SpecialTags[ElementType.Tag] = 0;
SpecialTags[ElementType.Style] = 1; //2^0
SpecialTags[ElementType.Style] = 1; //2^0
SpecialTags[ElementType.Script] = 2; //2^1

@@ -227,3 +224,18 @@ SpecialTags[ElementType.Comment] = 4; //2^3

var emptyTags = require("./ClosingTags.js").self;
var emptyTags = {
area: true,
base: true,
basefont: true,
br: true,
col: true,
frame: true,
hr: true,
img: true,
input: true,
isindex: true,
link: true,
meta: true,
param: true,
embed: true
};

@@ -230,0 +242,0 @@ Parser.prototype._processCloseTag = function(name){

{
"name": "htmlparser2",
"description": "Forgiving HTML/XML/RSS Parser for Node. This version is optimised and cleaned and provides a SAX interface.",
"version": "2.1.1",
"version": "2.1.2",
"author": "Felix Boehm <me@feedic.com>",

@@ -6,0 +6,0 @@ "contributors": ["Chris Winberry <chris@winberry.net>"],

Sorry, the diff of this file is not supported yet

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