func5000 - how far does your UA get?
Wednesday, 28. November 2007, 19:01:47
func5000.htm
I'd really like to know if there is a hard-coded limitation or if it depends on system speed and memory, for example. Discussion is open in the comments
the web is a hack
Wednesday, 28. November 2007, 19:01:47
Wednesday, 11. April 2007, 16:43:01
Friday, 9. March 2007, 14:12:59
if ( window == this ) return new jQuery(a,c);
var obj=jQuery()and the this check will detect that it wasn't called as a constructor and call itself recursively, this time using the "new" keyword to define the expected jQuery object.
var obj = jQuery.call(document)would probably break something. I don't know jQuery well enough to tell if that would be a problem, but the check could perhaps be
if(this.constructor!=arguments.callee)to catch all cases?
var username=prompt('Your name please')||'anonymous' will set the variable to "anonymous" if the user cancels the prompt or doesn't type any value.return this.setArray( // HANDLE: $(array) a.constructor == Array && a || // HANDLE: $(arraylike) // Watch for when an array-like object is passed as the selector (a.jquery || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType) && jQuery.makeArray( a ) || // HANDLE: $(*) [ a ] );
a.constructor == Array && aactually "returns" a if the first comparison is true. It is probably better phrased as "evaluates to a" but it may be easier explained as "returns".
(a.jquery || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType) && jQuery.makeArray( a )will go through all the conditions, and if they all hold true return the result of calling the makeArray function.
setArray: function( a ) {
this.length = 0;
[].push.apply( this, a );
return this;
}
var obj = new Object(); /* Yes: an object, not an array. */
var str='';
Array.prototype.push.call(obj, 'Hello');
Array.prototype.push.call(obj, ' World');
for(var i=0;i<obj.length;i++){
str+=obj[i];
}
alert(str);
Wednesday, 7. February 2007, 13:44:18
var a=function b(){return 'Hi'}; alert(b());
setTimeout( function a(){}, 50 ); a();
Monday, 22. January 2007, 14:52:35
function test(){}
test.arguments='something';
test();
alert(test.arguments); // test.arguments is now null ??
function test(){ alert(arguments==test.arguments); }
Function.prototype.arguments=true;
function test(){};
.
. /* function definitions and calls here */
.
var testWasCalled = ! test.arguments;
Thursday, 5. October 2006, 21:35:16
// need to fake someMethod
Element.prototype.someMethod=function(){
// faking someMethod here
}
// we also have an insertBefore problem so let's fix that too
(function(oF){
// tweaking insertBefore here
})(Element.prototype.insertBefore);
Monday, 18. September 2006, 13:36:27
if(img.match(/(.[jJ][pP][eE]?[gG]|.[gG][iI][fF]|.[pP][nN][gG])/)) {
return true;
}
return false;
Thursday, 7. September 2006, 11:51:48
document.body.eval('tagName');
with(document.body){eval('tagName');}
document.body.tagNameor
document.body['tagName']Using eval should be avoided and generally can be avoided without problems. So don't let me catch you using any of the two first snippets on a production site!)
Showing posts 1 - 8 of 11.

xkcd on Firefox