Skip to main content

Bug Tracker

Side navigation

#7676 closed bug (invalid)

Opened December 01, 2010 01:10PM UTC

Closed December 01, 2010 01:33PM UTC

Last modified October 04, 2011 02:43AM UTC

How Can I Be The Only One To Notice THIS!!!!

Reported by: jpe.pinho@gmail.com Owned by:
Priority: undecided Milestone: 1.6
Component: unfiled Version: 1.4.4
Keywords: jqueries Cc:
Blocked by: Blocking:
Description

i have 3 templates wrapped inside script tags marked as text/html (<script id="HeaderTt" type="text/html">...</script>)

and the first template contains the following:

"<table><thead><tr><td>HELLO</td></tr></thead><tbody>"

the second contains:

"<tr><td>${something}<td/></tr>"

the last contains:

"</tbody><tfoot><tr><td>MORE HELLO</td></tr></tfoot>"

considering the templates above, i wrote the following script:

...

var t1 = $.template(null, firstTemplate.innerHTML);

var t2 = $.template(null, secondTemplate.innerHTML);

var t3 = $.template(null, thirdTemplate.innerHTML);

now if i do:

$.tmpl(t1, null).appendTo(someHTMLControl);

the output will be:

"<table><thead><tr><td>HELLO</td></tr></thead><tbody>?<DIV></DIV></TBODY></TABLE>"

now from the question mark forward what HAPPENED??? what the hell are that? is jquery trying to correct my template?!?! why?! i'm frustrated... i tried to change from prototype to jquery on this project i made, and i end up using prototype because in the end of the day it was PROTOTYPE the one that solved my problems!!! their templates are much more straight forward (although i recognize that jquery has more potencial due to databing functionalities).

The problem here is that 99.9 percent of the users expect the output without that final part, so what ever you guys do, your first priority is to handle that cenario or at least explain it! Develop is very funny, but we cannot forget that or purpose of existance is to solve OTHER PEOPLE PROBLEMS.. if we forget that, we are just some geeks...playing with our computers...

P.S: i'm not trying to be offensive, i'm just sharing my point

of view.

Regards,

JP

Attachments (0)
Change History (2)

Changed December 01, 2010 01:33PM UTC by ajpiano comment:1

_comment0: jQuery requires that you pass strings that represent fully valid html elements. This is not unique to jQuery templates, but it is in fact true of all jQuery manipulation methods. \ \ It's the reason that you can't do this: \ \ $("<div>").appendTo("#foo") \ $("Hello there").appendTo("#foo"); \ $("</div>").appendTo("#foo"); \ \ but rather you do $("<div>Hello There</div>") which jQuery can parse into a valid document fragment. JavaScript does not think in terms of markup strings, but rather Elements. \ \ It is unfortunate that your expectation is so divergent with the way that jQuery works, but this is the way jQuery works. Your statement that 99.9 per cent of the users expect it to work your way is clearly not based in fact, as a great many jQuery users understand this problem intuitively, having had JS experience, and others learn it when they are informed. We understand that you are not trying to be offensive, but it is worth doing a bit of research before ranting as you have here. \ \ Thanks for your time and interest in helping jQuery!1291210418175539
_comment1: jQuery requires that you pass strings that represent fully valid html elements. This is not unique to jQuery templates, but it is in fact true of all jQuery manipulation methods. \ \ It's the reason that you can't do this: \ {{{ \ $("<div>").appendTo("#foo") \ $("Hello there").appendTo("#foo"); \ $("</div>").appendTo("#foo"); \ }}} \ \ but rather you do $("<div>Hello There</div>") which jQuery can parse into a valid document fragment. JavaScript does not think in terms of markup strings, but rather Elements. \ \ It is unfortunate that your expectation is so divergent with the way that jQuery works, but this is the way jQuery works. Your statement that 99.9 per cent of the users expect it to work your way is clearly not based in fact, as a great many jQuery users understand this problem intuitively, having had JS experience, and others learn it when they are informed. We understand that you are not trying to be offensive, but it is worth doing a bit of research before ranting as you have here. \ \ Thanks for your time and interest in helping jQuery!1291210450472593
resolution: → invalid
status: newclosed

jQuery requires that you pass strings that represent fully valid html elements. This is not unique to jQuery templates, but it is in fact true of all jQuery manipulation methods.

It's the reason that you can't do this:

$("<div>").appendTo("#foo")
$("Hello there").appendTo("#foo");
$("</div>").appendTo("#foo");

but rather you do $("<div>Hello There</div>") which jQuery can parse into a valid document fragment. JavaScript does not think in terms of markup strings, but rather Elements.

It is unfortunate that your expectation is so divergent with the way that jQuery works, but this is the way jQuery works. Your statement that 99.9 per cent of the users expect it to work your way is clearly not based in fact, as a great many jQuery users understand this problem intuitively, having had JS experience, and others learn it when they are informed. We understand that you are not trying to be offensive, but it is worth doing a bit of research before ranting as you have here.

Thanks for your time and interest in helping jQuery!

Changed October 04, 2011 02:43AM UTC by dmethvin comment:2

keywords: → jqueries