fixed: could not parse custom element

This commit is contained in:
taoqf 2017-12-14 16:48:58 +08:00
parent 89f0c21784
commit 48e1e723d4
2 changed files with 10 additions and 1 deletions

View file

@ -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 kSelfClosingElements = {
meta: true,

View file

@ -263,4 +263,13 @@ describe('HTML Parser', function () {
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');
});
});
});