Opened 8 years ago
Closed 7 years ago
#16693 closed feature (fixed)
support for ES5 getters/setters
Reported by: | bill | Owned by: | bill |
---|---|---|---|
Priority: | undecided | Milestone: | 2.0 |
Component: | Dijit | Version: | 1.8.3 |
Keywords: | Cc: | ben hockey, Ed Chatelain | |
Blocked By: | Blocking: |
Description (last modified by )
Ticket to prospectively add support for ES5 getters/setters to Dijit for 2.0, plus doing some preparatory (non backwards-compatibility breaking) work in 1.9.
The preparatory work includes making sure all custom setters store their values by calling this._set(...) instead of directly calling this.foo = bar, since the latter causes an infinite recursion. This is actually leftover work from #11251.
In addition, for getters _getXYZAttr() that reference this.XYZ, possibly add a level of indirection. I think eventually they will access this.props.XYZ instead. Alternately, there's probably some overuse of custom getters, which should be removed [and replaced by custom setters], for example !ValidationTextBox::_getPatternAttr().
Note that it's likely not practical to setup custom setters/getters for every possible attribute. I just checked http://www.w3.org/TR/wai-aria/states_and_properties, there are a lot of aria attributes alone. These attributes could still be handled if passed as arguments to the widget constructor, or specified in markup, by calling the old auto-mapping code in set().
Change History (17)
comment:1 Changed 8 years ago by
Description: | modified (diff) |
---|---|
Milestone: | tbd → 2.0 |
Status: | new → assigned |
comment:7 Changed 8 years ago by
Cc: | ben hockey added |
---|
comment:8 Changed 8 years ago by
[30598] is breaking dojox/mobile/IconContainer. This class extends itself dynamically with the _EditableIconMixin when the editable attribute is true. _EditableIconMixin defines a custom setter _setEditableAttr, which must be called to initialize touch handlers, etc. But, after 30958 and the introduction of _introspect(), the setter is never called. One problem seems to be that _introspect() is called before _EditableIconMixin is added. But I also tried to call again _introspect() (after clearing this.constructor._props), but the setter is still not found...
comment:9 Changed 8 years ago by
Eric added workaround code for dojox/mobile, see #16737. Note that before my change, adding a _setEditableAttr() method to the instance sort-of works, except that _applyAttributes() usually won't automatically call it on creation, even if editable has a non-falsy value (see #7381), because _applyAttributes() collects meta-data about the prototype on its first call.
Dojox/mvc is also getting failures though, see #16738. It's not from a dynamically added _setXYZAttr() method but rather because _atBindingMixin.js directly accesses this.constructor._setterAttrs.
comment:10 Changed 8 years ago by
Cc: | Ed Chatelain added |
---|
comment:12 Changed 8 years ago by
Description: | modified (diff) |
---|
comment:13 Changed 7 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Implemented in our 2.0 prototype, so closing this ticket.
Some changes already checked in for this include [30567] and [30569].