On 1/5/07, Jörn Zaefferer [EMAIL PROTECTED] wrote:
Thats intersting. Could you please file this as a bug report (component
docs)? Thanks.
Done!
http://jquery.com/dev/bugs/bug/754/
--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com
Is there a way to break the $.each loops?
I'd like it to be
$.each(object, function() {
break;
});
but it doesen't seem so.
Andreas
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
Andreas Wahlin schrieb:
Is there a way to break the $.each loops?
I'd like it to be
$.each(object, function() {
break;
});
but it doesen't seem so.
Andreas
___
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
On 04/01/07, Klaus Hartl [EMAIL PROTECTED] wrote:
Andreas Wahlin schrieb:
Is there a way to break the $.each loops?
I'd like it to be
$.each(object, function() {
break;
});
but it doesen't seem so.
Andreas
___
jQuery
Also, why does a string get returned as an array instead of a string?
I think that's just a firebug thing. It sees that the object has a
length prop and treats it like an array.
But more interesting is that your test did not produce the expected results.
Done a test (requires Firebug - or Firebug lite (which I presume would
also work)).
var foo = [one, 2, three, new Date()];
$.each(foo,
function()
{
if(this === 2) return false;
console.log(typeof this);
}
)
This logs:
[o, n, e]
2
Would you like an Array iterator that works the way you'd
expect? Here is a simple one:
Array.prototype.each = function( yields ) {
for( var i = 0, n = this.length; i n; i++ ) {
if( yields( this[i], i ) === false )
break;
}
};
Klaus Hartl schrieb:
Andreas Wahlin schrieb:
Is there a way to break the $.each loops?
I'd like it to be
$.each(object, function() {
break;
});
but it doesen't seem so.
Andreas
___
jQuery mailing list
discuss@jquery.com
Andreas, if I remember correctly, the following should work:
$.each(object, function() {
return false;
});
That isn't supported. The necessary code was removed due to
unsolved problems. Actually the stuff that Michael just
posted would help a lot to solve it, though I'm not
Michael Geary schrieb:
The code I posted does solve this problem completely - simply use objectEach
instead of $.each, and change your callback function to take explicit
parameters instead of using this.
Using this in an object iterator doesn't make much sense anyway. You need
two arguments
I just took a look at the code for $.each and noticed that is passes two
arguments to the callback, the name/index of the current item and the item
itself (in that order).
Test page: http://aheimlich.freepgs.com/tests/jquery/each-test/
On 1/4/07, Michael Geary [EMAIL PROTECTED] wrote:
Aaron: That's correct and it can be extremely useful in DOM manipulation if
you need to build unique strings based on the object (say, ids).
-- Yehuda
On 1/4/07, Aaron Heimlich [EMAIL PROTECTED] wrote:
I just took a look at the code for $.each and noticed that is passes two
arguments to the
12 matches
Mail list logo