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 4.2.2 to 4.3.0

51

lib/node.d.ts

@@ -19,11 +19,40 @@ import { ElementType } from "domelementtype";

/**
* `parse5` source code location info.
*
* Available if parsing with parse5 and location info is enabled.
*/
sourceCodeLocation?: {
startOffset: number;
endOffset: number;
startLine: number;
endLine: number;
startColumn: number;
endColumn: number;
};
/**
*
* @param type The type of the node.
*/
constructor(type: ElementType);
/**
* [DOM spec](https://dom.spec.whatwg.org/#dom-node-nodetype)-compatible
* node {@link type}.
*/
get nodeType(): number;
/**
* Same as {@link parent}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get parentNode(): NodeWithChildren | null;
set parentNode(parent: NodeWithChildren | null);
/**
* Same as {@link prev}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get previousSibling(): Node | null;
set previousSibling(prev: Node | null);
/**
* Same as {@link next}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get nextSibling(): Node | null;

@@ -49,2 +78,6 @@ set nextSibling(next: Node | null);

constructor(type: ElementType.Comment | ElementType.Text | ElementType.Directive, data: string);
/**
* Same as {@link data}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get nodeValue(): string;

@@ -71,4 +104,7 @@ set nodeValue(data: string);

constructor(name: string, data: string);
/** If this is a doctype, the document type name (parse5 only). */
"x-name"?: string;
/** If this is a doctype, the document type public identifier (parse5 only). */
"x-publicId"?: string;
/** If this is a doctype, the document type system identifier (parse5 only). */
"x-systemId"?: string;

@@ -86,4 +122,10 @@ }

constructor(type: ElementType.Root | ElementType.CDATA | ElementType.Script | ElementType.Style | ElementType.Tag, children: Node[]);
/** First child of the node. */
get firstChild(): Node | null;
/** Last child of the node. */
get lastChild(): Node | null;
/**
* Same as {@link children}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get childNodes(): Node[];

@@ -97,2 +139,3 @@ set childNodes(children: Node[]);

constructor(children: Node[]);
/** [Document mode](https://dom.spec.whatwg.org/#concept-document-limited-quirks) (parse5 only). */
"x-mode"?: "no-quirks" | "quirks" | "limited-quirks";

@@ -125,6 +168,14 @@ }

}, children?: Node[], type?: ElementType.Tag | ElementType.Script | ElementType.Style);
/**
* Same as {@link name}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get tagName(): string;
set tagName(name: string);
get attributes(): Attribute[];
/** Element namespace (parse5 only). */
namespace?: string;
/** Element attribute namespaces (parse5 only). */
"x-attribsNamespace"?: Record<string, string>;
/** Element attribute namespace-related prefixes (parse5 only). */
"x-attribsPrefix"?: Record<string, string>;

@@ -131,0 +182,0 @@ }

38

lib/node.js

@@ -65,2 +65,6 @@ "use strict";

// Read-only aliases
/**
* [DOM spec](https://dom.spec.whatwg.org/#dom-node-nodetype)-compatible
* node {@link type}.
*/
get: function () {

@@ -75,2 +79,6 @@ var _a;

// Read-write aliases for properties
/**
* Same as {@link parent}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function () {

@@ -86,2 +94,6 @@ return this.parent;

Object.defineProperty(Node.prototype, "previousSibling", {
/**
* Same as {@link prev}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function () {

@@ -97,2 +109,6 @@ return this.prev;

Object.defineProperty(Node.prototype, "nextSibling", {
/**
* Same as {@link next}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function () {

@@ -135,2 +151,6 @@ return this.next;

Object.defineProperty(DataNode.prototype, "nodeValue", {
/**
* Same as {@link data}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function () {

@@ -199,2 +219,3 @@ return this.data;

// Aliases
/** First child of the node. */
get: function () {

@@ -208,2 +229,3 @@ var _a;

Object.defineProperty(NodeWithChildren.prototype, "lastChild", {
/** Last child of the node. */
get: function () {

@@ -218,2 +240,6 @@ return this.children.length > 0

Object.defineProperty(NodeWithChildren.prototype, "childNodes", {
/**
* Same as {@link children}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function () {

@@ -266,2 +292,6 @@ return this.children;

// DOM Level 1 aliases
/**
* Same as {@link name}.
* [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
*/
get: function () {

@@ -370,2 +400,5 @@ return this.name;

children.forEach(function (child) { return (child.parent = clone_1); });
if (node.namespace != null) {
clone_1.namespace = node.namespace;
}
if (node["x-attribsNamespace"]) {

@@ -404,6 +437,9 @@ clone_1["x-attribsNamespace"] = __assign({}, node["x-attribsNamespace"]);

else {
throw new Error("Not implemented yet: " + node.type);
throw new Error("Not implemented yet: ".concat(node.type));
}
result.startIndex = node.startIndex;
result.endIndex = node.endIndex;
if (node.sourceCodeLocation != null) {
result.sourceCodeLocation = node.sourceCodeLocation;
}
return result;

@@ -410,0 +446,0 @@ }

22

package.json
{
"name": "domhandler",
"version": "4.2.2",
"version": "4.3.0",
"description": "Handler for htmlparser2 that turns pages into a dom",

@@ -39,13 +39,13 @@ "author": "Felix Boehm <me@feedic.com>",

"devDependencies": {
"@types/jest": "^27.0.1",
"@types/node": "^16.7.2",
"@typescript-eslint/eslint-plugin": "^4.29.3",
"@typescript-eslint/parser": "^4.29.3",
"eslint": "^7.32.0",
"@types/jest": "^27.0.3",
"@types/node": "^16.11.11",
"@typescript-eslint/eslint-plugin": "^5.5.0",
"@typescript-eslint/parser": "^5.5.0",
"eslint": "^8.3.0",
"eslint-config-prettier": "^8.1.0",
"htmlparser2": "^7.1.1",
"jest": "^27.1.0",
"prettier": "^2.0.5",
"ts-jest": "^27.0.5",
"typescript": "^4.4.2"
"htmlparser2": "^7.2.0",
"jest": "^27.4.2",
"prettier": "^2.5.0",
"ts-jest": "^27.0.7",
"typescript": "^4.5.2"
},

@@ -52,0 +52,0 @@ "jest": {

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