diff --git a/src/index.ts b/src/index.ts index bf68ac3..50d64e9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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, diff --git a/test/html.js b/test/html.js index b390035..5613b3c 100644 --- a/test/html.js +++ b/test/html.js @@ -272,4 +272,13 @@ describe('HTML Parser', function () { root.firstChild.tagName.should.eql('my-widget'); }); }); + + describe('Custom Element multiple dash', function () { + it('parse "" tagName should be "my-new-widget"', function () { + + var root = parseHTML(''); + + root.firstChild.tagName.should.eql('my-new-widget'); + }); + }); });