Created
May 6, 2013 16:57
-
-
Save ekashida/5526392 to your computer and use it in GitHub Desktop.
[echo/status/404?hack.css] Checking if the onload and onerror events fire for link tags on Android 2.3.4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<head> | |
<style> | |
#good, | |
#bad { | |
font-size: 30px; | |
width: 300px; | |
height:150px; | |
} | |
</style> | |
<script src="http://3vnx.localtunnel.com/target/target-script-min.js"></script> | |
<script src="http://yui.yahooapis.com/3.10.0/build/yui/yui-min.js"></script> | |
</head> | |
<body> | |
<h1>Testing invalid CSS resource "echo/status/404?hack.css" on Android 2.3.4</h1> | |
<button id="good">VALID CSS</button> | |
<button id="bad">INVALID CSS</button> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YUI().use('node', function (Y) { | |
Y.one('#good').on('click', function (e) { | |
var good = Y.Node.create('<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.3.0/build/cssreset/reset-min.css">'); | |
good._node.onerror = function () { | |
console.log('[FAILURE] onerror should not be called when a valid link resource is specified'); | |
}; | |
good._node.onload = function () { | |
console.log('[SUCCESS] onload called as expected when a valid link resource is specified'); | |
}; | |
Y.one('head').append(good); | |
console.log('clicked on good'); | |
}); | |
Y.one('#bad').on('click', function (e) { | |
var bad = Y.Node.create('<link rel="stylesheet" type="text/css" href="echo/status/404?hack.css">'); | |
bad._node.onerror = function () { | |
console.log('[SUCCESS] onerror called as expected when an invalid link is specified'); | |
}; | |
bad._node.onload = function () { | |
console.log('[FAILURE] onload should not be called when an invalid link is specified'); | |
}; | |
Y.one('head').append(bad); | |
console.log('clicked on bad'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment