Skip to main content

Bug Tracker

Side navigation

#6361 closed bug ()

Opened March 26, 2010 04:02PM UTC

Closed November 11, 2010 11:09PM UTC

jQuery(html) returns 2 objects (html+script) if script is included

Reported by: zoglair Owned by: zoglair
Priority: undecided Milestone: 1.4.3
Component: core Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:
Description

Dear all,

Let me start by telling you that I've recently switched from 1.3.2 where I had no problems. So, I am uncertain if what I've found was introduced in 1.4.2 or in a version between.

My CMS/framework handles (popup) windows of various types via ajax calls. The server returns html which I handle via the $win = $(response) syntax. Now, if there is a <script> snippet included in the html, then $win becomes an array of 2 objects (one with the html, and the other with the script). Version 1.3.2 always returns 1 object.

This basically brakes my framework. I've spent almost a couple of days trying to nail it down.

I would like to know if this is the intended behaviour from now on, and I need to change everything, or it is something that is going to be changed again in the near future.

I am working in FF 3.5.8, if it makes any difference...

Thank you in advance for your attention!

Attachments (0)
Change History (4)

Changed March 26, 2010 05:13PM UTC by zoglair comment:1

Please, allow me to be more specific on the above issue:

var $win  = $(html);
var $form = $win.find('form:first');

if ($form.length)
{
    $form.submit(function()
    {
        var data = $form.serialize();
        ....
    });
}

In 1.3.2, $win.length=1, I get 1 form and

data
contains 1 set of key/value pairs. In 1.4.2, $win.length=2, I get 2 forms by 'form:first' and
data
contains 2 sets (keys are doubled). Unfortunately, after an error submission I - somehow - end up with different values and I cannot differentiate between them.

Changed October 16, 2010 05:32PM UTC by addyosmani comment:2

owner: → zoglair
priority: → undecided
status: newpending

Could you please let us know if this continues to be the case with jQuery 1.4.3?

Changed October 18, 2010 04:18PM UTC by anonymous comment:3

Replying to [comment:2 addyosmani]:

Could you please let us know if this continues to be the case with jQuery 1.4.3?

Thank you very much for your attention!

Unfortunately nothing is changed in 1.4.3, according to this issue. If i am not mistaken, this is also reflected in the source code under the comment

// HANDLE: $(html) -> $(array)

where 1.4.3 and 1.4.2 are the same, while 1.3.2 is way different.

Changed November 11, 2010 11:09PM UTC by trac-o-bot comment:4

status: pendingclosed

Automatically closed due to 14 days of inactivity.