function getDefiningObject(obj, key) {
    if (!(key in obj))
        throw new Error("key " + key + " not found");
    while (!obj.hasOwnProperty(key))
        obj = Object.getPrototypeOf(obj);
    return obj;
}

On Apr 10, 2011, at 10:24 AM, Axel Rauschmayer wrote:

> As far as I am aware, there is no way to change a property that isn’t at the 
> beginning of the property chain, because the change will create a new 
> property there.
> 
> Are there plans to change this? It would be nice to have something akin to 
> class methods (without accessing the prototype via some other, e.g. global, 
> reference).
> 
> -- 
> Dr. Axel Rauschmayer
> 
> a...@rauschma.de
> twitter.com/rauschma
> 
> home: rauschma.de
> blog: 2ality.com
> 
> 
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to