| 1 |
<!doctype html> |
| 2 |
<html class="no-js"> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"/> |
| 5 |
<title>Responsive Tests</title> |
| 6 |
<link rel="stylesheet" href="style.min.css" /> |
| 7 |
<script src="../dist/1.0.0/head.js"></script> |
| 8 |
</head> |
| 9 |
<body> |
| 10 |
<div id="wrap"> |
| 11 |
<h2>Load Tests</h2> |
| 12 |
<div id="content"> |
| 13 |
<button onclick="load_1()">Load jQuery</button> |
| 14 |
<button onclick="load_2()">Load jQuery/jQueryUI</button> |
| 15 |
<button onclick="load_3()">Load jQueryUI/jQuery</button> |
| 16 |
|
| 17 |
|
| 18 |
<p> |
| 19 |
Date Picker: <input id="datepicker" /> |
| 20 |
</p> |
| 21 |
|
| 22 |
<div id="result"></div> |
| 23 |
</div> |
| 24 |
<div id="footer"> |
| 25 |
<a href="../index.html">« headjs.com</a> |
| 26 |
| <a href="https://github.com/headjs/headjs/issues">found a bug?</a> |
| 27 |
</div> |
| 28 |
</div> |
| 29 |
|
| 30 |
<script> |
| 31 |
function load_1() { |
| 32 |
addMessage('jQuery loading...'); |
| 33 |
head.js('http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', |
| 34 |
function () { |
| 35 |
addMessage('jQuery callback called'); |
| 36 |
}); |
| 37 |
} |
| 38 |
|
| 39 |
function load_2() { |
| 40 |
addMessage('jQuery/jQueryUI loading...'); |
| 41 |
// if inverted callback fails, since it considers jquery.min already executed a callback |
| 42 |
// ..so must be related with asset name/callback association |
| 43 |
head.js(['http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js'], |
| 44 |
function () { |
| 45 |
addMessage('jQuery/jQueryUI callback called'); |
| 46 |
|
| 47 |
try { $('#datepicker').datepicker(); } |
| 48 |
catch (ex) { addMessage('Case 2 exception loading jquery UI component: ' + ex.toString()); } |
| 49 |
} |
| 50 |
); |
| 51 |
} |
| 52 |
|
| 53 |
function load_3() { |
| 54 |
addMessage('jQueryUI/jQuery loading...'); |
| 55 |
// if inverted callback fails, since it considers jquery.min already executed a callback |
| 56 |
// ..so must be related with asset name/callback association |
| 57 |
head.js(['http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'], |
| 58 |
function () { |
| 59 |
addMessage('jQueryUI/jQuery callback called'); |
| 60 |
} |
| 61 |
); |
| 62 |
} |
| 63 |
|
| 64 |
function addMessage(msg) { |
| 65 |
var ele = document.createElement("div"); |
| 66 |
ele.innerHTML = msg; |
| 67 |
|
| 68 |
document.getElementById("result").appendChild(ele); |
| 69 |
} |
| 70 |
|
| 71 |
</script> |
| 72 |
</body> |
| 73 |
</html> |