Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
66501469
Commit
66501469
authored
Jun 21, 2012
by
Richard Gibson
Committed by
timmywil
Jun 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close GH-829: no ticket: smaller jQuery.ready.
parent
6cdca88e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
41 deletions
+38
-41
core.js
src/core.js
+38
-41
No files found.
src/core.js
View file @
66501469
...
...
@@ -367,28 +367,30 @@ jQuery.extend({
// Handle when the DOM is ready
ready
:
function
(
wait
)
{
// Either a released hold or an DOMready/load event and not yet ready
if
(
(
wait
===
true
&&
!--
jQuery
.
readyWait
)
||
(
wait
!==
true
&&
!
jQuery
.
isReady
)
)
{
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if
(
!
document
.
body
)
{
return
setTimeout
(
jQuery
.
ready
,
1
);
}
// Abort if there are pending holds or we're already ready
if
(
wait
===
true
?
--
jQuery
.
readyWait
:
jQuery
.
isReady
)
{
return
;
}
// Remember that the DOM is ready
jQuery
.
isReady
=
true
;
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if
(
!
document
.
body
)
{
return
setTimeout
(
jQuery
.
ready
,
1
);
}
// If a normal DOM Ready event fired, decrement, and wait if need be
if
(
wait
!==
true
&&
--
jQuery
.
readyWait
>
0
)
{
return
;
}
// Remember that the DOM is ready
jQuery
.
isReady
=
true
;
// If there are functions bound, to execute
readyList
.
resolveWith
(
document
,
[
jQuery
]
);
// If a normal DOM Ready event fired, decrement, and wait if need be
if
(
wait
!==
true
&&
--
jQuery
.
readyWait
>
0
)
{
return
;
}
// Trigger any bound ready events
if
(
jQuery
.
fn
.
trigger
)
{
jQuery
(
document
).
trigger
(
"ready"
).
off
(
"ready"
);
}
// If there are functions bound, to execute
readyList
.
resolveWith
(
document
,
[
jQuery
]
);
// Trigger any bound ready events
if
(
jQuery
.
fn
.
trigger
)
{
jQuery
(
document
).
trigger
(
"ready"
).
off
(
"ready"
);
}
},
...
...
@@ -853,14 +855,28 @@ jQuery.ready.promise = function( object ) {
// If IE and not a frame
// continually check to see if the document is ready
var
top
level
=
false
;
var
top
=
false
;
try
{
top
level
=
window
.
frameElement
==
null
;
top
=
window
.
frameElement
==
null
&&
document
.
documentElement
;
}
catch
(
e
)
{}
if
(
document
.
documentElement
.
doScroll
&&
toplevel
)
{
doScrollCheck
();
if
(
top
&&
top
.
doScroll
)
{
(
function
doScrollCheck
()
{
if
(
!
jQuery
.
isReady
)
{
try
{
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top
.
doScroll
(
"left"
);
}
catch
(
e
)
{
return
setTimeout
(
doScrollCheck
,
1
);
}
// and execute any waiting functions
jQuery
.
ready
();
}
})();
}
}
}
...
...
@@ -891,22 +907,3 @@ if ( core_rnotwhite.test( "\xA0" ) ) {
// All jQuery objects should point back to these
rootjQuery
=
jQuery
(
document
);
// The DOM ready check for Internet Explorer
function
doScrollCheck
()
{
if
(
jQuery
.
isReady
)
{
return
;
}
try
{
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document
.
documentElement
.
doScroll
(
"left"
);
}
catch
(
e
)
{
setTimeout
(
doScrollCheck
,
1
);
return
;
}
// and execute any waiting functions
jQuery
.
ready
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment