Socket
Socket
Sign inDemoInstall

htmlparser2

Package Overview
Dependencies
10
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.8.2 to 3.8.3

6

lib/Parser.js

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

xmlMode: Special behavior for script/style tags (true by default)
xmlMode: Disables the special behavior for script/style tags (false by default)
lowerCaseAttributeNames: call .toLowerCase for each attribute name (true if xmlMode is `false`)

@@ -40,3 +40,3 @@ lowerCaseTags: call .toLowerCase for each tag name (true if xmlMode is `false`)

th : { th:true },
td : { thead:true, td:true },
td : { thead:true, th:true, td:true },
body : { head:true, link:true, script:true },

@@ -92,3 +92,3 @@ li : { li:true },

polyline: true,
polygone: true
polygon: true
};

@@ -95,0 +95,0 @@

{
"name": "htmlparser2",
"description": "Fast & forgiving HTML/XML/RSS parser",
"version": "3.8.2",
"version": "3.8.3",
"author": "Felix Boehm <me@feedic.com>",

@@ -6,0 +6,0 @@ "keywords": [

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

#htmlparser2
# htmlparser2

@@ -8,10 +8,10 @@ [![NPM version](http://img.shields.io/npm/v/htmlparser2.svg?style=flat)](https://npmjs.org/package/htmlparser2)

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.
A forgiving HTML/XML/RSS parser. The parser can handle streams and provides a callback interface.
##Installing
## Installation
npm install htmlparser2
A live demo of htmlparser2 is available at http://demos.forbeslindesay.co.uk/htmlparser2/
A live demo of htmlparser2 is available [here](http://demos.forbeslindesay.co.uk/htmlparser2/).
##Usage
## Usage

@@ -34,3 +34,3 @@ ```javascript

}
});
}, {decodeEntities: true});
parser.write("Xyz <script type='text/javascript'>var foo = '<<bar>>';</ script>");

@@ -49,5 +49,7 @@ parser.end();

Read more about the parser in the [wiki](https://github.com/fb55/htmlparser2/wiki/Parser-options).
## Documentation
##Get a DOM
Read more about the parser and its options in the [wiki](https://github.com/fb55/htmlparser2/wiki/Parser-options).
## Get a DOM
The `DomHandler` (known as `DefaultHandler` in the original `htmlparser` module) produces a DOM (document object model) that can be manipulated using the [`DomUtils`](https://github.com/fb55/DomUtils) helper.

@@ -57,3 +59,3 @@

##Parsing RSS/RDF/Atom Feeds
## Parsing RSS/RDF/Atom Feeds

@@ -66,4 +68,6 @@ ```javascript

##Performance
Note: While the provided feed handler works for most feeds, you might want to use [danmactough/node-feedparser](https://github.com/danmactough/node-feedparser), which is much better tested and actively maintained.
## Performance
After having some artificial benchmarks for some time, __@AndreasMadsen__ published his [`htmlparser-benchmark`](https://github.com/AndreasMadsen/htmlparser-benchmark), which benchmarks HTML parses based on real-world websites.

@@ -86,3 +90,4 @@

##How is this different from [node-htmlparser](https://github.com/tautologistics/node-htmlparser)?
## How does this module differ from [node-htmlparser](https://github.com/tautologistics/node-htmlparser)?
This is a fork of the `htmlparser` module. The main difference is that this is intended to be used only with node (it runs on other platforms using [browserify](https://github.com/substack/node-browserify)). `htmlparser2` was rewritten multiple times and, while it maintains an API that's compatible with `htmlparser` in most cases, the projects don't share any code anymore.

@@ -92,2 +97,2 @@

The `DefaultHandler` and the `RssHandler` were renamed to clarify their purpose (to `DomHandler` and `FeedHandler`). The old names are still available when requiring `htmlparser2`, so your code should work as expected.
The `DefaultHandler` and the `RssHandler` were renamed to clarify their purpose (to `DomHandler` and `FeedHandler`). The old names are still available when requiring `htmlparser2`, your code should work as expected.
{
"name": "Implicit close tags",
"options": {},
"html": "<ol><li class=test><div><table style=width:100%><tr><td colspan=2><h3>Heading</h3><tr><td><div>Div</div><td><div>Div2</div></table></div><li><div><h3>Heading 2</h3></div></li></ol><p>Para<h4>Heading 4</h4>",
"html": "<ol><li class=test><div><table style=width:100%><tr><th>TH<td colspan=2><h3>Heading</h3><tr><td><div>Div</div><td><div>Div2</div></table></div><li><div><h3>Heading 2</h3></div></li></ol><p>Para<h4>Heading 4</h4>",
"expected": [

@@ -18,2 +18,6 @@ { "event": "opentagname", "data": [ "ol" ] },

{ "event": "opentag", "data": [ "tr", {} ] },
{ "event": "opentagname", "data": [ "th" ] },
{ "event": "opentag", "data": [ "th", {} ] },
{ "event": "text", "data": [ "TH" ] },
{ "event": "closetag", "data": [ "th" ] },
{ "event": "opentagname", "data": [ "td" ] },

@@ -20,0 +24,0 @@ { "event": "attribute", "data": [ "colspan", "2" ] },

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