Skip to content

Commit af60497

Browse files
committed
check for matching attribute quote pairs in regexp - fixes #2
1 parent 0d27d0e commit af60497

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: deno.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dbushell/xml-streamify",
3-
"version": "0.3.0",
3+
"version": "0.4.0",
44
"exports": {
55
".": "./mod.ts",
66
"./node": "./src/node.ts",

Diff for: src/node.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ export class Node {
4141
// Setup and parse attributes on first access
4242
this.#attr = {};
4343
if (this.raw) {
44-
const regex = /([\w:.-]+)\s*=\s*["'](.*?)["']/g;
44+
const regex = /([\w:.-]+)\s*=\s*(["'])(.*?)\2/g;
4545
let match: RegExpExecArray | null;
4646
while ((match = regex.exec(this.raw)) !== null) {
47-
this.#attr[match[1]] = match[2];
47+
this.#attr[match[1]] = match[3];
4848
}
4949
}
5050
return this.#attr;

0 commit comments

Comments
 (0)