Bug Tracker

Modify

Ticket #8339 (closed bug: invalid)

Opened 2 years ago

Last modified 14 months ago

Lost outermost <tr> tag in template

Reported by: Marc Bourlon Owned by:
Priority: low Milestone: 1.next
Component: templates Version: 1.5
Keywords: Cc:
Blocking: Blocked by:

Description

Hi,

Demo here:  http://jsfiddle.net/dmRXy/2/ Maybe because I'm not yet expert of templates, I had to use a jQuery object to attach the result of a subtemplate to a template, which is why I don't use simply the string in template: (expand subtemplate, create jQuery object structure from the template string, append expanded subtemplate to this, then use main template. By the way, using a string with outermost tr works, the bug appears only if you convert it to a jQuery object. As you can see, in the second part, the tr is lost by the templating engine...

Change History

comment:1 Changed 2 years ago by jitter

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to templates

Thanks for taking the time to contribute to the jQuery project by writing a bug report and providing a test case!

This isn't a bug you just didn't read the documentation for jQuery.template() closely enough, it says:

templateT he HTML markup and/or text to be used as template. Can be a string, or an HTML element (or jQuery object wrapping an element) whose content is to be used as template

So this means if you pass in a jQuery object it should consists of a single element which is the container for the actual stuff you want to insert. In your test case the tr ends up being the container and thus doesn't get inserted it self.

Also check this  test case for a few different approaches

comment:2 Changed 2 years ago by anonymous

Shame on me jitter... sorry for the lost time... and thanks for helping !

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.