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: fix inline scripts and styles potentially breaking #2

Merged
merged 2 commits into from
Sep 16, 2022

Conversation

dario-piotrowicz
Copy link
Contributor

@dario-piotrowicz dario-piotrowicz commented Sep 15, 2022

fix the issue which breaks scripts split in different chunks in the input stream
by applying them only after the scripts has been fully visited

also fix the same issue for embeded styles, even though there everything works
fine it is better to apply all the styles together and avoid potential flashes of unexpected style combinations

resolves #1

Screenshots (if appropriate):

This is the result:
Kapture 2022-09-15 at 15 45 29

Checklist:

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

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 15, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: dario-piotrowicz / name: Dario Piotrowicz (d83df82)

src/index.ts Outdated Show resolved Hide resolved
@DylanPiercey
Copy link
Contributor

Thanks for taking the time to put up the PR! I think it looks pretty good 👍

@dario-piotrowicz dario-piotrowicz force-pushed the main branch 2 times, most recently from 70374ab to 9d58c8f Compare September 15, 2022 15:00
@codecov
Copy link

codecov bot commented Sep 15, 2022

Codecov Report

Merging #2 (b097aa1) into main (51650e1) will increase coverage by 1.24%.
The diff coverage is 100.00%.

❗ Current head b097aa1 differs from pull request most recent head b5c015e. Consider uploading reports for the commit b5c015e to get more accurate results

@@            Coverage Diff             @@
##             main       #2      +/-   ##
==========================================
+ Coverage   90.24%   91.48%   +1.24%     
==========================================
  Files           1        1              
  Lines          82       94      +12     
  Branches       26       29       +3     
==========================================
+ Hits           74       86      +12     
  Misses          6        6              
  Partials        2        2              
Impacted Files Coverage Δ
src/index.ts 91.48% <100.00%> (+1.24%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

src/index.ts Outdated Show resolved Hide resolved
src/index.ts Outdated

function isInlineHost(node: Node) {
if (node.nodeType !== Node.ELEMENT_NODE) {
return false;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is not being covered by tests, and by checking the MDN nodeType docs I think that the node here can't be anything else but an Element, so I am just going to remove this check, please let me know if you disagree

fix the issue which breaks scripts split in different chunks in the input stream
by applying them only after the scripts has been fully visited

also fix the same issue for embeded styles, even though there everything works
fine it is better to apply all the styles together and avoid potential flashes
of unexpected style combinations

resolves marko-js#1
@dario-piotrowicz
Copy link
Contributor Author

@DylanPiercey I've added a new very simple test because it looked like my change was causing some tests coverage failure (even though the non-covered lines seem unrelated to my change 😕), I hope it's fine, if you could approve the workflow we can see if now all is green 😁🤞

@DylanPiercey
Copy link
Contributor

Appreciate the changes and additional tests. Looks good to me!

@DylanPiercey DylanPiercey merged commit 4fe4b5b into marko-js:main Sep 16, 2022
@github-actions
Copy link

🎉 This PR is included in version 1.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@dario-piotrowicz
Copy link
Contributor Author

Appreciate the changes and additional tests. Looks good to me!

Awesome! thanks! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inline scripts can get broken
3 participants