Although I am not github-ing jQuery or its tests , this might help :
http://dbj.org/4/test/objlrl.htm
Here I also cater for IE, where dom methods are object-s ...
This also works on Opera 5 Mini (Symbian)
PS: I do not see that Robert solution fails on empty function? aka :
function () { }
http://github.com/jquery/jquery/commit/c2bbcd88335cf6f8df4ac9389ecbae90291377fb
contains this version of isObject (changed by me to work as a stand-
alone ) :
isObject = function( obj )
{
if ( Object.prototype.toString.call(obj) !== [object Object] ) {
return false;
}
//own
PS: I do not see that Robert solution fails on empty function? aka :
function () { }
I think no one said that. I said that classes with no methods
(prototype with no properties) are not supported by my solution.
var Class = function(){};
var obj = new Class();
isObject( obj ) // true!
I agree that the current isObject has to be renamed to avoid
confusion.
But we don't need any isObject using Object.prototype.toString.call
anywhere in the code...
This could be included in any plugin, where required.
On Nov 10, 9:28 pm, DBJDBJ dbj...@gmail.com wrote:
All is ok then ?
It doesn't seem to be in 1.3.2
There isn't probably much code relying on it out there, since it has
always been broken.
On Nov 10, 11:10 pm, DBJDBJ dbj...@gmail.com wrote:
Probably. But it is certainly not my idea ;) I mean there it is, for
last several releases
It is maybe that it is
By the way, if we use the code of isObjectLiteral only once, it
doesn't have to be a function either.
The less function call, the better.
On Nov 10, 11:19 pm, lrbabe lrb...@gmail.com wrote:
It doesn't seem to be in 1.3.2
There isn't probably much code relying on it out there, since it has
I noted that a test involves an myKlass with no methods.
My solution of isObject will not pass that test.
In isObjectLiteral gist there is no such test case, so I supposed that
that case is negligible for reason:
normally an class have methods, and detecting empty prototypes would
complicate
Maybe something like http://gist.github.com/229188 would be enough.
On Nov 7, 12:57 am, John Resig jere...@gmail.com wrote:
Yehuda was working through that code and didn't get a chance to finish
it up. Yehuda, any thoughts?
--John
On Sat, Nov 7, 2009 at 12:05 AM, lrbabe lrb...@gmail.com
It's actually not clear where the problem lies, I'll test your code.
On Nov 8, 10:31 am, Robert Katić robert.ka...@gmail.com wrote:
Maybe something likehttp://gist.github.com/229188would be enough.
On Nov 7, 12:57 am, John Resig jere...@gmail.com wrote:
Yehuda was working through that code
Native functions in IE is not handled correctly by isFunction either,
but it was decided that that cases are not significant...
On Nov 8, 12:23 pm, DBJDBJ dbj...@gmail.com wrote:
This version of isObject, in IE returns true, when tested with
window.alert ...
--DBJ
--
You received this
Right now the:
return /^function Object/.test( obj.constructor );
solution works the best but it doesn't work in Opera Mini (which
doesn't have function decompilation) - nor is it particularly fast.
constructor property is often changed.
I hope you want isObject(jQuery()) == false.
--
You
constructor property is often changed.
I hope you want isObject(jQuery()) == false.
Yep, and that'll work as we expect it to. The one case where it won't
is if you do obj.constructor = Object;
If anyone thinks of an alternative solution please feel free to modify
the gist and put your code up
/^function Object/.test( jQuery().constructor ) == true
You don't need to explicitly set constructor to change it.
Redefining prototype, constructor is automatically altered (==Object).
On Nov 8, 2:13 pm, John Resig jere...@gmail.com wrote:
constructor property is often changed.
I hope you
http://gist.github.com/229254
On Nov 8, 2:13 pm, John Resig jere...@gmail.com wrote:
constructor property is often changed.
I hope you want isObject(jQuery()) == false.
Yep, and that'll work as we expect it to. The one case where it won't
is if you do obj.constructor = Object;
If anyone
I thing so, but not sure 100%. This seam a good task for TestSwarms.
On Nov 8, 4:38 pm, John Resig jere...@gmail.com wrote:
http://gist.github.com/229254
Does this handle all the tests on that page? and in IE 6/7/8 as well?
If so, let's land it.
--John
--
You received this message
http://browsershots.org/http://bender.fesb.hr/~robert/scripts/isObjectLiteral.html
Let's see...
On Nov 8, 4:42 pm, Robert Katić robert.ka...@gmail.com wrote:
I thing so, but not sure 100%. This seam a good task for TestSwarms.
On Nov 8, 4:38 pm, John Resig jere...@gmail.com wrote:
I thing so, but not sure 100%. This seam a good task for TestSwarms.
Well, we can do that eventually - but in the short term: Does it work on IE?
--John
--
You received this message because you are subscribed to the Google Groups
jQuery Development group.
To post to this group, send email to
Yes, it passes all these tests.
On Nov 8, 4:57 pm, John Resig jere...@gmail.com wrote:
I thing so, but not sure 100%. This seam a good task for TestSwarms.
Well, we can do that eventually - but in the short term: Does it work on IE?
--John
--
You received this message because you are
Nice! Just make a bug and link to your commit on your Github fork and
I'll land it (also, be sure to get the spacing right - and be sure to
use {} braces and ===).
--John
On Sun, Nov 8, 2009 at 5:19 PM, Robert Katić robert.ka...@gmail.com wrote:
Yes, it passes all these tests.
On Nov 8,
http://dev.jquery.com/ticket/5474
On Nov 8, 2:13 pm, John Resig jere...@gmail.com wrote:
constructor property is often changed.
I hope you want isObject(jQuery()) == false.
Yep, and that'll work as we expect it to. The one case where it won't
is if you do obj.constructor = Object;
If
For IE, isObject(), is perhaps not that trivial ... DBJ
--
You received this message because you are subscribed to the Google Groups
jQuery Development group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to
21 matches
Mail list logo