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

@types/parse5

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/parse5 - npm Package Compare versions

Comparing version 5.0.2 to 5.0.3

318

parse5/index.d.ts
// Type definitions for parse5 5.0
// Project: https://github.com/inikulin/parse5
// Definitions by: Ivan Nikulin <https://github.com/inikulin>
// ExE Boss <https://github.com/ExE-Boss>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export interface Location {
/**
* One-based line index of the first character
* One-based column index of the last character
*/
startLine: number;
endCol: number;
/**
* One-based column index of the first character
* Zero-based last character index
*/
startCol: number;
endOffset: number;
/**

@@ -20,6 +22,8 @@ * One-based line index of the last character

endLine: number;
/**
* One-based column index of the last character
* One-based column index of the first character
*/
endCol: number;
startCol: number;
/**

@@ -29,6 +33,7 @@ * Zero-based first character index

startOffset: number;
/**
* Zero-based last character index
* One-based line index of the first character
*/
endOffset: number;
startLine: number;
}

@@ -52,2 +57,3 @@

startTag: StartTagLocation;
/**

@@ -67,2 +73,3 @@ * Element's end tag location info.

scriptingEnabled?: boolean;
/**

@@ -79,2 +86,3 @@ * Enables source code location information. When enabled, each node (except the root node)

sourceCodeLocationInfo?: boolean;
/**

@@ -112,2 +120,3 @@ * Specifies the resulting tree format.

name: string;
/**

@@ -117,2 +126,3 @@ * The value of the attribute.

value: string;
/**

@@ -122,2 +132,3 @@ * The namespace of the attribute.

namespace?: string;
/**

@@ -167,2 +178,3 @@ * The namespace-related prefix of the attribute.

nodeName: "#documentType";
/**

@@ -172,2 +184,3 @@ * Document type name.

name: string;
/**

@@ -177,2 +190,3 @@ * Document type public identifier.

publicId: string;
/**

@@ -192,2 +206,3 @@ * Document type system identifier.

nodeName: "#document";
/**

@@ -217,2 +232,3 @@ * [Document mode](https://dom.spec.whatwg.org/#concept-document-limited-quirks).

nodeName: string;
/**

@@ -222,2 +238,3 @@ * Element tag name.

tagName: string;
/**

@@ -227,2 +244,3 @@ * Element namespace.

namespaceURI: string;
/**

@@ -232,2 +250,3 @@ * List of element attributes.

attrs: Attribute[];
/**

@@ -247,2 +266,3 @@ * Element source code location info. Available if location info is enabled via {@link ParserOptions}.

nodeName: "#comment";
/**

@@ -252,2 +272,3 @@ * Comment text.

data: string;
/**

@@ -267,2 +288,3 @@ * Comment source code location info. Available if location info is enabled via {@link ParserOptions}.

nodeName: "#text";
/**

@@ -272,2 +294,3 @@ * Text content.

value: string;
/**

@@ -279,3 +302,3 @@ * Text node source code location info. Available if location info is enabled via {@link ParserOptions}.

// Generic node intefaces
// Generic node interfaces
/**

@@ -286,2 +309,3 @@ * Generic Node interface.

export type Node = DefaultTreeNode | object;
/**

@@ -292,2 +316,3 @@ * Generic ChildNode interface.

export type ChildNode = DefaultTreeChildNode | object;
/**

@@ -298,2 +323,3 @@ * Generic ParentNode interface.

export type ParentNode = DefaultTreeParentNode | object;
/**

@@ -304,2 +330,3 @@ * Generic DocumentType interface.

export type DocumentType = DefaultTreeDocumentType | object;
/**

@@ -310,2 +337,3 @@ * Generic Document interface.

export type Document = DefaultTreeDocument | object;
/**

@@ -316,2 +344,3 @@ * Generic DocumentFragment interface.

export type DocumentFragment = DefaultTreeDocumentFragment | object;
/**

@@ -322,2 +351,3 @@ * Generic Element interface.

export type Element = DefaultTreeElement | object;
/**

@@ -328,2 +358,3 @@ * Generic TextNode interface.

export type TextNode = DefaultTreeTextNode | object;
/**

@@ -340,9 +371,33 @@ * Generic CommentNode interface.

*
* @see [default implementation](https://github.com/inikulin/parse5/blob/master/lib/tree_adapters/default.js)
* @see [default implementation](https://github.com/inikulin/parse5/blob/master/packages/parse5/lib/tree-adapters/default.js)
*/
export interface TreeAdapter {
/**
* Copies attributes to the given element. Only attributes that are not yet present in the element are copied.
*
* @param recipient - Element to copy attributes into.
* @param attrs - Attributes to copy.
*/
adoptAttributes(recipient: Element, attrs: Attribute[]): void;
/**
* Appends a child node to the given parent node.
*
* @param parentNode - Parent node.
* @param newNode - Child node.
*/
appendChild(parentNode: ParentNode, newNode: Node): void;
/**
* Creates a comment node.
*
* @param data - Comment text.
*/
createCommentNode(data: string): CommentNode;
/**
* Creates a document node.
*/
createDocument(): Document;
/**

@@ -352,2 +407,3 @@ * Creates a document fragment node.

createDocumentFragment(): DocumentFragment;
/**

@@ -365,67 +421,33 @@ * Creates an element node.

): Element;
/**
* Creates a comment node.
* Removes a node from its parent.
*
* @param data - Comment text.
* @param node - Node to remove.
*/
createCommentNode(data: string): CommentNode;
detachNode(node: Node): void;
/**
* Appends a child node to the given parent node.
* Returns the given element's attributes in an array, in the form of name-value pairs.
* Foreign attributes may contain `namespace` and `prefix` fields as well.
*
* @param parentNode - Parent node.
* @param newNode - Child node.
* @param element - Element.
*/
appendChild(parentNode: ParentNode, newNode: Node): void;
getAttrList(element: Element): Attribute[];
/**
* Inserts a child node to the given parent node before the given reference node.
* Returns the given node's children in an array.
*
* @param parentNode - Parent node.
* @param newNode - Child node.
* @param referenceNode - Reference node.
* @param node - Node.
*/
insertBefore(
parentNode: ParentNode,
newNode: Node,
referenceNode: Node
): void;
getChildNodes(node: ParentNode): Node[];
/**
* Sets the `<template>` element content element.
* Returns the given comment node's content.
*
* @param templateElement - `<template>` element.
* @param contentElement - Content element.
* @param commentNode - Comment node.
*/
setTemplateContent(
templateElement: Element,
contentElement: DocumentFragment
): void;
getCommentNodeContent(commentNode: CommentNode): string;
/**
* Returns the `<template>` element content element.
*
* @param templateElement - `<template>` element.
*/
getTemplateContent(templateElement: Element): DocumentFragment;
/**
* Sets the document type. If the `document` already contains a document type node, the `name`, `publicId` and `systemId`
* properties of this node will be updated with the provided values. Otherwise, creates a new document type node
* with the given properties and inserts it into the `document`.
*
* @param document - Document node.
* @param name - Document type name.
* @param publicId - Document type public identifier.
* @param systemId - Document type system identifier.
*/
setDocumentType(
document: Document,
name: string,
publicId: string,
systemId: string
): void;
/**
* Sets the [document mode](https://dom.spec.whatwg.org/#concept-document-limited-quirks).
*
* @param document - Document node.
* @param mode - Document mode.
*/
setDocumentMode(document: Document, mode: DocumentMode): void;
/**
* Returns [document mode](https://dom.spec.whatwg.org/#concept-document-limited-quirks).

@@ -436,38 +458,25 @@ *

getDocumentMode(document: Document): DocumentMode;
/**
* Removes a node from its parent.
* Returns the given document type node's name.
*
* @param node - Node to remove.
* @param doctypeNode - Document type node.
*/
detachNode(node: Node): void;
getDocumentTypeNodeName(doctypeNode: DocumentType): string;
/**
* Inserts text into a node. If the last child of the node is a text node, the provided text will be appended to the
* text node content. Otherwise, inserts a new text node with the given text.
* Returns the given document type node's public identifier.
*
* @param parentNode - Node to insert text into.
* @param text - Text to insert.
* @param doctypeNode - Document type node.
*/
insertText(parentNode: ParentNode, text: string): void;
getDocumentTypeNodePublicId(doctypeNode: DocumentType): string;
/**
* Inserts text into a sibling node that goes before the reference node. If this sibling node is the text node,
* the provided text will be appended to the text node content. Otherwise, inserts a new sibling text node with
* the given text before the reference node.
* Returns the given document type node's system identifier.
*
* @param parentNode - Node to insert text into.
* @param text - Text to insert.
* @param referenceNode - Node to insert text before.
* @param doctypeNode - Document type node.
*/
insertTextBefore(
parentNode: ParentNode,
text: string,
referenceNode: Node
): void;
getDocumentTypeNodeSystemId(doctypeNode: DocumentType): string;
/**
* Copies attributes to the given element. Only attributes that are not yet present in the element are copied.
*
* @param recipient - Element to copy attributes into.
* @param attrs - Attributes to copy.
*/
adoptAttributes(recipient: Element, attrs: Attribute[]): void;
/**
* Returns the first child of the given node.

@@ -478,8 +487,17 @@ *

getFirstChild(node: ParentNode): Node;
/**
* Returns the given node's children in an array.
* Returns the given element's namespace.
*
* @param element - Element.
*/
getNamespaceURI(element: Element): string;
/**
* Returns the given node's source code location information.
*
* @param node - Node.
*/
getChildNodes(node: ParentNode): Node[];
getNodeSourceCodeLocation(node: Node): Location | StartTagLocation | ElementLocation;
/**

@@ -491,10 +509,4 @@ * Returns the given node's parent.

getParentNode(node: ChildNode): ParentNode;
/**
* Returns the given element's attributes in an array, in the form of name-value pairs.
* Foreign attributes may contain `namespace` and `prefix` fields as well.
*
* @param element - Element.
*/
getAttrList(element: Element): Attribute[];
/**
* Returns the given element's tag name.

@@ -505,9 +517,4 @@ *

getTagName(element: Element): string;
/**
* Returns the given element's namespace.
*
* @param element - Element.
*/
getNamespaceURI(element: Element): string;
/**
* Returns the given text node's content.

@@ -518,33 +525,48 @@ *

getTextNodeContent(textNode: TextNode): string;
/**
* Returns the given comment node's content.
* Returns the `<template>` element content element.
*
* @param commentNode - Comment node.
* @param templateElement - `<template>` element.
*/
getCommentNodeContent(commentNode: CommentNode): string;
getTemplateContent(templateElement: Element): DocumentFragment;
/**
* Returns the given document type node's name.
* Inserts a child node to the given parent node before the given reference node.
*
* @param doctypeNode - Document type node.
* @param parentNode - Parent node.
* @param newNode - Child node.
* @param referenceNode - Reference node.
*/
getDocumentTypeNodeName(doctypeNode: DocumentType): string;
insertBefore(
parentNode: ParentNode,
newNode: Node,
referenceNode: Node
): void;
/**
* Returns the given document type node's public identifier.
* Inserts text into a node. If the last child of the node is a text node, the provided text will be appended to the
* text node content. Otherwise, inserts a new text node with the given text.
*
* @param doctypeNode - Document type node.
* @param parentNode - Node to insert text into.
* @param text - Text to insert.
*/
getDocumentTypeNodePublicId(doctypeNode: DocumentType): string;
insertText(parentNode: ParentNode, text: string): void;
/**
* Returns the given document type node's system identifier.
* Inserts text into a sibling node that goes before the reference node. If this sibling node is the text node,
* the provided text will be appended to the text node content. Otherwise, inserts a new sibling text node with
* the given text before the reference node.
*
* @param doctypeNode - Document type node.
* @param parentNode - Node to insert text into.
* @param text - Text to insert.
* @param referenceNode - Node to insert text before.
*/
getDocumentTypeNodeSystemId(doctypeNode: DocumentType): string;
insertTextBefore(
parentNode: ParentNode,
text: string,
referenceNode: Node
): void;
/**
* Determines if the given node is a text node.
*
* @param node - Node.
*/
isTextNode(node: Node): boolean;
/**
* Determines if the given node is a comment node.

@@ -555,2 +577,3 @@ *

isCommentNode(node: Node): boolean;
/**

@@ -562,2 +585,3 @@ * Determines if the given node is a document type node.

isDocumentTypeNode(node: Node): boolean;
/**

@@ -569,2 +593,52 @@ * Determines if the given node is an element.

isElementNode(node: Node): boolean;
/**
* Determines if the given node is a text node.
*
* @param node - Node.
*/
isTextNode(node: Node): boolean;
/**
* Sets the [document mode](https://dom.spec.whatwg.org/#concept-document-limited-quirks).
*
* @param document - Document node.
* @param mode - Document mode.
*/
setDocumentMode(document: Document, mode: DocumentMode): void;
/**
* Sets the document type. If the `document` already contains a document type node, the `name`, `publicId` and `systemId`
* properties of this node will be updated with the provided values. Otherwise, creates a new document type node
* with the given properties and inserts it into the `document`.
*
* @param document - Document node.
* @param name - Document type name.
* @param publicId - Document type public identifier.
* @param systemId - Document type system identifier.
*/
setDocumentType(
document: Document,
name: string,
publicId: string,
systemId: string
): void;
/**
* Attaches source code location information to the node.
*
* @param node - Node.
*/
setNodeSourceCodeLocation(node: Node, location: Location | StartTagLocation | ElementLocation): void;
/**
* Sets the `<template>` element content element.
*
* @param templateElement - `<template>` element.
* @param contentElement - Content element.
*/
setTemplateContent(
templateElement: Element,
contentElement: DocumentFragment
): void;
}

