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

Commitdadf711

Browse files
author
Mark Pilgrim
committed
added support for validating contenteditable attribute
--HG--extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40974
1 parente5cea2d commitdadf711

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

‎src/html5lib/filters/validator.py‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
_(u"'%(attributeName)s' attribute is not allowed on <input type=%(inputType)s>."),
3838
"deprecated-attribute":
3939
_(u"'%(attributeName)s' attribute is deprecated on <%(tagName)s>."),
40-
"invalid-class-attribute":
41-
_(u"Invalid class attribute value on <%(tagName)s>."),
4240
"duplicate-value-in-token-list":
4341
_(u"Duplicate value '%(attributeValue)s' in token list in '%(attributeName)s' attribute on <%(tagName)s>."),
42+
"invalid-attribute-value":
43+
_(u"Invalid value for '%(attributeName)s' attribute on <%(tagName)s>."),
4444
})
4545

4646
globalAttributes=frozenset(('class','contenteditable','contextmenu','dir',
@@ -317,8 +317,17 @@ def validateAttributeValueClass(self, token, tagName, attrName, attrValue):
317317
fortinself.checkTokenList(tagName,attrName,attrValue)or []:
318318
yieldt
319319
yield {"type":"ParseError",
320-
"data":"invalid-class-attribute",
321-
"datavars": {"tagName":tagName}}
320+
"data":"invalid-attribute-value",
321+
"datavars": {"tagName":tagName,
322+
"attributeName":attrName}}
323+
324+
defvalidateAttributeValueContenteditable(self,token,tagName,attrName,attrValue):
325+
attrValue=attrValue.lower()
326+
ifattrValuenotinfrozenset(('true','false','')):
327+
yield {"type":"ParseError",
328+
"data":"invalid-attribute-value",
329+
"datavars": {"tagName":tagName,
330+
"attributeName":attrName}}
322331

323332
defcheckTokenList(self,tagName,attrName,attrValue):
324333
# The "token" in the method name refers to tokens in an attribute value

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp