From b3330c3a779c4acdc4898a7d94c083cb733be8f8 Mon Sep 17 00:00:00 2001 From: petersirka Date: Tue, 10 Sep 2024 14:51:37 +0200 Subject: [PATCH] Fixed parsing attributes with the `_` character in the `HTMLParser`. --- changelog.txt | 1 + htmlparser.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 714350a..10e382b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -24,6 +24,7 @@ - added `@{hostname([url])}` - added `controller.href()` method - extended `HTMLParser` by adding selector for prefixes, example: `node.find('xsd:')` +- fixed parsing attributes with the `_` character in the `HTMLParser` ======================== 0.0.5 diff --git a/htmlparser.js b/htmlparser.js index ea548ba..101ed4d 100644 --- a/htmlparser.js +++ b/htmlparser.js @@ -498,7 +498,7 @@ function parseHTML(html, trim, onerror, isxml) { }; var parseAttrs = function(str) { - var attrs = str.match(/[a-z-0-9A-Z\:]+(=("|').*?("|'))?/g); + var attrs = str.match(/[a-z-0-9A-Z\:_-]+(=("|').*?("|'))?/g); var obj = {}; if (attrs) { for (var m of attrs) {