PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_CSS » Bug #725

differs hierarchy elements with difference in spaces between

Details

Submitted2004-02-10 14:00 UTC
Frommaka3d at yahoo dot com dot br
Assignedthesaur
StatusClosed
PackageHTML_CSS
PHP VersionIrrelevant
OSirrelevant
Roadmaps(Not assigned)

Comments

[2004-02-10 14:00 UTC] maka3d at yahoo dot com dot br

Description:
------------
body td /* 3 spaces between body td */
is different from
body td /* 1 space between body td */
patch:
at line 356 on CSS.php change that line for this:
$this->_css[$this->collapseInternalSpaces(trim($element))][$this->collapseInternalSpaces(trim($property))]= $this->collapseInternalSpaces(trim($value));

and add this method at end of class:

function collapseInternalSpaces($subject){
return preg_replace("/\s+/", " ", $subject);
}

Reproduce code:
---------------
$strcss = " body td { /* 3 spaces between body and td */
margin: 20px;
padding: 20px;
border: 0;
color: #444;
}";
require_once 'HTML/CSS.php';
$css = & new HTML_CSS();
$css->parseString($strcss);
dump($css);
$css->setStyle('body td ','margin',0);
echo '<pre>';
echo $css->toString();

Expected result:
----------------
setStyle should change the body td not add an other one

Actual result:
--------------
add an other body td tag.

[2004-02-25 16:24 UTC] thesaur at php dot net

Thank you for noticing this. I will fix it as soon as I can.

[2004-03-24 21:21 UTC] thesaur at php dot net

This has been fixed in CVS. It will be included in the next release.

Thank you for alerting me to this issue. If this does not sufficiently address the problem, please let me know.