Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Tmpl removes TR tag content when not wrapped by TABLE tag
    primarykey
    data
    text
    <p>Upon migrating my old web interface with extensive use of jQuery Tmpl, some of my templates have ceased to work. Further investigation shows that the templates not working are the ones starting and ending with TR tags (i.e. table rows getting appended to an existing table). The source text just gets removed by the jQuery Tmpl script! If I use the TR tags in a broader context like wrapped in a table etc everything works just fine, but as soon as they are used in an isolated template, they get wiped out.</p> <p>working example:</p> <pre><code>&lt;script id="workingTemplate" type="text/x-jQuery-tmpl" &gt; &lt;table&gt; &lt;tr&gt;&lt;td&gt;this works&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;/script&gt; </code></pre> <p>not working example:</p> <pre><code>&lt;script id="notWorkingTemplate" type="text/x-jQuery-tmpl" &gt; &lt;tr&gt;&lt;td&gt;this does not work&lt;/td&gt;&lt;/tr&gt; &lt;/script&gt; </code></pre> <p>The first example renders the full HTML code when checking with Firebug, the latter renders an empty SCRIPT tag.</p> <p>The difference between the old and the new web interface that could in any way be related to the templating is a change from jQuery 1.5.2 to 1.8.2. I haven't tried running anything below 1.7.2 since this is where the .on() function got added, and the new framework has an extensive use of this method.</p> <p>Are there any workarounds for this problems except the most obvious (= changing templating framework to something still maintained)? </p> <p>EDIT: When loading the template from a string, the content stays intact,</p> <pre><code> $.template( "tableRowTemplate",'&lt;tr&gt;&lt;td&gt;this works&lt;/td&gt;&lt;/tr&gt;'); $.tmpl("tableRowTemplate", data).appendTo('TABLE#mytable TBODY'); </code></pre> <p>but is unfortunately no good for me since my templates are a tad more complicated than the examples (server side dynamics etc...). It does give some hints though. Obviously, it is the initialization of jQuery Tmpl that removes the content if it does not comply with something to me unknown. Maybe jQuery.fn.domManip?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload