Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-html-parser

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-html-parser - npm Package Compare versions

Comparing version 1.4.7 to 1.4.8

47

dist/esm/nodes/html.js

@@ -79,3 +79,3 @@ import { decode } from 'he';

if (this.parentNode) {
const children = this.childNodes;
const children = this.parentNode.childNodes;
this.parentNode.childNodes = children.filter((child) => {

@@ -101,10 +101,9 @@ return this !== child;

exchangeChild(oldNode, newNode) {
let idx = -1;
for (let i = 0; i < this.childNodes.length; i++) {
if (this.childNodes[i] === oldNode) {
idx = i;
break;
const children = this.childNodes;
this.childNodes = children.map((child) => {
if (child === oldNode) {
return newNode;
}
}
this.childNodes[idx] = newNode;
return child;
});
}

@@ -561,2 +560,34 @@ get tagName() {

}
get nextSibling() {
if (this.parentNode) {
const children = this.parentNode.childNodes;
let i = 0;
while (i < children.length) {
const child = children[i++];
if (this === child) {
return children[i] || null;
}
}
return null;
}
}
get nextElementSibling() {
if (this.parentNode) {
const children = this.parentNode.childNodes;
let i = 0;
let find = false;
while (i < children.length) {
const child = children[i++];
if (find) {
if (child instanceof HTMLElement) {
return child || null;
}
}
else if (this === child) {
find = true;
}
}
return null;
}
}
}

@@ -563,0 +594,0 @@ // https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name

@@ -483,3 +483,3 @@ var __extends = (this && this.__extends) || (function () {

if (this.parentNode) {
var children = this.childNodes;
var children = this.parentNode.childNodes;
this.parentNode.childNodes = children.filter(function (child) {

@@ -505,10 +505,9 @@ return _this !== child;

HTMLElement.prototype.exchangeChild = function (oldNode, newNode) {
var idx = -1;
for (var i = 0; i < this.childNodes.length; i++) {
if (this.childNodes[i] === oldNode) {
idx = i;
break;
var children = this.childNodes;
this.childNodes = children.map(function (child) {
if (child === oldNode) {
return newNode;
}
}
this.childNodes[idx] = newNode;
return child;
});
};

@@ -1015,2 +1014,42 @@ Object.defineProperty(HTMLElement.prototype, "tagName", {

};
Object.defineProperty(HTMLElement.prototype, "nextSibling", {
get: function () {
if (this.parentNode) {
var children = this.parentNode.childNodes;
var i = 0;
while (i < children.length) {
var child = children[i++];
if (this === child) {
return children[i] || null;
}
}
return null;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(HTMLElement.prototype, "nextElementSibling", {
get: function () {
if (this.parentNode) {
var children = this.parentNode.childNodes;
var i = 0;
var find = false;
while (i < children.length) {
var child = children[i++];
if (find) {
if (child instanceof HTMLElement) {
return child || null;
}
}
else if (this === child) {
find = true;
}
}
return null;
}
},
enumerable: false,
configurable: true
});
return HTMLElement;

@@ -1017,0 +1056,0 @@ }(node_3.default));

@@ -155,2 +155,4 @@ import Node from './node';

insertAdjacentHTML(where: InsertPosition, html: string): void;
get nextSibling(): Node;
get nextElementSibling(): HTMLElement;
}

@@ -157,0 +159,0 @@ export interface Options {

@@ -110,3 +110,3 @@ "use strict";

if (this.parentNode) {
var children = this.childNodes;
var children = this.parentNode.childNodes;
this.parentNode.childNodes = children.filter(function (child) {

@@ -132,10 +132,9 @@ return _this !== child;

HTMLElement.prototype.exchangeChild = function (oldNode, newNode) {
var idx = -1;
for (var i = 0; i < this.childNodes.length; i++) {
if (this.childNodes[i] === oldNode) {
idx = i;
break;
var children = this.childNodes;
this.childNodes = children.map(function (child) {
if (child === oldNode) {
return newNode;
}
}
this.childNodes[idx] = newNode;
return child;
});
};

@@ -642,2 +641,42 @@ Object.defineProperty(HTMLElement.prototype, "tagName", {

};
Object.defineProperty(HTMLElement.prototype, "nextSibling", {
get: function () {
if (this.parentNode) {
var children = this.parentNode.childNodes;
var i = 0;
while (i < children.length) {
var child = children[i++];
if (this === child) {
return children[i] || null;
}
}
return null;
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(HTMLElement.prototype, "nextElementSibling", {
get: function () {
if (this.parentNode) {
var children = this.parentNode.childNodes;
var i = 0;
var find = false;
while (i < children.length) {
var child = children[i++];
if (find) {
if (child instanceof HTMLElement) {
return child || null;
}
}
else if (this === child) {
find = true;
}
}
return null;
}
},
enumerable: false,
configurable: true
});
return HTMLElement;

@@ -644,0 +683,0 @@ }(node_1.default));

9

package.json
{
"name": "node-html-parser",
"version": "1.4.7",
"version": "1.4.8",
"description": "A very fast HTML parser, generating a simplified DOM, with basic element query support.",

@@ -16,7 +16,10 @@ "main": "dist/index.js",

"build": "npm run lint && npm run clean && npm run ts:cjs && npm run ts:amd && npm run ts:esm",
"dev": "tsc -w",
"dev": "tsc -w & mocha -w ./test/*.js",
"pretest": "tsc -m commonjs"
},
"keywords": [
"fast html parser nodejs typescript"
"parser",
"html",
"nodejs",
"typescript"
],

@@ -23,0 +26,0 @@ "author": "Xiaoyi Shi <ashi009@gmail.com>",

@@ -65,3 +65,3 @@ # Fast HTML Parser [![NPM version](https://badge.fury.io/js/node-html-parser.png)](http://badge.fury.io/js/node-html-parser) [![Build Status](https://travis-ci.org/taoqf/node-html-parser.svg?branch=master)](https://travis-ci.org/taoqf/node-html-parser)

## global Methods
## Global Methods

@@ -146,3 +146,3 @@ ### parse(data[, options])

### HTMLElement#remove();
### HTMLElement#remove()

@@ -186,1 +186,9 @@ Remove current element.

Get outerHTML.
### HTMLElement#nextSibling
Returns a reference to the next child node of the current element's parent.
### HTMLElement#nextElementSibling
Returns a reference to the next child element of the current element's parent.
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