Bug Tracker

Modify

Ticket #7750 (closed bug: invalid)

Opened 2 years ago

Last modified 15 months ago

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

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

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

comment:1 Changed 2 years ago by addyosmani

  • Owner set to 17discuss.tw@…
  • Status changed from new to pending

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 2 years ago by trac-o-bot

  • Status changed from pending to closed
  • Resolution set to invalid

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 2 years ago by rwaldron

  • Status changed from closed to reopened
  • Resolution invalid deleted

comment:4 Changed 2 years ago by rwaldron

Reopening - I'm going to investigate this myself.

comment:5 Changed 2 years ago by rwaldron

  • Owner changed from 17discuss.tw@… to rwaldron
  • Priority changed from undecided to high
  • Status changed from reopened to assigned
  • Component changed from unfiled to templates

comment:6 Changed 2 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 2 years ago by rwaldron

  • Status changed from assigned to closed
  • Resolution set to invalid

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.