[Solar-svn] Revision 3144
pmjones at solarphp.com
pmjones at solarphp.com
Sat May 3 15:31:33 CDT 2008
Solar_View_Helper_Attribs: [CHG] Only output attributes that are not blank. Thanks, Clay Loveless.
closes #95
Modified: trunk/Solar/View/Helper/Attribs.php
===================================================================
--- trunk/Solar/View/Helper/Attribs.php 2008-05-03 17:52:45 UTC (rev 3143)
+++ trunk/Solar/View/Helper/Attribs.php 2008-05-03 20:31:33 UTC (rev 3144)
@@ -41,9 +41,13 @@
$val = implode(' ', $val);
}
- // add the attribute
- $xhtml .= ' ' . $this->_view->escape($key)
- . '="' . $this->_view->escape($val) . '"';
+ // add the attribute, but only if really empty.
+ // using the string cast and strict equality to make sure that
+ // a string zero is not counted as an empty value.
+ if ((string) $val === '') {
+ $xhtml .= ' ' . $this->_view->escape($key)
+ . '="' . $this->_view->escape($val) . '"';
+ }
}
// done
More information about the Solar-svn
mailing list