On Mar 9, 6:57 am, Jim Higson <j...@wikizzle.org> wrote:
> On Friday 06 March 2009 15:26:49 kangax wrote:
[...]
> > It's possible that we'll introduce a custom `hasOwnProperty` in later
> > revisions.
>
> Makes sense.
> if( !hasOwnProperty )
>     hasOwnProperty = function hasOwnProperty(){ ... };

I was thinking of something like:

var hasOwnProperty = (function(){
  var hop = Object.prototype.hasOwnProperty;
  if (hop) {
    return function(obj, prop) {
      return hop.call(obj, prop);
    }
  }
  return function(obj, prop) {
    if (obj) {
      var c = obj.constructor;
      if (c && c.prototype) {
        return obj[prop] !== c.prototype[prop];
      }
    }
    return null;
  }
})();

This fallback not bullet-proof, but should cover most of the cases.

[...]

--
kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to