click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Schellink <sab...@gmail.com>
Subject Control Attribute enhancements
Date Sat, 10 Jul 2010 06:51:39 GMT
I think we have a chance to improve performance in the AbstractControl (AC) implementation.
AC
provides the following API:

getAttributes
getAttribute
setAttribute
hasAttributes
addCssClass
removeCssClass
hasStyles (deprecated for now)
setStyle
getStyle
getStyles (deprecated for now)

This API is all about manipulating the HTML attributes of a Control. The API is optimized
for
setAttribute/getAttribute but not for "class" and "style" attributes which are both String
based.

I'm thinking we can create an Attributes class that encapsulates this API and have some smarts
on
handling "class" and "style" attributes as a Set and Map instead. The Attributes class needs
to be
smart enough to handle edge cases such as 'setAttribute("class", "blue red");' and getAttributes()
which will return *all* attributes including "style" and "class".

I've done some performance tests in the past[1] and have settled on the String based approach
simply
because I thought set/getAttributes would be more common for "class" and "style" manipulation.
However with CSS3 and JS libs its quite common to have multiple css classes per control so
I think
this change will generally have a positive performance improvement.

Anyone got time to implement something like this? Otherwise I'll attempt it after the next
release.

Bob

[1]: https://issues.apache.org/jira/browse/CLK-249

Mime
View raw message