Ariel forget it, I posted a silly code since in that way of course I am
redefining undefined variable, while null is not redefinable :-)

if (!Object.prototype[key])

I am thinking if

var o = {}, key;
and in the loop
if (!(key in o)) ...

should work faster ... or maybe not ?


On Fri, Oct 3, 2008 at 6:36 PM, Ariel Flesler <[EMAIL PROTECTED]> wrote:

> Indeed. undefined works, null doesn't.
>
> On Fri, Oct 3, 2008 at 2:30 PM, Andrea Giammarchi <
> [EMAIL PROTECTED]> wrote:
>
>> Will it speed up?
>>
>> Object.tainted = function(){
>>     for(undefined in{})
>>         return    true;
>>     return    false;
>> };
>>
>>
>>
>> On Fri, Oct 3, 2008 at 6:27 PM, Ariel Flesler <[EMAIL PROTECTED]> wrote:
>>
>>> Yeah, I think the same. I think the env is tainted if you ADD a new
>>> method. Of course modifying String.prototype.split would also taint it but I
>>> don't think anyone will do that w/o making it backwards compatible to the
>>> native method.
>>>
>>> The main concern, I think, is perfomance. I'd like to see some benchmarks
>>> (can't get into that myself right now).
>>> If someone wants my benchmarker, feel free to use.
>>>
>>> As a small note, I'd save Object.prototype into a local var inside
>>> jQuery's scope. That should boost the speed a bit.
>>> It's [local var] vs [global var + attribute] on each iteration.
>>>
>>> On Fri, Oct 3, 2008 at 2:08 PM, John Resig <[EMAIL PROTECTED]> wrote:
>>>
>>>>
>>>> > alert(Object.tainted()); // false
>>>> > alert({}); // wof wof
>>>>
>>>> I think we're ok with that case - since we only want to prevent jQuery
>>>> from breaking when the Object.prototype is manipulated (diddling with
>>>> the Object.prototype.toString method would be weird, but it wouldn't
>>>> affect how jQuery works, I wouldn't think).
>>>>
>>>> --John
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Ariel Flesler
>>> http://flesler.blogspot.com
>>>
>>>
>>>
>>
>>
>>
>
>
> --
> Ariel Flesler
> http://flesler.blogspot.com
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to