Skip to main content

Bug Tracker

Side navigation

#5605 closed bug (invalid)

Opened December 05, 2009 05:40PM UTC

Closed December 05, 2009 11:48PM UTC

.get fails in Chrome, this also affects .add

Reported by: hitsthings Owned by:
Priority: major Milestone: 1.4
Component: unfiled Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

The .get function does a check:

num === undefined which is false in Chrome, so it ends up returning this["undefined"] instead of an Array slice.

Sample of failure:

<html><head><title>whatever</title>

<script type="text/javascript" src="/JS/jquery-1.3.2.js"></script>

</head>

<body>

<a id="id1" />

<a id="id2" />

<script type="text/javascript">

var list = jQuery("#id1");

list.add(jQuery("#id2"));

only alerts id1

list.each(function()

{

alert(this.id);

});

empty alert

alert(jQuery("#id2").get());

</script>

</body>

</html>

Attachments (1)
  • Default.html (0.4 KB) - added by hitsthings December 05, 2009 05:42PM UTC.

    Sample page

Change History (4)

Changed December 05, 2009 05:59PM UTC by hitsthings comment:1

proposed fix:

jQuery.fn.get = function(num)

{

return arguments.length > 0 ?

Return a 'clean' array

Array.prototype.slice.call(this) :

Return just the object

this[num];

};

Changed December 05, 2009 06:00PM UTC by hitsthings comment:2

errrrr

jQuery.fn.get = function(num)

{

return arguments.length == 0 ?

Return a 'clean' array

Array.prototype.slice.call(this) :

Return just the object

this[num];

};

Changed December 05, 2009 06:09PM UTC by hitsthings comment:3

Ah crap..........

I don't know how to close this bug, but it should be closed. I thought add would change the array it's called on, not create a new array. Sorry for the bother.

Changed December 05, 2009 11:48PM UTC by dmethvin comment:4

resolution: → invalid
status: newclosed