Opened 11 years ago
Closed 9 years ago
#10560 closed defect (patchwelcome)
unable to access/load dojox.dtl._DomTemplated from CDN
Reported by: | damon | Owned by: | Neil Roberts |
---|---|---|---|
Priority: | low | Milestone: | tbd |
Component: | DojoX DTL | Version: | 1.4.0 |
Keywords: | dtl, cdn | Cc: | |
Blocked By: | Blocking: |
Description
I took the DTL tests and ran them locally pointing to the CDNs of AOL and GOOGLE. They failed to load (sample attached). If I point the test to a local instance of dojo, it loads fine.
This test case was to prove a different issue however, but I'm unable to recreate it with the public CDNs. We have a custom build hosted on our own CDN internally. The dojox.dtl._DomTemplated, loads fine, however it fails (breaks) on parsing the templatePath. It appears to fail on the {% for ... %} statements, however the error is cryptic and I'm unable to do much better debugging against the CDN (since I can't recreate it with local code).
I NEED to be able to run this against a cross domain build. I thought that the statements in {%...%} needed to be escaped with the <!-- {%...%}--> comments, but that doesn't fix the parsing error I'm getting. Is there another fix/patch for this I can make to resolve this within the build and allow it to work?
Attachments (1)
Change History (6)
Changed 11 years ago by
Attachment: | demo_DomTemplated.html added |
---|
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Have you tried to wrap the dojo.declare around a dojo.addOnLoad(function() { ... }); ?
If no can you test it ?
comment:3 Changed 11 years ago by
I also have the problem now. I am using the dojo 1.5.
when using local dojo, the example from blow link
http://dojocampus.org/explorer/#Dojox_DTL_Basic%20Template_Local
works but when using google CDN's it can't works
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="en"> <head> <title>DTL Inventory</title> <script type="text/javascript" src="../dojo_1.5/dojo/dojo.js" djConfig="parseOnLoad: true"></script> <!-- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js" djConfig="parseOnLoad: true"> </script>--> </head> <body> <script type="text/javascript"> dojo.require("dojox.dtl.Context"); dojo.addOnLoad(function(){ // Now, create a real template object var template = new dojox.dtl.Template( "<div><ol>{% for item in items %}<li>{{ item }}</li>{% endfor %}</ol></div>"); var html = template.render(new dojox.dtl.Context({ items: ["pineapple", "orange", "tomato"] })); // Retrieve the two nodes and set their innerHTML. // Note the use of the forEach function to iterate over the nodes. // Also, note the use of 'this.html', and the second parameter to forEach, // which redefines the meaning of 'this' within the function dojo.query(".update").forEach("item.innerHTML = this.html;", {html: html}); }); </script> Two unordered lists are created here from a JavaScript array <div class="update" style="float:left;"></div> <div class="update" style="float:left;"></div> End </body> </html>
comment:4 Changed 11 years ago by
I got it working by adding dojo.require("dojox.dtl");
... dojo.require("dojox.dtl"); dojo.require("dojox.dtl.Context"); dojo.addOnLoad(function(){ ... dojox.dtl is defined in _base.js, however, I am guessing since its not explicitly defined using dojo.declare, its fooling the dojo registration system so on possible solution is by adding dojo.require("dojox.dtl"); to the _base file
comment:5 Changed 9 years ago by
Priority: | high → low |
---|---|
Resolution: | → patchwelcome |
Status: | new → closed |
dtl is unsupported. any further patches are welcome.
By "failed to load" using the CDN, I mean the error message explicitly says: "dojox.dtl is undefined"