[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)
On Sep 21, 4:40 pm, Yaffle vic99...@yandex.ru wrote: base2.js uses prefix for it's Map Class Yes, but it uses a 1 char string - '#' - so the chance of collisions is still high (imo). [...] -- kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)
kangax, there are no collisions if everything is prefixed like Yaffle suggests. Allen Madsen http://www.allenmadsen.com On Tue, Sep 22, 2009 at 8:03 AM, kangax kan...@gmail.com wrote: On Sep 21, 4:40 pm, Yaffle vic99...@yandex.ru wrote: base2.js uses prefix for it's Map Class Yes, but it uses a 1 char string - '#' - so the chance of collisions is still high (imo). [...] -- kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)
base2.js uses prefix for it's Map Class On 14 сен, 19:53, Yaffle vic99...@yandex.ru wrote: Sorry, I'm not following again :) What's not necessary? Which requests will be more expensive? May be, for-in loop will iterate a little more ... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)
There is an issue with Hash#toObject method... I think, Ajax.Base#parameters can be Hash instead of object to avoid call to Hash#toObject... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)
On Sep 14, 6:18 am, Tobie Langel tobie.lan...@gmail.com wrote: Sorry, I'm not following. How does prefixing a key avoid object creation? We can't inject stuff directly onto a hash instance. We still need an object for that. Not necessarily. Though that might make some requests more expensive. Sorry, I'm not following again :) What's not necessary? Which requests will be more expensive? -- kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)
++IE dontEnum bug =) var h = $H({}); h.set('toString',1); alert(h.toJSON()); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)
On Sep 13, 9:32 am, Yaffle vic99...@yandex.ru wrote: var h = $H({}); h.set('__proto__','sadfdsf'); alert( typeof( h.get('__proto__') )); That's a known limitation, actually (although, probably not documented anywhere). There's no key coercion in Prototype's Hash implementation, which is why setting `__proto__` actually mutates [[Prototype]] of an object that hash uses internally to store its values (btw, in Mozilla `__proto__` can only be set once, contrary to, say, WebKit). Also try these: alert(Object.toQueryString('hasOwnProperty=1'.toQueryParams())); // hasOwnProperty=function%20()%20%7B%20%5Bnative%20code%5D %20%7DhasOwnProperty=1 May be Object.prototype.hasOwnProperty.call(hash,key) should be used instead of 'key in hash' operator? We didn't use `hasOwnProperty` since it was missing in Safari 2.0.4 (which we supported back then). Now that support for Safari 2.0.4 is dropped, I still wouldn't use `hasOwnProperty`, as it's not as reliable as it seems. For example, that same __proto__ is being reported as *own* property of an object in Mozilla and will still mess things up. There could also be other non-standard magic properties with unknown behavior. String coercion usually avoids this problem, albeit in expense of slight performance decrease. Also take a look at this related discussion - http://groups.google.com/group/comp.lang.javascript/msg/f24941a8738be30d -- kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)
You're right, `hasOwnProperty` can be useless, and `propertyIsEnumerable` is useless becauseof dontEnum IE bug... Why not to patch Hash to use some prefix for keys? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)
Why not to patch Hash to use some prefix for keys? That was my plan for 1.7, actually. It fixes that issue and also avoids creating an extra, internal object. Good to see that we're on the same page, here. Tobie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---
[Prototype-core] Re: $H({}).get('__proto__') in Firefox =)
On Sep 13, 6:38 pm, Tobie Langel tobie.lan...@gmail.com wrote: Why not to patch Hash to use some prefix for keys? That was my plan for 1.7, actually. It fixes that issue and also avoids creating an extra, internal object. Sorry, I'm not following. How does prefixing a key avoid object creation? We can't inject stuff directly onto a hash instance. We still need an object for that. [...] -- kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype: Core group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~--~~~~--~~--~--~---