Closed GoogleCodeExporter closed 8 years ago
i think that replace $arr=explode(':',$style); width
$arr=explode(':',$style,2); does the trick.
This can be also a performance problem, there is no need to split and glue
together the style property. If I'm not mistaken there is no way to just add a
value to be rendered as THtmlWriter needs attribute and value to render. i
*think* it would be best to teach THtmlWriter to render the $customStyle from
TStyle without change it, the downside is that now if one set a style using
PRADOs components like color="blue" it replaces the one in the
style="color:blue", this would no longer be the case as both values would be
rendered.
Original comment by uaca...@gmail.com
on 3 Jul 2011 at 11:56
I say Prado shouldn't really care about that. I mean, without a proper and
complete inline CSS parser you won't even be able to warn of possible
duplicates reliable, let alone be able to implement a proper attribute
management, if you allow styles to be set both through string literals and
attribute+value pairs. And running everything though a CSS parser would be a
huge overhead and waste of resources most of the time, since in most cases
developers obviously don't supply/set redundant sets of attributes on
components in the first place.
So I'm rather for minimizing style attribute treatment to the minimum possible,
and let the actual developers sort out their sh.. stuff, in cases where they
supply contradictory/redundant sets of attributes to Prado or to the renderer.
Original comment by google...@pcforum.hu
on 4 Jul 2011 at 1:36
Imho while the $arr=explode(':',$style,2); trick is probably the best way to go
on branch/3.1 to fix the issue while keeping existing code working, while the
behaviour can be changed in trunk.
Since setCustomStyle() always overwrites the old customstyle with the new one,
i see no point in splitting $this->_customStyle and handling duplicates in
THtmlWriter::addStyleAttribute as is done now; additionally, the current
attribute+value parser is easily tricked by css shorthand properties.
We could just add a THtmlWriter::addStyleString and let TStyle pass to it
$this->_customStyle (is any).
The user can use the existing specific style properties (eg setBorderColor) or
the generic StyleField property if he wants to ensure that multiple
declarations of the same style field won't produce a multiple rendering of that
css attribute.
Comments?
Original comment by ctrlal...@gmail.com
on 6 Jul 2011 at 2:31
Applied the $arr=explode(':',$style,2); trick in r3045
Original comment by ctrlal...@gmail.com
on 2 Oct 2011 at 9:29
Original comment by ctrlal...@gmail.com
on 25 Jun 2012 at 1:56
Original comment by ctrlal...@gmail.com
on 21 Jan 2013 at 7:03
Original comment by ctrlal...@gmail.com
on 24 Jul 2013 at 1:46
Moved to github: https://github.com/pradosoft/prado/issues
Original comment by ctrlal...@gmail.com
on 1 Oct 2013 at 10:14
Original issue reported on code.google.com by
uaca...@gmail.com
on 3 Jul 2011 at 11:40