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: <script> without src is not delayed like <script src="..." defer> #2000

Merged

Conversation

shenlebantongying
Copy link
Collaborator

@shenlebantongying shenlebantongying commented Nov 27, 2024

Fix issue caused by defer for external scripts.

//add defer to script tag
if ( linkType.compare( "script" ) == 0 ) {
newText = newText + " defer ";
}

The defer will delay the execution of external script to a time between "Page loaded" and DOMContentLoaded.

I don't put much thought yet, but this will immediately fix #1984

Also don't want to use jQuery because it creates a barrier on approaching the HTML standard.

src/dict/mdx.cc Outdated Show resolved Hide resolved
src/dict/mdx.cc Outdated Show resolved Hide resolved
@shenlebantongying
Copy link
Collaborator Author

Alternative fix of http://forum.freemdict.com/t/topic/11495/3575 @atauzki

The defer was to fix #1379

@shenlebantongying
Copy link
Collaborator Author

Not sure if this is a good thing to do, but let's merge and see.

@shenlebantongying shenlebantongying merged commit 00dbc74 into xiaoyifang:staged Nov 27, 2024
8 checks passed
@shenlebantongying shenlebantongying deleted the fix/script-solo branch November 27, 2024 12:33
@atauzki
Copy link
Collaborator

atauzki commented Nov 27, 2024

works.
Actually I have removed this <script> tag to js file and repacked them yesterday.
image

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.

Wrong execution order of <script> tag without src and defer
3 participants