Open fractaledmind opened 8 years ago
Not sure about this. How often do people need to get ALL properties or ALL attributes from an element? It seems like a special case to me, and as you pointed out, it can already be done in 1 line (for attributes just do $$(this.attributes).map(attribute => attribute.name)
). We should be mindful of bloat, otherwise we'll end up with yet another bloated library.
What do others think?
That said, Bliss should be extensible enough to allow third party devs to do this via plugins. We already have a hooks system, though it cannot intercept the return value, so maybe we should work on that.
Lea,
Once again, a great library. Thank you so much for this! :)
I was wondering if you would be amenable to having the functions defined under
$.setProps
be written to work as both "getters" and "setters"? By this I simply mean that if you pass a param to the function (e.g.Bliss.properties(subject, props)
orsubject._.properties(props)
) it functions as a "setter", but if you simply call the function without a param (e.g.Bliss.properties(subject)
orsubject._.properties()
) it functions as a "getter".My initial implementation is fairly rudimentary, but it has worked for the use-cases I have. I am simply checking for the existence of the single param and splitting the functionality into two code paths accordingly. To take
properties
as a simple example:Obviously, not every function in
$.setProps
can have both a "getter" and a "setter", but plenty could. And I think the functionality would be quite helpful (I personally need "getters" forattributes
andproperties
).Once again, thank you for all of your hard work, stephen