mirror of
https://github.com/danbulant/node-html-parser
synced 2026-06-19 06:31:30 +00:00
Merge pull request #15 from Sharcoux/fix-namespace
Fix issue when parsing namespaces
This commit is contained in:
commit
2ad3ea6fb5
2 changed files with 6 additions and 1 deletions
|
|
@ -726,7 +726,7 @@ export class Matcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
|
||||||
const kMarkupPattern = /<!--[^]*?(?=-->)-->|<(\/?)([a-z][-.0-9_a-z]*)\s*([^>]*?)(\/?)>/ig;
|
const kMarkupPattern = /<!--[^]*?(?=-->)-->|<(\/?)([a-z][-.:0-9_a-z]*)\s*([^>]*?)(\/?)>/ig;
|
||||||
const kAttributePattern = /(^|\s)(id|class)\s*=\s*("([^"]+)"|'([^']+)'|(\S+))/ig;
|
const kAttributePattern = /(^|\s)(id|class)\s*=\s*("([^"]+)"|'([^']+)'|(\S+))/ig;
|
||||||
const kSelfClosingElements = {
|
const kSelfClosingElements = {
|
||||||
area: true,
|
area: true,
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,11 @@ describe('HTML Parser', function () {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should be able to parse namespaces', function () {
|
||||||
|
const namespacedXML = '<ns:identifier>content</ns:identifier>';
|
||||||
|
parseHTML(namespacedXML).toString().should.eql(namespacedXML);
|
||||||
|
});
|
||||||
|
|
||||||
it('should parse "<div><a><img/></a><p></p></div>.." very fast', function () {
|
it('should parse "<div><a><img/></a><p></p></div>.." very fast', function () {
|
||||||
|
|
||||||
for (var i = 0; i < 100; i++)
|
for (var i = 0; i < 100; i++)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue