Skip to main content

Bug Tracker

Side navigation

#8743 closed bug (invalid)

Opened April 01, 2011 04:29PM UTC

Closed April 01, 2011 05:41PM UTC

Last modified March 14, 2012 05:22PM UTC

ONE MORE TIME: in FireFox 4 the $("#element_id *") duplicate imput elements

Reported by: scutarug@gmail.com Owned by: scutarug@gmail.com
Priority: undecided Milestone: 1.next
Component: ajax Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:
Description

this is the second ticked that I issue but this time I got it in jsFiddle.

here is the jsFiddle link:

http://jsfiddle.net/QEaav/19/

Attachments (0)
Change History (13)

Changed April 01, 2011 04:40PM UTC by timmywil comment:1

I'm confused. What's the bug exactly? I don't see the duplicates. http://jsfiddle.net/timmywil/QEaav/21/

And is this related to a certain browser?

Changed April 01, 2011 04:41PM UTC by timmywil comment:2

owner: → scutarug@gmail.com
status: newpending

Changed April 01, 2011 04:51PM UTC by anonymous comment:3

Replying to [comment:1 timmywil]:

I'm confused. What's the bug exactly? I don't see the duplicates. http://jsfiddle.net/timmywil/QEaav/21/ And is this related to a certain browser?

do you see it in FF4?

Changed April 01, 2011 05:15PM UTC by timmywil comment:4

I feel dumb. You said firefox 4 in the title. I went straight to the fiddle and didn't understand what the bug was from the fiddle. I do see duplicate inputs in the serializeArray response, but you are serializing the inputs as well as their parents and I believe that is the correct response. If you select only the inputs, you will get back the proper response. $('#holder :input').serializeArray()

An example:

http://jsfiddle.net/timmywil/PyZGH/1/

Changed April 01, 2011 05:39PM UTC by cowboy comment:5

_comment0: The correct usage for `.serializeArray()` is either `$('form').serializeArray()` or `$(':input').serializeArray()` but never both, as you'll get duplicates!1301679617450571

The correct usage for .serializeArray() is either:

$('form').serializeArray()

or

$(':input').serializeArray()

but never both, as you'll get duplicates.

Changed April 01, 2011 05:41PM UTC by timmywil comment:6

component: unfiledajax
resolution: → invalid
status: pendingclosed

Changed April 01, 2011 05:43PM UTC by anonymous comment:7

I know that adding the :input is working, but don't you thing that this a huge inconsistency with other browsers? Doesn't this defies the purpose of jQuery?

I think of "*" as select every element, and absolutely NOT same element twice. After all why would I ever need that functionality, not to mention that this functionality is available in FireFox 4?

However this example its all over my project ... And now should I go and do: if you are ff4 do this else do that? What's jQuery going to do for me?

I just hope it's a issue with ff4 being in beta and not a jQuery problem. Just wanted to let you know about issue.

Thanks for your time.

Changed April 01, 2011 05:51PM UTC by dmethvin comment:8

Seems like a programmer error to me, anonymous. The docs say that if you select a form it serializes all the elements in the form. Your selector selects both the form and its children so what exactly did you expect? Nonetheless, we have documented this now so you won't trip over it again.

Changed April 01, 2011 06:02PM UTC by anonymous comment:9

I don't remember adding a form element in my example. If I did it's may bad. Our project is in .net and we can't have more then one form elements on a page and we use components that has "form" (div) that holds the input elements.

However you do realize that this happens only in FF4. None of other browsers does that.

Another thing is that let's say I don't use the serialize() and I use just the selector and I want to loop through it and what do I do? Check for FF4?

Think about it.

Changed April 01, 2011 06:16PM UTC by rwaldron comment:10

Firefox 4 doesn't change the fact that your code is simply incorrect. If you write unexpected code, unexpected things happen.

Changed April 01, 2011 06:25PM UTC by anonymous comment:11

I don't think you read my post :)

I don't use a form element and I want all the elements in a container! In this case I get dupes in FF4!

I hope I made my self clear.

Changed April 01, 2011 06:41PM UTC by ajpiano comment:12

Not using a form element around input/select/textarea/buttons is, as rwaldron stated, "simply incorrect."

Changed April 01, 2011 06:44PM UTC by cowboy comment:13

LOL