Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd11eff2

Browse files
author
Mark Pilgrim
committed
added support for validating <html xmlns> attribute
--HG--extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40985
1 parentd559d9e commitd11eff2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎src/html5lib/filters/validator.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
_(u"Invalid language code: '%(attributeName)s' attibute on <%(tagName)s>."),
6161
"invalid-integer-value":
6262
_(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."),
6365
})
6466

6567
globalAttributes=frozenset(('class','contenteditable','contextmenu','dir',
@@ -71,6 +73,7 @@
7173
'onmousedown','onmousemove','onmouseout','onmouseover','onmouseup',
7274
'onmousewheel','onresize','onscroll','onselect','onsubmit','onunload'))
7375
# XXX lang in HTML only, xml:lang in XHTML only
76+
# XXX validate ref, template
7477

7578
allowedAttributeMap= {
7679
'html':frozenset(('xmlns',)),
@@ -399,6 +402,13 @@ def validateAttributeValueId(self, token, tagName, attrName, attrValue):
399402
defvalidateAttributeValueTabindex(self,token,tagName,attrName,attrValue):
400403
fortinself.checkIntegerValue(token,tagName,attrName,attrValue)or []:yieldt
401404

405+
defvalidateAttributeValueHtmlXmlns(self,token,tagName,attrName,attrValue):
406+
ifattrValue!="http://www.w3.org/1999/xhtml":
407+
yield {"type":"ParseError",
408+
"data":"invalid-root-namespace",
409+
"datavars": {"tagName":tagName,
410+
"attributeName":attrName}}
411+
402412
##########################################################################
403413
# Attribute validation helpers
404414
##########################################################################

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp