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

Commit9e7dc96

Browse files
author
Mark Pilgrim
committed
added support for validating <base target> attribute
--HG--extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40986
1 parentd11eff2 commit9e7dc96

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

‎src/html5lib/filters/validator.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
_(u"Value must be an integer: '%(attributeName)s' attribute on <%tagName)s>."),
6363
"invalid-root-namespace":
6464
_(u"Root namespace must be 'http://www.w3.org/1999/xhtml', or omitted."),
65+
"invalid-browsing-context":
66+
_(u"Value must be one of ('_self', '_parent', '_top'), or a name that does not start with '_': '%(attributeName)s' attribute on <%(tagName)s>."),
6567
})
6668

6769
globalAttributes=frozenset(('class','contenteditable','contextmenu','dir',
@@ -402,13 +404,28 @@ def validateAttributeValueId(self, token, tagName, attrName, attrValue):
402404
defvalidateAttributeValueTabindex(self,token,tagName,attrName,attrValue):
403405
fortinself.checkIntegerValue(token,tagName,attrName,attrValue)or []:yieldt
404406

407+
defvalidateAttributeValueRef(self,token,tagName,attrName,attrValue):
408+
# XXX
409+
pass
410+
411+
defvalidateAttributeValueTemplate(self,token,tagName,attrName,attrValue):
412+
# XXX
413+
pass
414+
405415
defvalidateAttributeValueHtmlXmlns(self,token,tagName,attrName,attrValue):
406416
ifattrValue!="http://www.w3.org/1999/xhtml":
407417
yield {"type":"ParseError",
408418
"data":"invalid-root-namespace",
409419
"datavars": {"tagName":tagName,
410420
"attributeName":attrName}}
411421

422+
defvalidateAttributeValueBaseHref(self,token,tagName,attrName,attrValue):
423+
# XXX
424+
pass
425+
426+
defvalidateAttributeValueBaseTarget(self,token,tagName,attrName,attrValue):
427+
fortinself.checkBrowsingContext(token,tagName,attrName,attrValue)or []:yieldt
428+
412429
##########################################################################
413430
# Attribute validation helpers
414431
##########################################################################
@@ -525,6 +542,16 @@ def checkIntegerValue(self, token, tagName, attrName, attrValue):
525542
"datavars": {"tagName":tagName,
526543
"attributeName":attrName}}
527544

545+
defcheckBrowsingContext(self,token,tagName,attrName,attrValue):
546+
ifnotattrValue:return
547+
ifattrValue[0]!='_':return
548+
attrValue=attrValue.lower()
549+
ifattrValueinfrozenset(('_self','_parent','_top','_blank')):return
550+
yield {"type":"ParseError",
551+
"data":"invalid-browsing-context",
552+
"datavars": {"tagName":tagName,
553+
"attributeName":attrName}}
554+
528555
##########################################################################
529556
# Whole document validation (IDs, etc.)
530557
##########################################################################

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp