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

fix: require a whitespace before js style comments inside html content #127

Merged

Conversation

DylanPiercey
Copy link
Contributor

Description

Fix regression around JS style comments in the body by requiring that they are preceded by a whitespace.

Motivation and Context

This was caused by #119 which noted that this was potentially a breaking change. We didn't for see a common edge case however which was http links inside some content, eg:

<a href="http://ebay.com">
  http://ebay.com
</a>

With #119 that caused the code above to treat //ebay.com as a JS comment which was not desirable.
Now by requiring a whitespace (eg a newline) before any JS style comments within the html content we avoid this common gotcha while maintaining support for this syntax/feature.

Checklist:

  • I have updated/added documentation affected by my changes.
  • I have added tests to cover my changes.

@changeset-bot
Copy link

changeset-bot bot commented Aug 2, 2022

🦋 Changeset detected

Latest commit: b35460b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
htmljs-parser Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Aug 2, 2022

Codecov Report

Merging #127 (b35460b) into main (89fe2c7) will decrease coverage by 0.26%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #127      +/-   ##
==========================================
- Coverage   92.79%   92.53%   -0.27%     
==========================================
  Files          26       26              
  Lines         736      737       +1     
  Branches      253      254       +1     
==========================================
- Hits          683      682       -1     
- Misses         38       40       +2     
  Partials       15       15              
Impacted Files Coverage Δ
src/states/HTML_CONTENT.ts 93.02% <100.00%> (-4.60%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us.

@DylanPiercey DylanPiercey merged commit 222b145 into main Aug 2, 2022
@DylanPiercey DylanPiercey deleted the require-whitespace-before-js-style-body-comments branch August 2, 2022 17:30
@github-actions github-actions bot mentioned this pull request Aug 2, 2022
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.

2 participants