0

I've tried xtk release 2 as well as built xtk.js from source and there seems to be an issue (that wasn't there in release 1) when xtk is used alongside jquery.

No matter what I do, I always get a

"Uncaught Error: Could not find the given container or it has an undefined size."

in the javascript console.

To reproduce the issue, I modified the sample html page on the xtk wiki, reported here for convenience:

<html>
<head>
<title>XTK TEST COMPILED!</title>
<script type="text/javascript" src="xtk.js"></script>
<script type="text/javascript">
  var run = function() {
    var r = new X.renderer('r');
    r.init();
    var cube = new X.cube([0,0,0],10,10,10);
    r.add(cube);
    r.render();
  };
</script>
<body onload="run()">
  <!-- the container for the renderer -->
  <div id="r" style="background-color: #000000; width: 100%; height: 100%;"></div>
</body>

and changed it to

<html>
<head>
<title>XTK TEST COMPILED!</title>
<script type="text/javascript" src="xtk.js"></script>
<script type="text/javascript" src="jquery-1.7.min.js"></script> 
<script type="text/javascript">
  $(document).ready(function() {
    var r = new X.renderer('r');
    r.init();
    var cube = new X.cube([0,0,0],10,10,10);
    r.add(cube);
    r.render();
  });
</script>
<body>
  <!-- the container for the renderer -->
  <div id="r" style="background-color: #000000; width: 100%; height: 100%;"></div>
</body>

If you test this page (I tried Chrome and Firefox), you'll get the error reported above.

Any ideas on how to tackle this? I'm investigating...

  • Actually, I found a workaround: the issue seems to be happening when using the $ method. Replacing $ by jQuery seems to avoid the issue. – lantiga Feb 16 '12 at 12:27

1 Answers1

0

I am glad it works now! You could check out the (unreleased) demo where we use JQuery as well:

http://demos.goxtk.com/evl/

Just for a test: are you sure it worked different with XTK r1? I don't think anything changed on that level..

haehn
  • 967
  • 1
  • 6
  • 19
  • Thanks a lot for the pointer to the demo. I'm not sure, what was going on. The code I posted was failing, it isn't anymore. I'll keep you posted. – lantiga Feb 17 '12 at 22:30