mirror of
https://github.com/danbulant/node-html-parser
synced 2026-05-19 04:18:52 +00:00
Merge pull request #1 from raffecat/master
Allow custom element names with multiple dashes
This commit is contained in:
commit
20f65eb5de
2 changed files with 11 additions and 1 deletions
|
|
@ -550,7 +550,8 @@ export class Matcher {
|
|||
}
|
||||
}
|
||||
|
||||
const kMarkupPattern = /<!--[^]*?(?=-->)-->|<(\/?)([a-z][a-z0-9]*-?[a-z0-9]*)\s*([^>]*?)(\/?)>/ig;
|
||||
// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
||||
const kMarkupPattern = /<!--[^]*?(?=-->)-->|<(\/?)([a-z][-.0-9_a-z]*)\s*([^>]*?)(\/?)>/ig;
|
||||
const kAttributePattern = /(^|\s)(id|class)\s*=\s*("([^"]+)"|'([^']+)'|(\S+))/ig;
|
||||
const kSelfClosingElements = {
|
||||
meta: true,
|
||||
|
|
|
|||
|
|
@ -272,4 +272,13 @@ describe('HTML Parser', function () {
|
|||
root.firstChild.tagName.should.eql('my-widget');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Custom Element multiple dash', function () {
|
||||
it('parse "<my-new-widget></my-new-widget>" tagName should be "my-new-widget"', function () {
|
||||
|
||||
var root = parseHTML('<my-new-widget></my-new-widget>');
|
||||
|
||||
root.firstChild.tagName.should.eql('my-new-widget');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue