[jquery-dev] Re: detecting jQuery objects && "constructor" property

2009-09-22 Thread Mickael DANIEL
Sure, I agree that Andrea's solution is far better. I'll even update the method I use to works with the instanceof way. On Sep 21, 7:44 pm, aHeckman wrote: > Mickael, I'd use Andrea's solution instead for the same reasons: any > object could have an .is() method. > > On Sep 19, 5:16 am, Mickael

[jquery-dev] Re: detecting jQuery objects && "constructor" property

2009-09-21 Thread aHeckman
Mickael, I'd use Andrea's solution instead for the same reasons: any object could have an .is() method. On Sep 19, 5:16 am, Mickael DANIEL wrote: > Hello there, > > In my current project, I have a similar need to detect if a variable > is a jQuery object or not. > > I finaly decided to add a $.i

[jquery-dev] Re: detecting jQuery objects && "constructor" property

2009-09-19 Thread Mickael DANIEL
Hello there, In my current project, I have a similar need to detect if a variable is a jQuery object or not. I finaly decided to add a $.isJQuery() method to jQuery namespace that could acts like a regular $.isArray or $.isFunction. Not sure, this is the best way to do this but I used something

[jquery-dev] Re: detecting jQuery objects && "constructor" property

2009-09-17 Thread Andrea Giammarchi
On Thu, Sep 17, 2009 at 7:04 PM, Nico wrote: > > Would it be possible to add something so we could get a true with this > example : > > $([]).constructor === jQuery > > if you rely in such example, your solution is then: if($([]) instanceof jQuery){ // jQuery stuff } which is true as long a

[jquery-dev] Re: detecting jQuery objects && "constructor" property

2009-09-17 Thread Robert Katić
if ( obj.jquery ) //obj is an jQuery object jquery property gives the jQuery version, that is always an non empty string On Sep 18, 1:50 am, lrbabe wrote: > mmmh... overwriting the constructor property doesn't sound like a > great idea to me. > What about all the code that has been written b

[jquery-dev] Re: detecting jQuery objects && "constructor" property

2009-09-17 Thread lrbabe
mmmh... overwriting the constructor property doesn't sound like a great idea to me. What about all the code that has been written by developers expecting the constructor to be what it is supposed to be: Object You could use other particular properties of any jQuery object: they are not arrays but