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

Commitdf600de

Browse files
author
Mark Pilgrim
committed
added tests for deprecated size attribute on put element
--HG--extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40969
1 parent221b909 commitdf600de

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

‎src/html5lib/filters/validator.py‎

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@
2626

2727
E.update({
2828
"unknown-start-tag":
29-
_(u"Unknown start tag <%(tagName)s'"),
29+
_(u"Unknown start tag <%(tagName)s>."),
3030
"unknown-attribute":
31-
_(u"Unknown '%(attributeName)s' attribute on <%(tagName)s>"),
31+
_(u"Unknown '%(attributeName)s' attribute on <%(tagName)s>."),
3232
"missing-required-attribute":
33-
_(u"Missing required '%(attributeName)s' attribute on <%(tagName)s>"),
33+
_(u"Missing required '%(attributeName)s' attribute on <%(tagName)s>."),
3434
"unknown-input-type":
35-
_(u"Unknown value for input type: '%(inputType)s'"),
35+
_(u"Illegal value for<input type> attribute: '%(inputType)s'."),
3636
"attribute-not-allowed-on-this-input-type":
37-
_(u"'%(attributeName)s' attribute is not allowed on <input type='%(inputType)s'>"),
37+
_(u"'%(attributeName)s' attribute is not allowed on <input type=%(inputType)s>."),
38+
"deprecated-attribute":
39+
_(u"'%(attributeName)s' attribute is deprecated on <%(tagName)s>."),
3840
})
3941

4042
globalAttributes=frozenset(('class','contenteditable','contextmenu','dir',
@@ -130,10 +132,10 @@
130132
'tr':frozenset(()),
131133
'td':frozenset(('colspan','rowspan')),
132134
'th':frozenset(('colspan','rowspan','scope')),
133-
# 'form': frozenset(('action', 'method', 'enctype', 'accept', 'name', 'onsubmit',
134-
# 'onreset', 'accept-charset', 'data', 'replace')),
135135
# all possible <input> attributes are listed here but <input> is really handled separately
136136
'input':frozenset(('accept','accesskey','action','alt','autocomplete','autofocus','checked','disabled','enctype','form','inputmode','list','maxlength','method','min','max','name','pattern','step','readonly','replace','required','size','src','tabindex','target','template','value')),
137+
# 'form': frozenset(('action', 'method', 'enctype', 'accept', 'name', 'onsubmit',
138+
# 'onreset', 'accept-charset', 'data', 'replace')),
137139
# 'button': frozenset(('name', 'value', 'type', 'disabled', 'form', 'autofocus')),
138140
# 'select': frozenset(('name', 'size', 'multiple', 'disabled', 'data', 'accesskey',
139141
# 'form', 'autofocus')),
@@ -160,7 +162,7 @@
160162
'nest':frozenset(()),
161163
'legend':frozenset(()),
162164
'div':frozenset(()),
163-
'font':frozenset(('style',)),
165+
'font':frozenset(('style',))
164166
}
165167

166168
requiredAttributeMap= {
@@ -171,7 +173,7 @@
171173
'object':frozenset(()),# XXX one of 'data' or 'type' is required
172174
'param':frozenset(('name','value')),
173175
'source':frozenset(('src',)),
174-
'map':frozenset(('id',)),
176+
'map':frozenset(('id',))
175177
}
176178

177179
inputTypeAllowedAttributeMap= {
@@ -198,7 +200,12 @@
198200
'number':frozenset(('accesskey','autocomplete','autofocus','disabled','form','list','min','max','name','step','readonly','required','tabindex','value')),
199201
'range':frozenset(('accesskey','autocomplete','autofocus','disabled','form','list','min','max','name','step','readonly','required','tabindex','value')),
200202
'email':frozenset(('accesskey','autocomplete','autofocus','disabled','form','inputmode','list','maxlength','name','pattern','readonly','required','tabindex','value')),
201-
'url':frozenset(('accesskey','autocomplete','autofocus','disabled','form','inputmode','list','maxlength','name','pattern','readonly','required','tabindex','value')),
203+
'url':frozenset(('accesskey','autocomplete','autofocus','disabled','form','inputmode','list','maxlength','name','pattern','readonly','required','tabindex','value'))
204+
}
205+
206+
inputTypeDeprecatedAttributeMap= {
207+
'text':frozenset(('size',)),
208+
'password':frozenset(('size',))
202209
}
203210

204211
classHTMLConformanceChecker(_base.Filter):
@@ -248,6 +255,11 @@ def validateStartTagInput(self, token):
248255
"data":"attribute-not-allowed-on-this-input-type",
249256
"datavars": {"attributeName":attrName,
250257
"inputType":inputType}}
258+
ifattrNameininputTypeDeprecatedAttributeMap.get(inputType, []):
259+
yield {"type":"ParseError",
260+
"data":"deprecated-attribute",
261+
"datavars": {"attributeName":attrName,
262+
"inputType":inputType}}
251263

252264
defcheckUnknownStartTag(self,token):
253265
# check for recognized tag name

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp