Switch to defineProperty; set enumerable flags to be consistent with private/public properties#728
Conversation
Currently we use __defineGetter style syntax, but it has [been deprecated](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineGetter?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FObject%2FdefineGetter). This switches us to using defineProperty, which works in every browser we support. (IE9+, any non-ancient version of Firefox, etc.)
This sets it so that the "private" 2D properties (`._x`, `._h` and so on) are non-enumerable, while their associated setter/getters are. Seems to work in Firefox/Chrome/Safari, haven't checked mobile, can't test it in IE.
|
👍 |
|
I was worried that the property flags could decrease the performance, but that is not the case. |
|
Yeah, if anything goes wrong from this it should be pretty catastrophic, so the tests should catch it! :) I guess also check the fiddle example from 722 -- you should see both a green and a red square. (581 looks useful.) |
|
Seems to work fine on Android in the mobile versions of Firefox and Chrome. |
|
@kevinsimper or anyone else check in IE? |
|
I can confirm it works for IE |
|
Thanks! I'll go ahead and merge then. |
Switch to defineProperty; set enumerable flags to be consistent with private/public properties
__defineGetter and company are deprecated; this switches completely to defineProperty, and uses the enumerable flag to fix #722.
I've tested in Firefox, Chrome, and Safari. It still needs testing in IE and mobile browsers.