@@ -571,0 +645,0 @@

{
"name": "@types/parse5",
"version": "5.0.2",
"version": "5.0.3",
"description": "TypeScript definitions for parse5",

@@ -11,6 +11,11 @@ "license": "MIT",

"githubUsername": "inikulin"
},
{
"name": "ExE Boss",
"url": "https://github.com/ExE-Boss",
"githubUsername": "ExE-Boss"
}
],
"main": "",
"types": "index",
"types": "index.d.ts",
"repository": {

@@ -23,4 +28,4 @@ "type": "git",

"dependencies": {},
"typesPublisherContentHash": "5358e2aced4b49510e3755f0b3c9d8217678083c8385647ed35282f5c58da8c1",
"typeScriptVersion": "2.2"
"typesPublisherContentHash": "c008c5f4d7bb5f52d9fff6caef66399c1389fc27c66811a26a35981e3f4455cf",
"typeScriptVersion": "2.9"
}

@@ -8,6 +8,6 @@ # Installation

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/parse5
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/parse5.
Additional Details
* Last updated: Fri, 19 Jul 2019 16:25:04 GMT
### Additional Details
* Last updated: Wed, 13 May 2020 21:41:59 GMT
* Dependencies: none

@@ -17,2 +17,2 @@ * Global values: none

# Credits
These definitions were written by Ivan Nikulin <https://github.com/inikulin>.
These definitions were written by [Ivan Nikulin](https://github.com/inikulin), and [ExE Boss](https://github.com/ExE-Boss).

Sorry, the diff of this file is not supported yet

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