-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Attribute Wishlist
This is a grab-bag of things that would be nice to have in Y.Attribute
.
-
Value filters. (Detailed proposal here) It would be a huge boon to the security of the library if Attribute supported pluggable filters that could be run when a string value is retrieved. For example, to get a raw value:
.get('foo')
. To get an HTML-escaped value:.get('foo:html')
. To get a URL-encoded value:.get('foo:url')
. -
Coalesced change events. A call to
setAttrs()
that changes multiple attributes should fire a single coalesced change event in addition to the individual change events. This is currently implemented inY.Model
. Ticket #2530248 -
Better support for sub-attribute getters. Currently, getters are required to return an entire object even when triggered by a sub-attribute retrieval like
.get('foo.bar.baz')
. This is inefficient and can be confusing. -
set()
andsetAttr()
should support an options object. The internal_setAttr()
method supports anoptions
object as its third parameter, and mixes it into the event facade of the change event. This is very useful (it's used inModel
andModelList
), but the publicset()
andsetAttrs()
methods don't currently support theoptions
param.
2