diff --git a/PureHTMLDefinition.php b/PureHTMLDefinition.php
index 10365898..1710981a 100644
--- a/PureHTMLDefinition.php
+++ b/PureHTMLDefinition.php
@@ -155,7 +155,12 @@ class PureHTMLDefinition
function makeWellFormed($tokens) {
if (empty($this->info)) $this->loadData();
-
+ $result = array();
+ $current_nesting = array();
+ foreach ($tokens as $token) {
+ if (!is_subclass_of($token, 'MF_Tag')) $result[] = $token;
+ // test if it claims to be a start tag but is empty
+ }
}
function fixNesting($tokens) {
@@ -170,4 +175,44 @@ class PureHTMLDefinition
}
+class HTMLDTD_Element
+{
+
+ var $child_def;
+ var $attr_def = array();
+
+
+}
+
+class HTMLDTD_ChildDef {
+ var $dtd_regex;
+ function HTMLDTD_ChildDef($dtd_regex) {
+ $this->dtd_regex = $dtd_regex;
+ }
+ function validateChildren($tokens_of_children) {}
+}
+class HTMLDTD_ChildDef_Simple extends HTMLDTD_ChildDef {
+ var $elements = array();
+ function HTMLDTD_ChildDef_Simple($elements) {
+ $this->elements = $elements;
+ }
+}
+class HTMLDTD_ChildDef_Required extends HTMLDTD_ChildDef_Simple {
+ function validateChildren($tokens_of_children) {
+
+ }
+}
+class HTMLDTD_ChildDef_Optional extends HTMLDTD_ChildDef_Simple {
+ function validateChildren($tokens_of_children) {
+
+ }
+}
+
+class HTMLDTD_AttrDef {
+ var $def;
+ function HTMLDTD_AttrDef($def) {
+ $this->def = $def;
+ }
+}
+
?>
\ No newline at end of file
diff --git a/tests/PureHTMLDefinition.php b/tests/PureHTMLDefinition.php
index b2048ce1..7b9b35aa 100644
--- a/tests/PureHTMLDefinition.php
+++ b/tests/PureHTMLDefinition.php
@@ -109,6 +109,15 @@ class Test_PureHTMLDefinition extends UnitTestCase
,new MF_Text('')
);
+ $inputs[5] = array(new MF_StartTag('br'));
+ $expect[5] = array(new MF_EmptyTag('br'));
+
+ $inputs[6] = array(new MF_EmptyTag('div'));
+ $expect[6] = array(
+ new MF_StartTag('div')
+ ,new MF_EndTag('div')
+ );
+
foreach ($inputs as $i => $input) {
$result = $this->def->removeForeignElements($input);
$this->assertEqual($expect[$i], $result);