diff options
-rw-r--r-- | it_html.class | 2 | ||||
-rwxr-xr-x | tests/it_html.t | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/it_html.class b/it_html.class index 958fe39..5632b78 100644 --- a/it_html.class +++ b/it_html.class @@ -383,6 +383,7 @@ function sanitize($html) { # Simple tags with content, no attributes kept list($head, $tagname, $content, $tail) = $tag; + $tagname = strtolower($tagname); $result .= it_html::sanitize($head) . "<$tagname>" . it_html::sanitize($content) . "</$tagname>" . it_html::sanitize($tail); } else if ($tag = it::match('(.*)<a[^>]+?href="(' . $urlpattern . ')"[^>]*?>(.*?)</a>(.*)', $html)) @@ -401,6 +402,7 @@ function sanitize($html) { # Simple tags without content, no attributes kept list($head, $tagname, $tail) = $tag; + $tagname = strtolower($tagname); $result .= it_html::sanitize($head) . "<$tagname />" . it_html::sanitize($tail); } else diff --git a/tests/it_html.t b/tests/it_html.t index cd934be..e87df48 100755 --- a/tests/it_html.t +++ b/tests/it_html.t @@ -81,9 +81,9 @@ is( ); is( - it_html::sanitize(' <p><a href="http://www.flickr.com/people/swisspics/">swisspics</a> posted < < ä & yesterday <b>a <i>photo</i></b> <b><i>tag missmatch</b></i>:</p><br><br /> + it_html::sanitize(' <p><a href="http://www.flickr.com/people/swisspics/">swisspics</a> posted < < ä & yesterday <b>a <i>photo</i></b> <b><i>tag missmatch</b></i>:</p><br><BR /> -<p><a href="javascript:window.close()" title="Wolken"><img src="http://farm1.static.flickr.com/177/377214376_bcba167a7d_m.jpg" width="240" height="180" alt="Wolken" style="border: 1px solid #ddd;" /></a></p> +<P><a href="javascript:window.close()" title="Wolken"><img src="http://farm1.static.flickr.com/177/377214376_bcba167a7d_m.jpg" width="240" height="180" alt="Wolken" style="border: 1px solid #ddd;" /></a></p> '), ' <a href="http://www.flickr.com/people/swisspics/">swisspics</a> posted < < ä & yesterday a <i>photo</i> <i>tag missmatch</i>:<br /><br /> <p><img src="http://farm1.static.flickr.com/177/377214376_bcba167a7d_m.jpg" alt="" /></p> ', 'it_html::sanitize tag soup' |