Socket
Socket
Sign inDemoInstall

domhandler

Package Overview
Dependencies
1
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.0 to 2.4.0

test/cases/25-with-end-indices.json

10

index.js

@@ -29,2 +29,3 @@ var ElementType = require("domelementtype");

withStartIndices: false, //Add startIndex properties to nodes
withEndIndices: false, //Add endIndex properties to nodes
};

@@ -60,3 +61,9 @@

//if(this._tagStack.pop().name !== name) this._handleCallback(Error("Tagname didn't match!"));
var elem = this._tagStack.pop();
if(this._options.withEndIndices){
elem.endIndex = this._parser.endIndex;
}
if(this._elementCB) this._elementCB(elem);

@@ -75,2 +82,5 @@ };

}
if(this._options.withEndIndices){
element.endIndex = this._parser.endIndex;
}

@@ -77,0 +87,0 @@ if (this._options.withDomLvl1) {

9

package.json
{
"name": "domhandler",
"version": "2.3.0",
"version": "2.4.0",
"description": "handler for htmlparser2 that turns pages into a dom",

@@ -24,7 +24,8 @@ "main": "index.js",

"devDependencies": {
"htmlparser2": "3.8",
"mocha": "1",
"jshint": "~2.3.0"
"htmlparser2": "^3.9.0",
"mocha": "^3.0.2",
"jshint": "^2.9.1"
},
"author": "Felix Boehm <me@feedic.com>",
"license": "BSD-2-Clause",
"jshintConfig": {

@@ -31,0 +32,0 @@ "quotmark": "double",

@@ -1,6 +0,6 @@

#DOMHandler [![Build Status](https://secure.travis-ci.org/fb55/DomHandler.png)](http://travis-ci.org/fb55/DomHandler)
# domhandler [![Build Status](https://travis-ci.org/fb55/domhandler.svg?branch=master)](https://travis-ci.org/fb55/domhandler)
The DOM handler (formally known as DefaultHandler) creates a tree containing all nodes of a page. The tree may be manipulated using the DOMUtils library.
The DOM handler (formally known as DefaultHandler) creates a tree containing all nodes of a page. The tree may be manipulated using the [domutils](https://github.com/fb55/domutils) library.
##Usage
## Usage
```javascript

@@ -11,3 +11,5 @@ var handler = new DomHandler([ <func> callback(err, dom), ] [ <obj> options ]);

##Example
Available options are described below.
## Example
```javascript

@@ -25,3 +27,3 @@ var htmlparser = require("htmlparser2");

parser.write(rawHtml);
parser.done();
parser.end();
```

@@ -51,3 +53,3 @@

##Option: normalizeWhitespace
## Option: normalizeWhitespace
Indicates whether the whitespace in text nodes should be normalized (= all whitespace should be replaced with single spaces). The default value is "false".

@@ -63,3 +65,3 @@

###Example: true
### Example: true

@@ -86,3 +88,3 @@ ```javascript

###Example: false
### Example: false

@@ -109,3 +111,12 @@ ```javascript

##Option: withStartIndices
## Option: withDomLvl1
Adds DOM level 1 properties to all elements.
<!-- TODO: description -->
## Option: withStartIndices
Indicates whether a `startIndex` property will be added to nodes. When the parser is used in a non-streaming fashion, `startIndex` is an integer indicating the position of the start of the node in the document. The default value is "false".
## Option: withEndIndices
Indicates whether a `endIndex` property will be added to nodes. When the parser is used in a non-streaming fashion, `endIndex` is an integer indicating the position of the end of the node in the document. The default value is "false".
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