mirror of
https://github.com/danbulant/node-html-parser
synced 2026-06-18 14:11:15 +00:00
fixed: could not parse custom element
This commit is contained in:
parent
89f0c21784
commit
48e1e723d4
2 changed files with 10 additions and 1 deletions
|
|
@ -550,7 +550,7 @@ export class Matcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const kMarkupPattern = /<!--[^]*?(?=-->)-->|<(\/?)([a-z][a-z0-9]*)\s*([^>]*?)(\/?)>/ig;
|
const kMarkupPattern = /<!--[^]*?(?=-->)-->|<(\/?)([a-z][a-z0-9]*-?[a-z0-9]*)\s*([^>]*?)(\/?)>/ig;
|
||||||
const kAttributePattern = /(^|\s)(id|class)\s*=\s*("([^"]+)"|'([^']+)'|(\S+))/ig;
|
const kAttributePattern = /(^|\s)(id|class)\s*=\s*("([^"]+)"|'([^']+)'|(\S+))/ig;
|
||||||
const kSelfClosingElements = {
|
const kSelfClosingElements = {
|
||||||
meta: true,
|
meta: true,
|
||||||
|
|
|
||||||
|
|
@ -263,4 +263,13 @@ describe('HTML Parser', function () {
|
||||||
root.toString().should.eql(html)
|
root.toString().should.eql(html)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Custom Element', function () {
|
||||||
|
it('parse "<my-widget></my-widget>" tagName should be "my-widget"', function () {
|
||||||
|
|
||||||
|
var root = parseHTML('<my-widget></my-widget>');
|
||||||
|
|
||||||
|
root.firstChild.tagName.should.eql('my-widget');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue