Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#7750 closed bug (invalid)

jquery tmplate not working on ie7 but ie8/chrome/ff.., any ideas?

Reported by: 17discuss.tw@… Owned by: Rick Waldron
Priority: high Milestone: 1.6
Component: templates Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

Description

jquery: 1.4.2 jquery-tmpl : github 1.0.0pre

$(function() {

$.getJSON('PInfo.aspx?' + genP('no,flds', getUrl()), {}, function(json) {

render_detail(json );

});

});

function render_detail(json) {

$.get('tmp-product-detail.htm', function(template) {

$(template).tmpl(json).appendTo('#contentShopItem');

});

}

Change History (7)

comment:1 Changed 8 years ago by addyosmani

Owner: set to 17discuss.tw@…
Status: newpending

Thank you for submitting a ticket to the jQuery Bug Tracker!

In order for us to evaluate the bug you are experiencing, we'll need you to submit a reduced test case on http://jsfiddle.net that reproduces the behaviour you are experiencing so that we can further establish whether this is indeed a bug.

Furthermore, please test your code using jQuery 1.4.4 to confirm if the behaviour you are seeing is still there with the latest version of core.

comment:2 Changed 8 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:3 Changed 8 years ago by Rick Waldron

Resolution: invalid
Status: closedreopened

comment:4 Changed 8 years ago by Rick Waldron

Reopening - I'm going to investigate this myself.

comment:5 Changed 8 years ago by Rick Waldron

Component: unfiledtemplates
Owner: changed from 17discuss.tw@… to Rick Waldron
Priority: undecidedhigh
Status: reopenedassigned

comment:6 Changed 8 years ago by BorisMoore

Two issues with the following code:

$.get('tmp-product-detail.htm', function(template) {

$(template).tmpl(json).appendTo('#contentShopItem');

});

First, template here is an HTML string obtained as content of the tmp-product-detail.htm file. jQuery Templates are not necessarily valid or well-formed HTML, and so many issues can arise if you define them as content of a non-script HTML element. They should be defined as content as script elements or as strings. Loading remotely should either be a strings, or as content of script elements within a remote page loaded through $.get.

Secondly, if you have a template as a string, you should render it by compiling a named template, or by using $.tmpl( templateString, data).appendTo( '#content' );

$( templateString ).tmpl(data).appendTo( '#content' ) is incorrect. Again, $( selector ).tmpl is used when selector is a selector to a script element, not a template string, which as I say, may not even be valid HTML.

Rick, I think the issues here are browser-specific side-effects of the above errors in using the APIs so we should be able to close this.

comment:7 Changed 8 years ago by Rick Waldron

Resolution: invalid
Status: assignedclosed
Note: See TracTickets for help on using tickets.