Hi Mathias,
It's an interesting idea. I think the better way to implement it is to using
DocumentFragment.
Codes:
var fragment=document.createDocumentFragment();
fragment.innerHTML=html;
$(exp,fragment).whatever_youlike_function
....
On 11/24/06, Mathias Bank <[EMAIL PROTECTED]> wrote:
Hi,
$(expr, context) is a really nice function, but it could be optimized.
Until now, it can only be used, if context is a dom tree. But see this
scenario:
var html='';
html += "<ul>";
for (var i=0; i<10;i++) {
html += "<li>listing "+i+"</li>";
}
html+='</ul>';
Now, it would be great, if you could apply every jQuery function like
$('li',html).css("color", "red");
Until know, I have to create a dom element like
$('body').append('<div id="helper"></div>');
$('#helper').html(html);
$('#helper li',html).css("color","red");
html = $('#helper').html();
$('#helper').remove();
That does not look good at all. Is there a way to realize this
behaviour in jQuery-Core?
Mathias
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
--
Best regards
Linan Wang
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/