You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

parse5

Package Overview
Dependencies
Maintainers
5
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse5 - npm Package Compare versions

Comparing version

to
7.3.0

8

dist/cjs/parser/formatting-element-list.js

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

const entryIndex = this.entries.indexOf(entry);
if (entryIndex >= 0) {
if (entryIndex !== -1) {
this.entries.splice(entryIndex, 1);

@@ -99,7 +99,7 @@ }

const markerIdx = this.entries.indexOf(MARKER);
if (markerIdx >= 0) {
this.entries.splice(0, markerIdx + 1);
if (markerIdx === -1) {
this.entries.length = 0;
}
else {
this.entries.length = 0;
this.entries.splice(0, markerIdx + 1);
}

@@ -106,0 +106,0 @@ }

@@ -125,3 +125,3 @@ import { Tokenizer, TokenizerMode, type TokenHandler } from '../tokenizer/index.js';

onItemPop(node: T['parentNode'], isTop: boolean): void;
protected _setContextModes(current: T['parentNode'], tid: number): void;
protected _setContextModes(current: T['parentNode'] | undefined, tid: number | undefined): void;
/** @protected */

@@ -128,0 +128,0 @@ _switchToTextParsing(currentToken: TagToken, nextTokenizerState: (typeof TokenizerMode)[keyof typeof TokenizerMode]): void;

@@ -12,6 +12,6 @@ import { TAG_ID as $ } from '../common/html.js';

tagIDs: $[];
current: T['parentNode'];
current: T['parentNode'] | undefined;
stackTop: number;
tmplCount: number;
currentTagId: $;
currentTagId: number | undefined;
get currentTmplContentOrNode(): T['parentNode'];

@@ -18,0 +18,0 @@ constructor(document: T['document'], treeAdapter: TreeAdapter<T>, handler: StackHandler<T>);

@@ -100,3 +100,5 @@ "use strict";

}
this.handler.onItemPush(this.current, this.currentTagId, insertionIdx === this.stackTop);
if (this.current && this.currentTagId !== undefined) {
this.handler.onItemPush(this.current, this.currentTagId, insertionIdx === this.stackTop);
}
}

@@ -108,3 +110,3 @@ popUntilTagNamePopped(tagName) {

} while (targetIdx > 0 && this.treeAdapter.getNamespaceURI(this.items[targetIdx]) !== html_js_1.NS.HTML);
this.shortenToLength(targetIdx < 0 ? 0 : targetIdx);
this.shortenToLength(Math.max(targetIdx, 0));
}

@@ -124,7 +126,7 @@ shortenToLength(idx) {

const idx = this._indexOf(element);
this.shortenToLength(idx < 0 ? 0 : idx);
this.shortenToLength(Math.max(idx, 0));
}
popUntilPopped(tagNames, targetNS) {
const idx = this._indexOfTagNames(tagNames, targetNS);
this.shortenToLength(idx < 0 ? 0 : idx);
this.shortenToLength(Math.max(idx, 0));
}

@@ -312,3 +314,3 @@ popUntilNumberedHeaderPopped() {

generateImpliedEndTags() {
while (IMPLICIT_END_TAG_REQUIRED.has(this.currentTagId)) {
while (this.currentTagId !== undefined && IMPLICIT_END_TAG_REQUIRED.has(this.currentTagId)) {
this.pop();

@@ -318,3 +320,3 @@ }

generateImpliedEndTagsThoroughly() {
while (IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {
while (this.currentTagId !== undefined && IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {
this.pop();

@@ -324,3 +326,5 @@ }

generateImpliedEndTagsWithExclusion(exclusionId) {
while (this.currentTagId !== exclusionId && IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {
while (this.currentTagId !== undefined &&
this.currentTagId !== exclusionId &&
IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {
this.pop();

@@ -327,0 +331,0 @@ }

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

const html_js_1 = require("../common/html.js");
const escape_js_1 = require("entities/lib/escape.js");
const escape_1 = require("entities/escape");
const default_js_1 = require("../tree-adapters/default.js");

@@ -153,3 +153,3 @@ // Sets

}
html += `="${(0, escape_js_1.escapeAttribute)(attr.value)}"`;
html += `="${(0, escape_1.escapeAttribute)(attr.value)}"`;
}

@@ -167,3 +167,3 @@ return html;

? content
: (0, escape_js_1.escapeText)(content);
: (0, escape_1.escapeText)(content);
}

@@ -170,0 +170,0 @@ function serializeCommentNode(node, { treeAdapter }) {

import { Preprocessor } from './preprocessor.js';
import { type Token, type CharacterToken, type DoctypeToken, type TagToken, type EOFToken, type CommentToken, type Attribute, type Location } from '../common/token.js';
import { EntityDecoder } from 'entities/lib/decode.js';
import { EntityDecoder } from 'entities/decode';
import { ERR, type ParserErrorHandler } from '../common/error-codes.js';

@@ -5,0 +5,0 @@ declare const enum State {

@@ -84,3 +84,3 @@ //Const

const entryIndex = this.entries.indexOf(entry);
if (entryIndex >= 0) {
if (entryIndex !== -1) {
this.entries.splice(entryIndex, 1);

@@ -96,7 +96,7 @@ }

const markerIdx = this.entries.indexOf(MARKER);
if (markerIdx >= 0) {
this.entries.splice(0, markerIdx + 1);
if (markerIdx === -1) {
this.entries.length = 0;
}
else {
this.entries.length = 0;
this.entries.splice(0, markerIdx + 1);
}

@@ -103,0 +103,0 @@ }

@@ -125,3 +125,3 @@ import { Tokenizer, TokenizerMode, type TokenHandler } from '../tokenizer/index.js';

onItemPop(node: T['parentNode'], isTop: boolean): void;
protected _setContextModes(current: T['parentNode'], tid: number): void;
protected _setContextModes(current: T['parentNode'] | undefined, tid: number | undefined): void;
/** @protected */

@@ -128,0 +128,0 @@ _switchToTextParsing(currentToken: TagToken, nextTokenizerState: (typeof TokenizerMode)[keyof typeof TokenizerMode]): void;

@@ -12,6 +12,6 @@ import { TAG_ID as $ } from '../common/html.js';

tagIDs: $[];
current: T['parentNode'];
current: T['parentNode'] | undefined;
stackTop: number;
tmplCount: number;
currentTagId: $;
currentTagId: number | undefined;
get currentTmplContentOrNode(): T['parentNode'];

@@ -18,0 +18,0 @@ constructor(document: T['document'], treeAdapter: TreeAdapter<T>, handler: StackHandler<T>);

@@ -97,3 +97,5 @@ import { TAG_ID as $, NS, NUMBERED_HEADERS } from '../common/html.js';

}
this.handler.onItemPush(this.current, this.currentTagId, insertionIdx === this.stackTop);
if (this.current && this.currentTagId !== undefined) {
this.handler.onItemPush(this.current, this.currentTagId, insertionIdx === this.stackTop);
}
}

@@ -105,3 +107,3 @@ popUntilTagNamePopped(tagName) {

} while (targetIdx > 0 && this.treeAdapter.getNamespaceURI(this.items[targetIdx]) !== NS.HTML);
this.shortenToLength(targetIdx < 0 ? 0 : targetIdx);
this.shortenToLength(Math.max(targetIdx, 0));
}

@@ -121,7 +123,7 @@ shortenToLength(idx) {

const idx = this._indexOf(element);
this.shortenToLength(idx < 0 ? 0 : idx);
this.shortenToLength(Math.max(idx, 0));
}
popUntilPopped(tagNames, targetNS) {
const idx = this._indexOfTagNames(tagNames, targetNS);
this.shortenToLength(idx < 0 ? 0 : idx);
this.shortenToLength(Math.max(idx, 0));
}

@@ -309,3 +311,3 @@ popUntilNumberedHeaderPopped() {

generateImpliedEndTags() {
while (IMPLICIT_END_TAG_REQUIRED.has(this.currentTagId)) {
while (this.currentTagId !== undefined && IMPLICIT_END_TAG_REQUIRED.has(this.currentTagId)) {
this.pop();

@@ -315,3 +317,3 @@ }

generateImpliedEndTagsThoroughly() {
while (IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {
while (this.currentTagId !== undefined && IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {
this.pop();

@@ -321,3 +323,5 @@ }

generateImpliedEndTagsWithExclusion(exclusionId) {
while (this.currentTagId !== exclusionId && IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {
while (this.currentTagId !== undefined &&
this.currentTagId !== exclusionId &&
IMPLICIT_END_TAG_REQUIRED_THOROUGHLY.has(this.currentTagId)) {
this.pop();

@@ -324,0 +328,0 @@ }

import { TAG_NAMES as $, NS, hasUnescapedText } from '../common/html.js';
import { escapeText, escapeAttribute } from 'entities/lib/escape.js';
import { escapeText, escapeAttribute } from 'entities/escape';
import { defaultTreeAdapter } from '../tree-adapters/default.js';

@@ -4,0 +4,0 @@ // Sets

import { Preprocessor } from './preprocessor.js';
import { type Token, type CharacterToken, type DoctypeToken, type TagToken, type EOFToken, type CommentToken, type Attribute, type Location } from '../common/token.js';
import { EntityDecoder } from 'entities/lib/decode.js';
import { EntityDecoder } from 'entities/decode';
import { ERR, type ParserErrorHandler } from '../common/error-codes.js';

@@ -5,0 +5,0 @@ declare const enum State {

@@ -5,3 +5,3 @@ {

"description": "HTML parser and serializer.",
"version": "7.2.1",
"version": "7.3.0",
"author": "Ivan Nikulin <ifaaan@gmail.com> (https://github.com/inikulin)",

@@ -12,3 +12,3 @@ "contributors": "https://github.com/inikulin/parse5/graphs/contributors",

"dependencies": {
"entities": "^4.5.0"
"entities": "^6.0.0"
},

@@ -41,3 +41,3 @@ "keywords": [

"scripts": {
"build:cjs": "tsc --moduleResolution node10 --module CommonJS --target ES6 --outDir dist/cjs && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json"
"build:cjs": "tsc --noCheck --moduleResolution node10 --module CommonJS --target ES6 --outDir dist/cjs && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json"
},

@@ -44,0 +44,0 @@ "repository": {

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

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

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

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