Loading ...
Sorry, an error occurred while loading the content.

2108Re: [jslint] Re: infix_in warnings

Expand Messages
  • Luke Page
    Apr 5, 2011
    • 0 Attachment
      It might help if you explain why you *want* to follow the inheritance chain
      and also whether you mind if your script is included on a page where another
      script (inadvertently) adds something to a base class..


      On 5 April 2011 13:23, John Hawkinson <jhawk@...> wrote:

      >
      >
      > Again, I *want* to follow the inheritance chain,
      > not to specifically disregard it:
      >
      > function object(o) { function F() {} F.prototype = o; return new F(); };
      > var o1 = { alpha: 1 };
      > var o2 = object(o1);
      > ...
      > if ('alpha' in o2) { ...
      >
      > Sorry if this language was unclear:
      >
      > > > Any thoughts on the appropriate workaround for infix_in warnings
      > > > without using .hasOwnProperty() which doesn't follow the inheritance
      > > > chain?
      >
      > > The in operator should have been the hasOwnProperty operator.
      > hasOwnProperty
      > > should have been an operator, not a method, because
      > > being a method, it is prone to these sorts of problems. But it is
      > > what it is, so you have to work around that.
      >
      > Am I on a fool's errand? Should I be throwing out the ability of objects
      > to inherit and assume that any property inheritance is an error?
      > I feel like that's not the right assumption?
      >
      >
      > --jhawk@...
      > John Hawkinson
      >
      >
      >


      [Non-text portions of this message have been removed]
    • Show all 6 messages in this topic