node-html-parser
Advanced tools
Comparing version 1.4.5 to 1.4.6
@@ -164,3 +164,2 @@ /** | ||
if (tagName && tagName !== '*') { | ||
let reg; | ||
if (tagName.startsWith('#')) { | ||
@@ -171,21 +170,9 @@ // source += 'if (el.id != ' + JSON.stringify(tagName.substr(1)) + ') return false;';// 1 | ||
else { | ||
reg = /^\[\s*(\S+)\s*(=|!=)\s*((((["'])([^\6]*)\6))|(\S*?))\]\s*/.exec(tagName); | ||
const reg = /\[\s*([\w-]+)(\s*=\s*(((?<quote>'|")\s*(.*)(\k<quote>))|(\S*)))?\s*\]/.exec(tagName); | ||
if (reg) { | ||
attr_key = reg[1]; | ||
let method = reg[2]; | ||
if (method !== '=' && method !== '!=') { | ||
// eslint-disable-next-line no-template-curly-in-string | ||
throw new Error('Selector not supported, Expect [key${op}value].op must be =,!='); | ||
} | ||
if (method === '=') { | ||
method = '=='; | ||
} | ||
value = reg[7] || reg[8]; | ||
value = reg[6] || reg[8]; | ||
// source += `let attrs = el.attributes;for (let key in attrs){const val = attrs[key]; if (key == "${attr_key}" && val == "${value}"){return true;}} return false;`;// 2 | ||
function_name += '2'; | ||
} | ||
else if ((reg = /^\[(.*?)\]/.exec(tagName))) { | ||
attr_key = reg[1]; | ||
function_name += '5'; | ||
} | ||
else { | ||
@@ -192,0 +179,0 @@ // source += 'if (el.tagName != ' + JSON.stringify(tagName) + ') return false;';// 3 |
@@ -315,3 +315,2 @@ var __extends = (this && this.__extends) || (function () { | ||
if (tagName && tagName !== '*') { | ||
var reg = void 0; | ||
if (tagName.startsWith('#')) { | ||
@@ -322,21 +321,9 @@ // source += 'if (el.id != ' + JSON.stringify(tagName.substr(1)) + ') return false;';// 1 | ||
else { | ||
reg = /^\[\s*(\S+)\s*(=|!=)\s*((((["'])([^\6]*)\6))|(\S*?))\]\s*/.exec(tagName); | ||
var reg = /\[\s*([\w-]+)(\s*=\s*(((?<quote>'|")\s*(.*)(\k<quote>))|(\S*)))?\s*\]/.exec(tagName); | ||
if (reg) { | ||
attr_key = reg[1]; | ||
var method = reg[2]; | ||
if (method !== '=' && method !== '!=') { | ||
// eslint-disable-next-line no-template-curly-in-string | ||
throw new Error('Selector not supported, Expect [key${op}value].op must be =,!='); | ||
} | ||
if (method === '=') { | ||
method = '=='; | ||
} | ||
value = reg[7] || reg[8]; | ||
value = reg[6] || reg[8]; | ||
// source += `let attrs = el.attributes;for (let key in attrs){const val = attrs[key]; if (key == "${attr_key}" && val == "${value}"){return true;}} return false;`;// 2 | ||
function_name += '2'; | ||
} | ||
else if ((reg = /^\[(.*?)\]/.exec(tagName))) { | ||
attr_key = reg[1]; | ||
function_name += '5'; | ||
} | ||
else { | ||
@@ -343,0 +330,0 @@ // source += 'if (el.tagName != ' + JSON.stringify(tagName) + ') return false;';// 3 |
@@ -166,3 +166,2 @@ "use strict"; | ||
if (tagName && tagName !== '*') { | ||
var reg = void 0; | ||
if (tagName.startsWith('#')) { | ||
@@ -173,21 +172,9 @@ // source += 'if (el.id != ' + JSON.stringify(tagName.substr(1)) + ') return false;';// 1 | ||
else { | ||
reg = /^\[\s*(\S+)\s*(=|!=)\s*((((["'])([^\6]*)\6))|(\S*?))\]\s*/.exec(tagName); | ||
var reg = /\[\s*([\w-]+)(\s*=\s*(((?<quote>'|")\s*(.*)(\k<quote>))|(\S*)))?\s*\]/.exec(tagName); | ||
if (reg) { | ||
attr_key = reg[1]; | ||
var method = reg[2]; | ||
if (method !== '=' && method !== '!=') { | ||
// eslint-disable-next-line no-template-curly-in-string | ||
throw new Error('Selector not supported, Expect [key${op}value].op must be =,!='); | ||
} | ||
if (method === '=') { | ||
method = '=='; | ||
} | ||
value = reg[7] || reg[8]; | ||
value = reg[6] || reg[8]; | ||
// source += `let attrs = el.attributes;for (let key in attrs){const val = attrs[key]; if (key == "${attr_key}" && val == "${value}"){return true;}} return false;`;// 2 | ||
function_name += '2'; | ||
} | ||
else if ((reg = /^\[(.*?)\]/.exec(tagName))) { | ||
attr_key = reg[1]; | ||
function_name += '5'; | ||
} | ||
else { | ||
@@ -194,0 +181,0 @@ // source += 'if (el.tagName != ' + JSON.stringify(tagName) + ') return false;';// 3 |
{ | ||
"name": "node-html-parser", | ||
"version": "1.4.5", | ||
"version": "1.4.6", | ||
"description": "A very fast HTML parser, generating a simplified DOM, with basic element query support.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
154167
4194