Bug Tracker

Opened 10 years ago

Closed 9 years ago

#6361 closed bug

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!

Change History (4)

comment:1 Changed 10 years ago by zoglair

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.

comment:2 Changed 9 years ago by addyosmani

Owner: set to zoglair
Priority: undecided
Status: newpending

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

comment:3 in reply to:  2 Changed 9 years ago by anonymous

Replying to 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.

comment:4 Changed 9 years ago by trac-o-bot

Status: pendingclosed

Automatically closed due to 14 days of inactivity.

Note: See TracTickets for help on using tickets.