-
-
Notifications
You must be signed in to change notification settings - Fork 395
Closed
Description
If I have
const p = new Parser({ onclosetag(name) {
console.log({
name,
startIndex: p.startIndex,
endIndex: p.endIndex,
})
}})and I run
p.write("<p>Foo</p><hr>");I get
{ name: 'p', startIndex: 6, endIndex: 9 }
{ name: 'hr', startIndex: 10, endIndex: 13 }But if I don't include the optional end tag for the <p>:
p.write("<p>Foo<hr>");I get
{ name: 'p', startIndex: 6, endIndex: 9 }
{ name: 'hr', startIndex: 10, endIndex: 9 }The endIndex for the hr doesn't seem to have been set, so it's the same as for the <p>. This trips up PostHTML's sourceLocations option (posthtml/posthtml-parser#63), which finds an endIndex less than a startIndex. This option is now used by Parcel, leading to parcel-bundler/parcel#6672.
Metadata
Metadata
Assignees
Labels
No labels