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: DOMContentLoaded is not firing for inline module scripts #3727

Merged
merged 2 commits into from
Jul 15, 2024

Conversation

istarkov
Copy link
Member

@istarkov istarkov commented Jul 15, 2024

Description

closes #3724

Steps for reproduction

https://embed.staging.webstudio.is/builder/f3843f61-c4dd-4fc6-9463-bb88e8cc5f9b

2 "Client Only" Embeds

<!--Embed 1 -->
<script type="module">
  import _ from 'https://cdn.jsdelivr.net/npm/lodash-es/lodash.js';

  console.log(_.join(['Hello', 'World', '1'], ' '));

  document.addEventListener('DOMContentLoaded', (event) => {
    console.log('DOM fully loaded 1');
  });
</script>

<!--Embed 2 -->
<script type="module">
  console.log('Hello 2');
  document.addEventListener('DOMContentLoaded', (event) => {
    console.log('DOM fully loaded 2');
  });
</script>

Before this PR gave output with following errors:

  • Broken order
  • Broken DOMContentLoaded
Hello 2
Hello World 1

Now no issues

Hello World 1
Hello 2
DOM fully loaded 1
DOM fully loaded 2

Code Review

  • hi @kof, I need you to do
    • conceptual review (architecture, feature-correctness)
    • detailed review (read every line)
    • test it on preview

Before requesting a review

  • made a self-review
  • added inline comments where things may be not obvious (the "why", not "what")

Before merging

  • tested locally and on preview environment (preview dev login: 5de6)
  • updated test cases document
  • added tests
  • if any new env variables are added, added them to .env file

@istarkov istarkov requested review from kof and TrySound July 15, 2024 13:25
@istarkov istarkov marked this pull request as ready for review July 15, 2024 13:26
@istarkov istarkov merged commit b01c453 into main Jul 15, 2024
23 checks passed
@istarkov istarkov deleted the embed.staging branch July 15, 2024 21:14
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.

DOMContentLoaded not firing when directly going to the URL
3 participants