node-html-parser 1.4.8 → 1.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/matcher.js +5 -2
- package/dist/main.js +5 -2
- package/dist/matcher.js +5 -2
- package/package.json +1 -1
package/dist/esm/matcher.js
CHANGED
|
@@ -166,10 +166,13 @@ export default class Matcher {
|
|
|
166
166
|
function_name += '1';
|
|
167
167
|
}
|
|
168
168
|
else {
|
|
169
|
-
|
|
169
|
+
// https://github.com/taoqf/node-html-parser/issues/86
|
|
170
|
+
// const reg = /\[\s*([\w-]+)(\s*=\s*(((?<quote>'|")\s*(.*)(\k<quote>))|(\S*)))?\s*\]/.exec(tagName);
|
|
171
|
+
// `[a-b]`,`[ a-b ]`,`[a-b=c]`, `[a-b=c'd]`,`[a-b='c\' d"e ']`,`[ a-b = 'c\' d"e ' ]`,`[a-b="c' d\"e " ]`,`[ a-b = "c' d\"e " ]`
|
|
172
|
+
const reg = /\[\s*([\w-]+)(\s*=\s*(('\s*(.*)'|"\s*(.*)")|(\S*)))?\s*\]/.exec(tagName);
|
|
170
173
|
if (reg) {
|
|
171
174
|
attr_key = reg[1];
|
|
172
|
-
value = reg[6] || reg[
|
|
175
|
+
value = reg[5] || reg[6] || reg[7];
|
|
173
176
|
// 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
|
|
174
177
|
function_name += '2';
|
|
175
178
|
}
|
package/dist/main.js
CHANGED
|
@@ -317,10 +317,13 @@ define("matcher", ["require", "exports"], function (require, exports) {
|
|
|
317
317
|
function_name += '1';
|
|
318
318
|
}
|
|
319
319
|
else {
|
|
320
|
-
|
|
320
|
+
// https://github.com/taoqf/node-html-parser/issues/86
|
|
321
|
+
// const reg = /\[\s*([\w-]+)(\s*=\s*(((?<quote>'|")\s*(.*)(\k<quote>))|(\S*)))?\s*\]/.exec(tagName);
|
|
322
|
+
// `[a-b]`,`[ a-b ]`,`[a-b=c]`, `[a-b=c'd]`,`[a-b='c\' d"e ']`,`[ a-b = 'c\' d"e ' ]`,`[a-b="c' d\"e " ]`,`[ a-b = "c' d\"e " ]`
|
|
323
|
+
var reg = /\[\s*([\w-]+)(\s*=\s*(('\s*(.*)'|"\s*(.*)")|(\S*)))?\s*\]/.exec(tagName);
|
|
321
324
|
if (reg) {
|
|
322
325
|
attr_key = reg[1];
|
|
323
|
-
value = reg[6] || reg[
|
|
326
|
+
value = reg[5] || reg[6] || reg[7];
|
|
324
327
|
// 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
|
|
325
328
|
function_name += '2';
|
|
326
329
|
}
|
package/dist/matcher.js
CHANGED
|
@@ -168,10 +168,13 @@ var Matcher = /** @class */ (function () {
|
|
|
168
168
|
function_name += '1';
|
|
169
169
|
}
|
|
170
170
|
else {
|
|
171
|
-
|
|
171
|
+
// https://github.com/taoqf/node-html-parser/issues/86
|
|
172
|
+
// const reg = /\[\s*([\w-]+)(\s*=\s*(((?<quote>'|")\s*(.*)(\k<quote>))|(\S*)))?\s*\]/.exec(tagName);
|
|
173
|
+
// `[a-b]`,`[ a-b ]`,`[a-b=c]`, `[a-b=c'd]`,`[a-b='c\' d"e ']`,`[ a-b = 'c\' d"e ' ]`,`[a-b="c' d\"e " ]`,`[ a-b = "c' d\"e " ]`
|
|
174
|
+
var reg = /\[\s*([\w-]+)(\s*=\s*(('\s*(.*)'|"\s*(.*)")|(\S*)))?\s*\]/.exec(tagName);
|
|
172
175
|
if (reg) {
|
|
173
176
|
attr_key = reg[1];
|
|
174
|
-
value = reg[6] || reg[
|
|
177
|
+
value = reg[5] || reg[6] || reg[7];
|
|
175
178
|
// 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
|
|
176
179
|
function_name += '2';
|
|
177
180
|
}
|
package/package.json
CHANGED