-
-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
endIndex less than startIndex for implied tags #896
Comments
Just seen the AST explorer (useful!), so put my case from parcel-bundler/parcel#6672 (comment) at https://astexplorer.net/#/gist/a31bfb2e193e72e403256d885fd4b756/0153ebc4a547b3cbbf3003f033329740369e6aac (focusing on the |
After a bit of look, I think Line 263 in f38ddb8
Line 233 in f38ddb8
</p> ) is given the indices of the new void element (<hr> ), and as the endIndex is taken from the tokenizer directly (which has no knowledge of the inferred </p> ) it's wrong.
I'm wondering though, what should the |
Seems like this happens on invalid HTML too: parcel-bundler/parcel#6672 (comment). |
Fixes #896 BREAKING: Some indices (primarily end indices) will have changed with this.
@thewilkybarkid Thank you so much for the report, and for digging into the details! I have opened #910 with a refactor of start/end indices, which fixes this and other issues with how indices work. |
Fixes #896 BREAKING: Some indices (primarily end indices) will have changed with this.
If I have
and I run
I get
But if I don't include the optional end tag for the
<p>
:I get
The
endIndex
for thehr
doesn't seem to have been set, so it's the same as for the<p>
. This trips up PostHTML'ssourceLocations
option (posthtml/posthtml-parser#63), which finds anendIndex
less than astartIndex
. This option is now used by Parcel, leading to parcel-bundler/parcel#6672.The text was updated successfully, but these errors were encountered: