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
119
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 6.0.0 to 6.1.0

7

CHANGELOG.md

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

## [6.1.0](https://github.com/taoqf/node-fast-html-parser/compare/v6.0.0...v6.1.0) (2022-09-19)
### Features
* Add docs ([8a38eed](https://github.com/taoqf/node-fast-html-parser/commit/8a38eedab6b20906ee89dea86c4271960afbad2d))
## [6.0.0](https://github.com/taoqf/node-fast-html-parser/compare/v5.4.2-0...v6.0.0) (2022-09-08)

@@ -7,0 +14,0 @@

4

dist/nodes/html.d.ts

@@ -101,3 +101,3 @@ import VoidTag from '../void-tag';

set_content(content: string | Node | Node[], options?: Partial<Options>): this;
replaceWith(...nodes: (string | Node)[]): void;
replaceWith(...nodes: (string | Node)[]): this;
get outerHTML(): string;

@@ -187,3 +187,3 @@ /**

*/
setAttribute(key: string, value: string): void;
setAttribute(key: string, value: string): this;
/**

@@ -190,0 +190,0 @@ * Replace all the attributes of the HTMLElement by the provided attributes

@@ -401,2 +401,3 @@ "use strict";

parent.childNodes = __spreadArray(__spreadArray(__spreadArray([], parent.childNodes.slice(0, idx), true), resetParent(content, parent), true), parent.childNodes.slice(idx + 1), true);
return this;
};

@@ -798,2 +799,3 @@ Object.defineProperty(HTMLElement.prototype, "outerHTML", {

}
return this;
};

@@ -800,0 +802,0 @@ /**

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

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -104,13 +104,97 @@ # 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)

## Class
```mermaid
classDiagram
direction TB
class HTMLElement{
this trimRight()
this removeWhitespace()
Node[] querySelectorAll(string selector)
Node querySelector(string selector)
HTMLElement[] getElementsByTagName(string tagName)
Node closest(string selector)
Node appendChild(Node node)
this insertAdjacentHTML('beforebegin' | 'afterbegin' | 'beforeend' | 'afterend' where, string html)
this setAttribute(string key, string value)
this setAttributes(Record~string, string~ attrs)
this removeAttribute(string key)
string getAttribute(string key)
this exchangeChild(Node oldNode, Node newNode)
this removeChild(Node node)
string toString()
this set_content(string content)
this set_content(Node content)
this set_content(Node[] content)
this remove()
this replaceWith((string | Node)[] ...nodes)
ClassList classList
HTMLElement clone()
HTMLElement getElementById(string id)
string text
string rawText
string tagName
string structuredText
string structure
Node firstChild
Node lastChild
Node nextSibling
HTMLElement nextElementSibling
Node previousSibling
HTMLElement previousElementSibling
string innerHTML
string outerHTML
string textContent
Record~string, string~ attributes
[number, number] range
}
class Node{
<<abstract>>
string toString()
Node clone()
this remove()
number nodeType
string innerText
string textContent
}
class ClassList{
add(string c)
replace(string c1, string c2)
remove(string c)
toggle(string c)
boolean contains(string c)
number length
string[] value
string toString()
}
class CommentNode{
CommentNode clone()
string toString()
}
class TextNode{
TextNode clone()
string toString()
string rawText
string trimmedRawText
string trimmedText
string text
boolean isWhitespace
}
Node --|> HTMLElement
Node --|> CommentNode
Node --|> TextNode
Node ..> ClassList
```
## HTMLElement Methods
### HTMLElement#trimRight()
### trimRight()
Trim element from right (in block) after seeing pattern in a TextNode.
### HTMLElement#removeWhitespace()
### removeWhitespace()
Remove whitespaces in this sub tree.
### HTMLElement#querySelectorAll(selector)
### querySelectorAll(selector)

@@ -121,7 +205,7 @@ Query CSS selector to find matching nodes.

### HTMLElement#querySelector(selector)
### querySelector(selector)
Query CSS Selector to find matching node.
### HTMLElement#getElementsByTagName(tagName)
### getElementsByTagName(tagName)

@@ -132,85 +216,85 @@ Get all elements with the specified tagName.

### HTMLElement#closest(selector)
### closest(selector)
Query closest element by css selector.
### HTMLElement#appendChild(node)
### appendChild(node)
Append a child node to childNodes
### HTMLElement#insertAdjacentHTML(where, html)
### insertAdjacentHTML(where, html)
Parses the specified text as HTML and inserts the resulting nodes into the DOM tree at a specified position.
### HTMLElement#setAttribute(key: string, value: string)
### setAttribute(key: string, value: string)
Set `value` to `key` attribute.
### HTMLElement#setAttributes(attrs: Record<string, string>)
### setAttributes(attrs: Record<string, string>)
Set attributes of the element.
### HTMLElement#removeAttribute(key: string)
### removeAttribute(key: string)
Remove `key` attribute.
### HTMLElement#getAttribute(key: string)
### getAttribute(key: string)
Get `key` attribute.
### HTMLElement#exchangeChild(oldNode: Node, newNode: Node)
### exchangeChild(oldNode: Node, newNode: Node)
Exchanges given child with new child.
### HTMLElement#removeChild(node: Node)
### removeChild(node: Node)
Remove child node.
### HTMLElement#toString()
### toString()
Same as [outerHTML](#htmlelementouterhtml)
### HTMLElement#set_content(content: string | Node | Node[])
### set_content(content: string | Node | Node[])
Set content. **Notice**: Do not set content of the **root** node.
### HTMLElement#remove()
### remove()
Remove current element.
### HTMLElement#replaceWith(...nodes: (string | Node)[])
### replaceWith(...nodes: (string | Node)[])
Replace current element with other node(s).
### HTMLElement#classList
### classList
#### HTMLElement#classList.add
#### classList.add
Add class name.
#### HTMLElement#classList.replace(old: string, new: string)
#### classList.replace(old: string, new: string)
Replace class name with another one.
#### HTMLElement#classList.remove()
#### classList.remove()
Remove class name.
#### HTMLElement#classList.toggle(className: string):void
#### classList.toggle(className: string):void
Toggle class. Remove it if it is already included, otherwise add.
#### HTMLElement#classList.contains(className: string): boolean
#### classList.contains(className: string): boolean
Returns true if the classname is already in the classList.
#### HTMLElement#classList.values()
#### classList.value
Get class names.
#### Node#clone()
#### clone()
Clone a node.
#### Node#getElementById(id: string): HTMLElement;
#### getElementById(id: string): HTMLElement;

@@ -221,3 +305,3 @@ Get element by it's ID.

### HTMLElement#text
### text

@@ -227,3 +311,3 @@ Get unescaped text value of current node and its children. Like `innerText`.

### HTMLElement#rawText
### rawText

@@ -233,60 +317,56 @@ Get escaped (as-is) text value of current node and its children. May have

### HTMLElement#tagName
### tagName
Get or Set tag name of HTMLElement. Notice: the returned value would be an uppercase string.
### HTMLElement#structuredText
### structuredText
Get structured Text.
### HTMLElement#structure
### structure
Get DOM structure.
### HTMLElement#firstChild
### firstChild
Get first child node.
### HTMLElement#lastChild
### lastChild
Get last child node.
### HTMLElement#innerHTML
### innerHTML
Set or Get innerHTML.
### HTMLElement#outerHTML
### outerHTML
Get outerHTML.
### HTMLElement#nextSibling
### nextSibling
Returns a reference to the next child node of the current element's parent.
### HTMLElement#nextElementSibling
### nextElementSibling
Returns a reference to the next child element of the current element's parent.
### HTMLElement#previousSibling
### previousSibling
Returns a reference to the previous child node of the current element's parent.
### HTMLElement#previousElementSibling
### previousElementSibling
Returns a reference to the previous child element of the current element's parent.
### HTMLElement#textContent
### textContent
Get or Set textContent of current element, more efficient than [set_content](#htmlelementset_contentcontent-string--node--node).
### HTMLElement#attributes
### attributes
Get all attributes of current element. **Notice: do not try to change the returned value.**
### HTMLElement#classList
### range
Get all attributes of current element. **Notice: do not try to change the returned value.**
### HTMLElement#range
Corresponding source code start and end indexes (ie [ 0, 40 ])

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

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