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

Modify <html> tag Regex #38

Merged
merged 2 commits into from
Nov 4, 2020

Conversation

davidjosephhayes
Copy link
Contributor

I have a number of

<script type="text/template>
  <div>...</div>
</script>

The </div> is being replaced with <html5-dom-document-internal-cdata-endtagfix/div>. This is later tripping the preg_match('/\<html.*?\>/', $source, $matches); regex causing an unnecessary replacement.

Due to the ordering these are undone, the resulting html has a number of extra <head><meta data-html5-dom-document-internal-attribute="charset-meta" http-equiv="content-type" content="text/html; charset=utf-8" /> preceding the </div> tags.

I believe the contained changes to the <html> match regex fix this issue by requiring the <html to be following by a space or >.

@codecov-io
Copy link

codecov-io commented Nov 3, 2020

Codecov Report

Merging #38 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #38   +/-   ##
=========================================
  Coverage     97.18%   97.18%           
  Complexity      557      557           
=========================================
  Files             5        5           
  Lines           888      888           
=========================================
  Hits            863      863           
  Misses           25       25           
Impacted Files Coverage Δ Complexity Δ
src/HTML5DOMDocument.php 98.14% <100.00%> (ø) 168.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2dceb00...f701b7d. Read the comment docs.

@ivopetkov ivopetkov merged commit 404a8e3 into ivopetkov:master Nov 4, 2020
@ivopetkov
Copy link
Owner

Thank you!

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.

3 participants