New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

node-html-parser

Package Overview
Dependencies
Maintainers
1
Versions
123
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
7.0.1
to
7.0.2
+10
-0
CHANGELOG.md

@@ -5,2 +5,12 @@ # Changelog

### [7.0.2](https://github.com/taoqf/node-fast-html-parser/compare/v7.0.1...v7.0.2) (2026-01-07)
### Bug Fixes
* [#227](https://github.com/taoqf/node-fast-html-parser/issues/227) ([51528c4](https://github.com/taoqf/node-fast-html-parser/commit/51528c41ef2648d6c4dc1aecd14ee9d2b0083c4f))
* [#294](https://github.com/taoqf/node-fast-html-parser/issues/294) Closing tag is missing but valid HTML is still not parseable ([950865f](https://github.com/taoqf/node-fast-html-parser/commit/950865fab5f4df7853b36712869b71c90f4d3a1b))
* add missing dev dependency: yarn ([6d73ea3](https://github.com/taoqf/node-fast-html-parser/commit/6d73ea37c48f4170c35907869ba410c5122a9a1f))
* test valid.js ([a81fc46](https://github.com/taoqf/node-fast-html-parser/commit/a81fc46fab2507615b0362150d62568a6f52ee4e))
### [7.0.1](https://github.com/taoqf/node-fast-html-parser/compare/v7.0.0...v7.0.1) (2024-12-26)

@@ -7,0 +17,0 @@

+3
-1

@@ -46,4 +46,4 @@ import VoidTag from '../void-tag';

private _parseOptions;
private _id;
rawTagName: string;
id: string;
classList: DOMTokenList;

@@ -83,2 +83,4 @@ /**

get isVoidElement(): boolean;
get id(): string;
set id(newid: string);
/**

@@ -85,0 +87,0 @@ * Get escpaed (as-it) text value of current node and its children.

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

this.rawAttrs = rawAttrs || '';
this.id = keyAttrs.id || '';
this._id = keyAttrs.id || '';
this.childNodes = [];

@@ -189,2 +189,8 @@ this._parseOptions = _parseOptions;

}
get id() {
return this._id;
}
set id(newid) {
this.setAttribute('id', newid);
}
/**

@@ -355,3 +361,3 @@ * Get escpaed (as-it) text value of current node and its children.

function dfs(node) {
const idStr = node.id ? `#${node.id}` : '';
const idStr = node._id ? `#${node._id}` : '';
const classStr = node.classList.length ? `.${node.classList.value.join('.')}` : ''; // eslint-disable-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-call

@@ -489,3 +495,3 @@ write(`${node.rawTagName}${idStr}${classStr}`);

if (child.nodeType === type_1.default.ELEMENT_NODE) {
if (child.id === id) {
if (child._id === id) {
return child;

@@ -630,5 +636,5 @@ }

.join(' ');
// Update this.id
// Update this._id
if (key === 'id') {
this.id = '';
this._id = '';
}

@@ -678,5 +684,5 @@ return this;

.join(' ');
// Update this.id
// Update this._id
if (key === 'id') {
this.id = value;
this._id = value;
}

@@ -707,2 +713,6 @@ return this;

.join(' ');
// Update this._id
if ('id' in attributes) {
this._id = attributes['id'];
}
return this;

@@ -915,2 +925,5 @@ }

};
const kElementsClosedByClosingExcept = {
p: { a: true, audio: true, del: true, ins: true, map: true, noscript: true, video: true },
};
const frameflag = 'documentfragmentcontainer';

@@ -1060,2 +1073,21 @@ /**

}
const openTag = currentParent.rawTagName ?
currentParent.rawTagName.toLowerCase() :
'';
if (kElementsClosedByClosingExcept[openTag]) {
const closingTag = tagName.toLowerCase();
if (stack.length > 1) {
const possibleContainer = stack[stack.length - 2];
if (possibleContainer &&
possibleContainer.rawTagName &&
possibleContainer.rawTagName.toLowerCase() === closingTag &&
!kElementsClosedByClosingExcept[openTag][closingTag]) {
// Update range end for closed tag
currentParent.range[1] = createRange(-1, Math.max(lastTextPos, tagEndPos))[1];
stack.pop();
currentParent = (0, back_1.default)(stack);
continue;
}
}
}
// Use aggressive strategy to handle unmatching markups.

@@ -1062,0 +1094,0 @@ break;

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

@@ -90,3 +90,4 @@ "main": "dist/index.js",

"ts-node": "^10.9.1",
"typescript": "latest"
"typescript": "latest",
"yarn": "^1.22.22"
},

@@ -93,0 +94,0 @@ "config": {

@@ -46,2 +46,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://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Ftaoqf%2Fnode-html-parser%2Fbadge%3Fref%3Dmain&style=flat)](https://actions-badge.atrox.dev/taoqf/node-html-parser/goto?ref=main)

// parse() adds a wrapper node, so the input data's first node is the root's first child node
console.log(root.firstChild.structure);

@@ -78,3 +79,3 @@ // ul#list

Parse the data provided, and return the root of the generated DOM.
Parse the data provided, wrap the result in a new node, and return the root of the generated DOM.

@@ -354,7 +355,7 @@ - **data**, data to parse

Get first child node. `undefined` if the node has no children.
Get first child node of the wrapper node added by `parse()`. `undefined` if the node has no children.
### lastChild
Get last child node. `undefined` if the node has no children.
Get last child node of the wrapper node added by `parse()`. `undefined` if the node has no children.

@@ -361,0 +362,0 @@ ### firstElementChild

Sorry, the diff of this file is too big to display