Skip to content

Instantly share code, notes, and snippets.

@agibralter
Created June 26, 2009 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save agibralter/136686 to your computer and use it in GitHub Desktop.
Save agibralter/136686 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>index</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="Aaron Gibralter">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<script type="text/javascript" charset="utf-8">
// OUTPUT:
//
// start: 1.2.3
// loading 1.3.2#1
// loading 1.3.1
// loading 1.3.2#2
// end: 1.2.3
// beginning of 1.3.2#1: 1.3.2
// middle of 1.3.2#1: 1.3.2
// end of 1.3.2#1: 1.2.3
// beginning of 1.3.1: 1.3.1
// middle of 1.3.1: 1.3.1
// end of 1.3.1: 1.2.3
// beginning of 1.3.2#2: 1.3.2
// middle of 1.3.2#2: 1.3.2
// end of 1.3.2#2: 1.2.3
// timeout: 1.2.3
console.log('start: ' + jQuery().jquery);
console.log('loading 1.3.2#1');
(function () {
var script = document.createElement("script");
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js";
script.onload = script.onreadystatechange = function () {
console.log('beginning of 1.3.2#1: ' + jQuery().jquery);
(function ($) {
console.log('middle of 1.3.2#1: ' + $().jquery);
})(jQuery.noConflict(true));
console.log('end of 1.3.2#1: ' + jQuery().jquery);
};
document.body.appendChild(script);
})();
console.log('loading 1.3.1');
(function () {
var script = document.createElement("script");
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js";
script.onload = script.onreadystatechange = function () {
console.log('beginning of 1.3.1: ' + jQuery().jquery);
(function ($) {
console.log('middle of 1.3.1: ' + $().jquery);
})(jQuery.noConflict(true));
console.log('end of 1.3.1: ' + jQuery().jquery);
};
document.body.appendChild(script);
})();
console.log('loading 1.3.2#2');
(function () {
var script = document.createElement("script");
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js";
script.onload = script.onreadystatechange = function () {
console.log('beginning of 1.3.2#2: ' + jQuery().jquery);
(function ($) {
console.log('middle of 1.3.2#2: ' + $().jquery);
})(jQuery.noConflict(true));
console.log('end of 1.3.2#2: ' + jQuery().jquery);
};
document.body.appendChild(script);
})();
console.log('end: ' + jQuery().jquery);
var fun = function () {
console.log('timeout: ' + jQuery().jquery);
};
setTimeout(fun, 2000);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment