Opened 12 years ago

Closed 10 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:


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)

demo_DomTemplated.html (2.1 KB) - added by damon 12 years ago.

Download all attachments as: .zip

Change History (6)

Changed 12 years ago by damon

Attachment: demo_DomTemplated.html added

comment:1 Changed 12 years ago by damon

By "failed to load" using the CDN, I mean the error message explicitly says: "dojox.dtl is undefined"

comment:2 Changed 12 years ago by ID

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 fortruth

I also have the problem now. I am using the dojo 1.5.

when using local dojo, the example from blow link

works but when using google CDN's it can't works

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
        <title>DTL Inventory</title>
        <script type="text/javascript" src="../dojo_1.5/dojo/dojo.js" djConfig="parseOnLoad: true"></script>
<!--        <script type="text/javascript"
                djConfig="parseOnLoad: true">
        <script type="text/javascript">
                // 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});
        Two unordered lists are created here from a JavaScript array

        <div class="update" style="float:left;"></div>
        <div class="update" style="float:left;"></div>



comment:4 Changed 11 years ago by same

I got it working by adding dojo.require("dojox.dtl");

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 10 years ago by ben hockey

Priority: highlow
Resolution: patchwelcome
Status: newclosed

dtl is unsupported. any further patches are welcome.

Note: See TracTickets for help on using tickets.