stevesouders / controljs

Automatically exported from code.google.com/p/controljs
Apache License 2.0
26 stars 9 forks source link

ControlJS (rev 12) incompatible with YUI onDOMReady #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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 LeonidKh...@gmail.com on 6 Jan 2011 at 3:37

GoogleCodeExporter commented 9 years ago
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 LeonidKh...@gmail.com on 7 Jan 2011 at 10:20