[jQuery] Bug: #48 (Seach scope does not work as expected with content loaded via $.get)

[jQuery] Bug: #48 (Seach scope does not work as expected with content loaded via $.get)

Ticket #48 (bug):
http://proj.jquery.com/dev/bugs/bug/48/
My workaround for this bug:
$(document).ready(function(){
    // do fancy stuff when client clicks the ajax anchor
    $("#portlet a.ajax").click(function(e){
        e.preventDefault();
        // load the target content and do something with it
        $.get(this.href, function(content){
            // create empty div and set content
            var target = $(document.createElement('div')).html(content)
                // search the content for our portlet div
                .find('[@id=portlet]').html();
            // put that content inside the target div
            $("#portlet div.target").html(target);
        });
    });
});
Idea is simple: create div, set innerHTML and run search in it element
with attribute id=portlet.
To see how it works: http://www.aloyzas.lt/javascript/scopebug/bug1.html
Tested on FF 1.5, IE 6.0 and Opera 9.0
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/