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:
parent
f0b5bfa459
commit
bf817d52f4
3 changed files with 103 additions and 11 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue