Skip to content
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

Preserve invalid nested A tags in AST #215

Merged
merged 3 commits into from
Sep 8, 2022
Merged

Preserve invalid nested A tags in AST #215

merged 3 commits into from
Sep 8, 2022

Conversation

nonara
Copy link
Collaborator

@nonara nonara commented Sep 7, 2022

Background

A tags which were nested are invalid HTML.

Example

<a href="#"><b>link <a href="#">nested link</a> end</b></a>

Browsers and some parsers (like parse5) handle this by correcting the HTML as follows:

<a href="#"><b>link </b></a><a href="#">nested link</a> end

This library did not fix these tags, until PR #148

New Behaviour

We have determined that the behaviour of fixing the nested A tag is not appropriate for this sort of parser. Parsers which apply fixes produce full compliant HTML, ready for browser consumption. That is not the purpose of this library.

⚠️ BREAKING CHANGE ⚠️

Because this can be considered a breaking change, we are incrementing the major version #

To support legacy applications which rely on this behaviour being done quickly, during parse, we've silently introduced a new option, which is disabled by default:

fixNestedATags

@nonara nonara merged commit 374188f into main Sep 8, 2022
@nonara nonara deleted the fix-211 branch September 8, 2022 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant