Socket
Socket
Sign inDemoInstall

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 3.3.0 to 3.3.1

15

dist/esm/nodes/html.js

@@ -128,2 +128,13 @@ import he from 'he';

/**
* Quote attribute values
* @param attr attribute value
* @returns {string} quoted value
*/
quoteAttribute(attr) {
if (attr === null) {
return "null";
}
return JSON.stringify(attr.replace(/"/g, '"'));
}
/**
* Remove current element

@@ -661,3 +672,3 @@ */

this.rawAttrs = Object.keys(attrs).map((name) => {
const val = JSON.stringify(attrs[name]);
const val = this.quoteAttribute(attrs[name]);
if (val === 'null' || val === '""') {

@@ -692,3 +703,3 @@ return name;

}
return `${name}=${JSON.stringify(String(val))}`;
return `${name}=${this.quoteAttribute(String(val))}`;
}).join(' ');

@@ -695,0 +706,0 @@ }

@@ -353,2 +353,13 @@ var __extends = (this && this.__extends) || (function () {

/**
* Quote attribute values
* @param attr attribute value
* @returns {string} quoted value
*/
HTMLElement.prototype.quoteAttribute = function (attr) {
if (attr === null) {
return "null";
}
return JSON.stringify(attr.replace(/"/g, '"'));
};
/**
* Remove current element

@@ -925,2 +936,3 @@ */

HTMLElement.prototype.setAttribute = function (key, value) {
var _this = this;
if (arguments.length < 2) {

@@ -944,3 +956,3 @@ throw new Error('Failed to execute \'setAttribute\' on \'Element\'');

this.rawAttrs = Object.keys(attrs).map(function (name) {
var val = JSON.stringify(attrs[name]);
var val = _this.quoteAttribute(attrs[name]);
if (val === 'null' || val === '""') {

@@ -961,2 +973,3 @@ return name;

HTMLElement.prototype.setAttributes = function (attributes) {
var _this = this;
// Invalidate current this.attributes

@@ -976,3 +989,3 @@ if (this._attrs) {

}
return name + "=" + JSON.stringify(String(val));
return name + "=" + _this.quoteAttribute(String(val));
}).join(' ');

@@ -979,0 +992,0 @@ };

@@ -50,2 +50,8 @@ import Node from './node';

/**
* Quote attribute values
* @param attr attribute value
* @returns {string} quoted value
*/
private quoteAttribute;
/**
* Creates an instance of HTMLElement.

@@ -52,0 +58,0 @@ * @param keyAttrs id and class attribute

@@ -179,2 +179,13 @@ "use strict";

/**
* Quote attribute values
* @param attr attribute value
* @returns {string} quoted value
*/
HTMLElement.prototype.quoteAttribute = function (attr) {
if (attr === null) {
return "null";
}
return JSON.stringify(attr.replace(/"/g, '&quot;'));
};
/**
* Remove current element

@@ -751,2 +762,3 @@ */

HTMLElement.prototype.setAttribute = function (key, value) {
var _this = this;
if (arguments.length < 2) {

@@ -770,3 +782,3 @@ throw new Error('Failed to execute \'setAttribute\' on \'Element\'');

this.rawAttrs = Object.keys(attrs).map(function (name) {
var val = JSON.stringify(attrs[name]);
var val = _this.quoteAttribute(attrs[name]);
if (val === 'null' || val === '""') {

@@ -787,2 +799,3 @@ return name;

HTMLElement.prototype.setAttributes = function (attributes) {
var _this = this;
// Invalidate current this.attributes

@@ -802,3 +815,3 @@ if (this._attrs) {

}
return name + "=" + JSON.stringify(String(val));
return name + "=" + _this.quoteAttribute(String(val));
}).join(' ');

@@ -805,0 +818,0 @@ };

2

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

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

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