|
60 | 60 | _(u"Invalid language code: '%(attributeName)s' attibute on <%(tagName)s>."),
|
61 | 61 | "invalid-integer-value":
|
62 | 62 | _(u"Value must be an integer: '%(attributeName)s' attribute on <%tagName)s>."),
|
| 63 | + "invalid-root-namespace": |
| 64 | + _(u"Root namespace must be 'http://www.w3.org/1999/xhtml', or omitted."), |
63 | 65 | })
|
64 | 66 |
|
65 | 67 | globalAttributes = frozenset(('class', 'contenteditable', 'contextmenu', 'dir',
|
|
71 | 73 | 'onmousedown', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup',
|
72 | 74 | 'onmousewheel', 'onresize', 'onscroll', 'onselect', 'onsubmit', 'onunload'))
|
73 | 75 | # XXX lang in HTML only, xml:lang in XHTML only
|
| 76 | +# XXX validate ref, template |
74 | 77 |
|
75 | 78 | allowedAttributeMap = {
|
76 | 79 | 'html': frozenset(('xmlns',)),
|
@@ -399,6 +402,13 @@ def validateAttributeValueId(self, token, tagName, attrName, attrValue):
|
399 | 402 | def validateAttributeValueTabindex(self, token, tagName, attrName, attrValue):
|
400 | 403 | for t in self.checkIntegerValue(token, tagName, attrName, attrValue) or []: yield t
|
401 | 404 |
|
| 405 | + def validateAttributeValueHtmlXmlns(self, token, tagName, attrName, attrValue): |
| 406 | + if attrValue != "http://www.w3.org/1999/xhtml": |
| 407 | + yield {"type": "ParseError", |
| 408 | + "data": "invalid-root-namespace", |
| 409 | + "datavars": {"tagName": tagName, |
| 410 | + "attributeName": attrName}} |
| 411 | + |
402 | 412 | ##########################################################################
|
403 | 413 | # Attribute validation helpers
|
404 | 414 | ##########################################################################
|
|
0 commit comments