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

Wrong execution order of <script> tag without src and defer #1984

Closed
yshumy opened this issue Nov 22, 2024 · 10 comments · Fixed by #2000
Closed

Wrong execution order of <script> tag without src and defer #1984

yshumy opened this issue Nov 22, 2024 · 10 comments · Fixed by #2000
Labels
bug Something isn't working

Comments

@yshumy
Copy link

yshumy commented Nov 22, 2024

我有一个包含 JavaScript Source File 的词典在最新版上不能用了。

Copy link
Contributor

Bot detected the issue body's language is not English, translate it automatically.

I have a dictionary containing a JavaScript Source File that no longer works on the latest version.

@github-actions github-actions bot changed the title 不支持 JavaScript Source File 了? JavaScript Source File is no longer supported? Nov 22, 2024
@shenlebantongying
Copy link
Collaborator

Need more info.

@yshumy
Copy link
Author

yshumy commented Nov 25, 2024

需要更多信息。

词根词缀.zip

Copy link
Contributor

Bot detected the issue body's language is not English, translate it automatically.

More information is needed.

Root affix.zip

@shenlebantongying shenlebantongying added the bug Something isn't working label Nov 26, 2024
@shenlebantongying
Copy link
Collaborator

shenlebantongying commented Nov 26, 2024

This is related to 939e786

Not every <script> tag got the defer.

The <script> block executed before the deferred jsmind.js.

Edit:

The defer only delays external script. The inline <script> </script> is part of HTML, the defer doesn't work at all.

Edit2:

I think this is the same issue http://forum.freemdict.com/t/topic/11495/3575

@xiaoyifang
Copy link
Owner

#1379

@xiaoyifang
Copy link
Owner

maybe should wrap around the <script> content on document.ready event.

<script>
$(function(){

[content]
});
</script>

@shenlebantongying
Copy link
Collaborator

shenlebantongying commented Nov 27, 2024

We can just use standardized stuffs.

// new gd build-in
function gd_onReady(func) {
  if (document.readyState !== 'loading') {  
    func();
  } else {
    document.addEventListener('DOMContentLoaded', func);
  }
}
<script>
gd_onReady(()=> {
  [content]
})
</script>

@yshumy
Copy link
Author

yshumy commented Nov 27, 2024

我们可以只使用标准化的东西。

// new gd build-in
function gd_onReady(func) {
  if (document.readyState !== 'loading') {  
    func();
  } else {
    document.addEventListener('DOMContentLoaded', func);
  }
}
<script>
gd_onReady(()=> {
  [content]
})
</script>

以前这个词典可以正常使用的,就是最近升级后不能用了。

Copy link
Contributor

Bot detected the issue body's language is not English, translate it automatically.

We can just use standardized stuff.

// new gd build-in
function gd_onReady(func) {
if (document.readyState !== 'loading') {
func();
} else {
document.addEventListener('DOMContentLoaded', func);
}
}
<script>
gd_onReady(()=> {
[content]
})
</script>

This dictionary used to work normally, but it no longer works after a recent upgrade.

@shenlebantongying shenlebantongying changed the title JavaScript Source File is no longer supported? Wrong execution order of <script> tag without src and defer Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants