On Wed, Jul 31, 2013 at 11:03 AM, Patrick Tucker <[email protected]>wrote:

> I there any particular reason hasOwnProperty is not in JavaScriptObject?
>

There are a lot of things that would have made sense to put in JSO
originally (or likewise on Js*), but adding it after the fact breaks anyone
who added a method of that name, as they have to be final.

The best we could do is put a static method that you pass in a JSO and the
key.

It is used throughout GWT and from what I have seen the following would be
> the best implementation:
>
>   public native boolean hasOwnProperty(String key) /*-{
>     // In Firefox, jsObject.hasOwnProperty(key) requires a primitive string
>     key = String(key);
>     return (this.hasOwnProperty(key)) ? true : false;
>   }-*/;
>
> Some of the calls, in GWT, cast the key to a string and some don't.  Seems
> like a standard implementation that is used would be a better plan.
>

I agree a shared implementation rather than multiple copies would be an
improvement.

-- 
John A. Tamplin

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to