HTML class tests

Wrote tests and dropped the ol' XHTML "self-closing" tags. Also fixed a bug with closing tags when no content was present.
This commit is contained in:
Joshua Sherman 2014-01-04 10:15:56 -05:00
parent f0b5bfa459
commit bf817d52f4
3 changed files with 103 additions and 11 deletions

View file

@ -132,19 +132,13 @@ class HTML extends Object
$html .= ' ' . $attribute . '="' . str_replace('"', '\"', $value) . '"';
}
}
else
{
throw new Exception('Attributes must be an array.');
}
}
if ($contents || !in_array($element, $this->self_closing))
$html .= '>';
if (!in_array($element, $this->self_closing))
{
$html .= '>' . $contents . '</' . $element . '>';
}
else
{
$html .= ' />';
$html .= $contents . '</' . $element . '>';
}
return $html;