Let's make sure we understand the problem.  It is always tempting to add
more things to the base classes, but IMO we have to keep in mind that we
want to use PAYG as much as possible, and use composition more than
subclassing.

At the lowest level, the Basic set isn't being designed for folks doing a
lot of runtime changing of the set of classNames. I'd even state that in
most applications, most components won't have their className set change
at runtime, only a small subset will.  So, IMO, it would not be PAYG to
have UIBase pick up functionality for runtime manipulation of the set of
classNames.

So, for simple apps using the Basic set, the component developer can
specify a set of "internal" classNames via typeNames and the app developer
can specify others via classNames and we merge and we're done and don't
worry too much about manipulation of the list of internal classNames at
runtime.

I guess MDL and some other sets do want to manipulate that set of
classNames at runtime.  According to [1], the order is irrelevant, so we
simply need a way to manipulate a space-delimited list of strings.  I
believe there are other space and comma delimited lists in CSS, so one
option is to create a generic Utils class that can add and remove things
from a list.  Some component sets could bake in that Utils class.  That
would be PAYG and Composition-based.

As an alternative, CSS has that classList property.  It seems like you
could manipulate that list based on the APIs in your component.  Is that
not true?  For example, when className is set, isn't it a standard problem
of comparing two lists (the current set of _classNames and the proposed
list, finding adds and removes and then calling the classList API.  Then
the className can be freely set by the app-developer and not affect what
the component developer set.

Or am I missing something?  Do we have a component that we can use as an
example so we can work with real code?

Thanks,
-Alex

[1] 
http://stackoverflow.com/questions/1321692/how-to-specifiy-the-order-of-css
-classes

Reply via email to