Closed longXE closed 13 years ago
Wrapping in a div is not recommended. Firefox will actually create an img element, and may modify the src attribute, so it will no longer be "${srcUrl}". Wrapping in a script block ensures the browser does not validate or modify the markup (which may not be valid or even well-formed).
yes, it is clear now. thank you for your reply.
i have a jquery template:
<div id="test_template"> <img src="${url}" width="31" height="32" alt="" /> ${url} </div> I compile it with this:
test_template = $('#test_template').template(); I render it with this:
$.tmpl(test_template, {url:'hxxp://sstatic.net/stackoverflow/img/sprites.png'}).appendTo('#render_test'); note: hxxp=http
the end result is this:
<div id="render_test"> <img height="32" width="31" alt="" src="$%7Burl%7D"> http://sstatic.net/stackoverflow/img/sprites.png </div>
the src or href attribute always return the wrong url
this issue occus in firefox 3.x -> 4.x with the template content places in a div tag, but not when the template places in the script tag. the above code run well on chrome in both template places in script or div as well.