Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Merge requests
!4116
Issue
#2982391
: JS scripts with defer property can't be loaded for some cases due to Jquery 3.1 core changes
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Open
Issue
#2982391
: JS scripts with defer property can't be loaded for some cases due to Jquery 3.1 core changes
issue/drupal-2982391:2982391-js-scripts-with
into
7.x
Overview
0
Commits
1
Pipelines
0
Changes
1
Open
Issue #2982391: JS scripts with defer property can't be loaded for some cases due to Jquery 3.1 core changes
Gregor Sýkora
requested to merge
issue/drupal-2982391:2982391-js-scripts-with
into
7.x
Jun 7, 2023
Overview
0
Commits
1
Pipelines
0
Changes
1
0
0
Merge request reports
Compare
7.x
7.x (HEAD)
and
latest version
latest version
407e2da1
1 commit,
Jun 7, 2023
1 file
+
17
−
1
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
misc/drupal.js
+
17
−
1
View file @ 5c610f08
Edit in single-file editor
Open in Web IDE
Show full file
@@ -611,7 +611,23 @@ $(function () {
@@ -611,7 +611,23 @@ $(function () {
//Attach all behaviors.
//Attach all behaviors.
$
(
function
()
{
$
(
function
()
{
Drupal
.
attachBehaviors
(
document
,
Drupal
.
settings
);
// Only attach behaviors on 'complete' document state to make sure the scripts
// using 'defer' are already loaded (otherwise the behaviors
// might not get attached).
// This is a workaround for jQuery ready being fired too soon
// (see https://github.com/jquery/jquery/issues/3271).
// If the state is 'complete' attach behaviors immediately.
if
(
document
.
readyState
===
'
complete
'
)
{
Drupal
.
attachBehaviors
(
document
,
Drupal
.
settings
);
}
// If we have a different state, wait for the state to change to 'complete'.
else
{
document
.
addEventListener
(
'
readystatechange
'
,
function
()
{
if
(
document
.
readyState
===
'
complete
'
)
{
Drupal
.
attachBehaviors
(
document
,
Drupal
.
settings
);
}
});
}
});
});
/**
/**
Loading