mirror of
https://github.com/danbulant/node-html-parser
synced 2026-05-19 04:18:52 +00:00
Fix issue when parsing namespaces
Signed-off-by: François BILLIOUD <f.billioud@gmail.com>
This commit is contained in:
parent
c145442179
commit
0fb0baa47f
2 changed files with 6 additions and 1 deletions
|
|
@ -725,7 +725,7 @@ export class Matcher {
|
|||
}
|
||||
|
||||
// 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 kSelfClosingElements = {
|
||||
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 () {
|
||||
|
||||
for (var i = 0; i < 100; i++)
|
||||
|
|
|
|||
Loading…
Reference in a new issue