devtools/testlib.py
changeset 8978 269548f2306e
parent 8975 045e449617ad
child 9017 aa709bc6b6c1
child 9212 0d346a0a1451
--- a/devtools/testlib.py	Wed May 15 14:22:51 2013 +0200
+++ b/devtools/testlib.py	Wed May 15 16:21:23 2013 +0200
@@ -889,8 +889,12 @@
                     content_type = view.content_type
         if content_type is None:
             content_type = 'text/html'
-        if content_type in ('text/html', 'application/xhtml+xml'):
-            if output and output.startswith('<?xml'):
+        if content_type in ('text/html', 'application/xhtml+xml') and output:
+            if output.startswith('<!DOCTYPE html>'):
+                # only check XML well-formness since HTMLValidator isn't html5
+                # compatible and won't like various other extensions
+                default_validator = htmlparser.XMLSyntaxValidator
+            elif output.startswith('<?xml'):
                 default_validator = htmlparser.DTDValidator
             else:
                 default_validator = htmlparser.HTMLValidator