[FLOW3-general] Feature in TagBuilder
Adrian Föder
afoeder at live.de
Thu Oct 13 13:00:33 CEST 2011
Hi list,
I of course like the current implementation of the TagBuilder very much;
I ever liked to built something like that on my own.
I would like to come up with an improvement that I think makes sense;
it's about the "addAttribute" thing.
Currently, the attributes are "just" an array with attribute names as
keys and their values as... values.
In HTML, sometimes it comes to "collections" inside attributes, I think
especially about "class" and "style". Multiple class names resp. style
directives are allowed inside a class/style attribute.
This circumstance is also taken into account when it comes to the W3C
element selector "[att~=val]"
http://www.w3.org/TR/css3-selectors/#attribute-selectors
My thought now is, that it would be nice to make attributes configurable
to hold collections, with a per-attribute definable separator (that
would be [space] on "class", and [;] on "style".
So if you
->addAttribute('class', 'btn')
and there's already an attribute "class" present, and it's configured to
hold collections, that value is appended to the existing value.
same goes to ->removeAttribute; in this case there has some RegEx magic
to be happen in the background.
To avoid problems and make verbs less ambiguous, we could introduce
->setAttribute()
, which definately overrides any present values.
"What do you think"?
Best,
Adrian
More information about the FLOW3-general
mailing list