Closed ntninja closed 9 years ago
I'm having trouble seeing how this would be used and how we could properly document it. Plus we're not fond of adding features that only work on certain browsers, particularly if the user has to do a capability check in their own code before they know whether it's safe to use that feature.
Feel free to re-open this if I've misunderstood any of the above.
If I (as a developer) create an object utilizing properties, then I will either (hopefully) know that my code won't be able to run on older browser versions (particularly IE<9) at all (whether prototype supports it or not is not relevant in this case) or I won't care. Where prototype's support does matter is when I've made the decision for this compatibility trade-off (to not support IE<9), but want to use prototype's Class.create
to manage my (property-enabled) classes.
About communicating this to library users: I think this change hardly deserves more than a changelog footnote; if a browsers properly supports properties, so will prototype, if it doesn't, then prototype won't either.
PS: I can't reopen
Important: Dynamic property support only works with IE>=9! That however is not a problem because prototype will fall back to static property copying on older versions. IE8 has limited support for dynamic properties but only if the element is an instance of a DOM element and if a very specifc configuration is used (http://msdn.microsoft.com/en-us/library/dd229916%28VS.85%29.aspx). Since the IE8 support is not something that works in real-life I decided to add a IS_DEFPROP_BUGGY check that only passes on browsers with full support, before enabling this feature.
A unit test has been added that demonstrates how this feature can be used, note however that the unit test only uses the
Object.defineProperty
syntax and not the nativeget x() {...}
/set x(y) {...}
syntax since that would cause syntax errors in browsers that do not understand it.