controljs
controljs copied to clipboard
ControlJS (rev 12) incompatible with YUI onDOMReady
What steps will reproduce the problem?
1. Create a test page which loads ControlJS, a minimal version of YUI, and a
test script with a call to Event.onDOMReady
2. The domready handler doesn't get executed
Please provide any additional information below.
test.html:
<html>
<head>
</head>
<body>
<script type="text/javascript">
var cjsscript = document.createElement('script');
cjsscript.src = "control.js";
var cjssib = document.getElementsByTagName('script')[0];
cjssib.parentNode.insertBefore(cjsscript, cjssib);
</script>
<script type="text/cjs"
data-cjssrc="http://yui.yahooapis.com/2.8.2r1/build/yahoo/yahoo-min.js"></script
>
<script type="text/cjs"
data-cjssrc="http://yui.yahooapis.com/2.8.2r1/build/event/event-min.js"></script
>
<script type="text/cjs" data-cjssrc="test.js"></script>
</body>
test.js:
YAHOO.util.Event.onDOMReady(function() {
alert("123");
});
The same example with jquery works just fine.
Original issue reported on code.google.com by [email protected]
on 6 Jan 2011 at 3:37
Oh well, I got around this problem by adding
<script type="text/cjs">
YAHOO.util.Event.DOMReadyEvent.fire();
</script>
as the very last script on the page.
Original comment by [email protected]
on 7 Jan 2011 at 10:20