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
eb5df5e1
Commit
eb5df5e1
authored
Dec 17, 2012
by
Rick Waldron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2.0: Removes attachEvent paths for jQuery.ready()
Signed-off-by:
Rick Waldron
<
waldron.rick@gmail.com
>
parent
861a45b8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
44 deletions
+3
-44
core.js
src/core.js
+3
-44
No files found.
src/core.js
View file @
eb5df5e1
...
@@ -72,15 +72,8 @@ var
...
@@ -72,15 +72,8 @@ var
// The ready event handler and self cleanup method
// The ready event handler and self cleanup method
DOMContentLoaded
=
function
()
{
DOMContentLoaded
=
function
()
{
if
(
document
.
addEventListener
)
{
document
.
removeEventListener
(
"DOMContentLoaded"
,
DOMContentLoaded
,
false
);
document
.
removeEventListener
(
"DOMContentLoaded"
,
DOMContentLoaded
,
false
);
jQuery
.
ready
();
jQuery
.
ready
();
}
else
if
(
document
.
readyState
===
"complete"
)
{
// we're here because readyState === "complete" in oldIE
// which is good enough for us to call the dom ready!
document
.
detachEvent
(
"onreadystatechange"
,
DOMContentLoaded
);
jQuery
.
ready
();
}
};
};
jQuery
.
fn
=
jQuery
.
prototype
=
{
jQuery
.
fn
=
jQuery
.
prototype
=
{
...
@@ -864,46 +857,12 @@ jQuery.ready.promise = function( obj ) {
...
@@ -864,46 +857,12 @@ jQuery.ready.promise = function( obj ) {
setTimeout
(
jQuery
.
ready
);
setTimeout
(
jQuery
.
ready
);
// Standards-based browsers support DOMContentLoaded
// Standards-based browsers support DOMContentLoaded
}
else
if
(
document
.
addEventListener
)
{
}
else
{
// Use the handy event callback
// Use the handy event callback
document
.
addEventListener
(
"DOMContentLoaded"
,
DOMContentLoaded
,
false
);
document
.
addEventListener
(
"DOMContentLoaded"
,
DOMContentLoaded
,
false
);
// A fallback to window.onload, that will always work
// A fallback to window.onload, that will always work
window
.
addEventListener
(
"load"
,
jQuery
.
ready
,
false
);
window
.
addEventListener
(
"load"
,
jQuery
.
ready
,
false
);
// If IE event model is used
}
else
{
// Ensure firing before onload, maybe late but safe also for iframes
document
.
attachEvent
(
"onreadystatechange"
,
DOMContentLoaded
);
// A fallback to window.onload, that will always work
window
.
attachEvent
(
"onload"
,
jQuery
.
ready
);
// If IE and not a frame
// continually check to see if the document is ready
var
top
=
false
;
try
{
top
=
window
.
frameElement
==
null
&&
document
.
documentElement
;
}
catch
(
e
)
{}
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
,
50
);
}
// and execute any waiting functions
jQuery
.
ready
();
}
})();
}
}
}
}
}
return
readyList
.
promise
(
obj
);
return
readyList
.
promise
(
obj
);
...
...
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