]> code.delx.au - gnu-emacs-elpa/blob - packages/html5-schema/assertions.sch
Merge commit '0cda39255827f283e7578cd469ae42daad9556a2' from js2-mode
[gnu-emacs-elpa] / packages / html5-schema / assertions.sch
1 <?xml version="1.0"?>
2 <!-- * ********************************************************************* -->
3 <!-- * WARNING: This file is no longer maintained and hasn't been updated in -->
4 <!-- * years. There are numerous requirements in the HTML spec which should -->
5 <!-- * rightly be captured by assertions in this schema but that aren't. So -->
6 <!-- * don't consider the set of assertions here to be thorough or complete. -->
7 <!-- * ********************************************************************* -->
8
9 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
10 <!-- Schematron assertions for HTML5 -->
11 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12
13 Copyright (c) 2005-2007 Elika J. Etemad (fantasai) and Henri Sivonen (hsivonen)
14 Copyright (c) 2007-2012 Mozilla Foundation
15
16 Permission is hereby granted, free of charge, to any person obtaining a copy of
17 this software and associated documentation files (the "Software"), to deal in
18 the Software without restriction, including without limitation the rights to
19 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
20 of the Software, and to permit persons to whom the Software is furnished to do
21 so, subject to the following conditions:
22
23 The above copyright notice and this permission notice shall be included in all
24 copies or substantial portions of the Software.
25
26 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
32 THE SOFTWARE.
33 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
34
35 <schema xmlns='http://www.ascc.net/xml/schematron'>
36 <ns prefix='h' uri='http://www.w3.org/1999/xhtml'/>
37
38 <pattern name="required attributes">
39 <rule context='h:bdo'>
40 <assert test='@dir'>
41 A &#x201C;bdo&#x201D; element must have a
42 &#x201C;dir&#x201D; attribute.
43 </assert>
44 </rule>
45 <rule context='h:img[not(@alt)]'>
46 <assert test='(@title and not(@title = ""))
47 or //h:meta[(translate(@name,
48 "GENERATOR", "generator") = "generator")]
49 or (ancestor::h:figure
50 and (ancestor::h:figure[1]/h:figcaption
51 and not(ancestor::h:figure[1]/h:figcaption = ""))
52 and normalize-space(ancestor::h:figure[1])
53 = normalize-space(ancestor::h:figure[1]/h:figcaption)
54 and not(ancestor::h:figure[1]//*[
55 local-name() = "audio"
56 or local-name() = "canvas"
57 or local-name() = "embed"
58 or local-name() = "iframe"
59 or local-name() = "math"
60 or local-name() = "object"
61 or local-name() = "svg"
62 or local-name() = "video"])
63 and not(count(ancestor::h:figure[1]//h:img) > 1))'>
64 An &#x201C;img&#x201D; element must have an
65 &#x201C;alt&#x201D; attribute, except under certain
66 conditions. For details, consult guidance on
67 providing text alternatives for images.
68 http://www.w3.org/wiki/HTML/Usage/TextAlternatives
69 </assert>
70 </rule>
71 </pattern>
72
73 <pattern name='Triggered on mutually exclusive elements and prohibited-descendant cases'>
74
75 <!-- Exclusions and prohibited-descendant contraints - - - - - - - - - - - -->
76
77 <rule context='h:form|h:dfn|h:noscript|h:address'>
78 <report test='ancestor::*[name() = name(current())]'>
79 The &#x201C;<name/>&#x201D; element must not contain any nested
80 &#x201C;<name/>&#x201D; elements.
81 </report>
82 </rule>
83
84 <rule context='h:label'>
85 <report test='ancestor::*[name() = name(current())]'>
86 The &#x201C;<name/>&#x201D; element must not contain any nested
87 &#x201C;<name/>&#x201D; elements.
88 </report>
89 <report test='count(descendant::h:input
90 | descendant::h:button
91 | descendant::h:select
92 | descendant::h:keygen
93 | descendant::h:textarea) > 1'>
94 The &#x201C;label&#x201D; element may contain at most one descendant
95 &#x201C;input&#x201D; element,
96 &#x201C;button&#x201D; element,
97 &#x201C;select&#x201D; element,
98 or &#x201C;textarea&#x201D; element.
99 </report>
100 <report test='@for and
101 not(//h:input[not(translate(@type, "HIDEN", "hiden")="hidden")][@id = current()/@for] or
102 //h:textarea[@id = current()/@for] or
103 //h:select[@id = current()/@for] or
104 //h:button[@id = current()/@for] or
105 //h:keygen[@id = current()/@for] or
106 //h:output[@id = current()/@for])'>
107 The &#x201C;for&#x201D; attribute of the &#x201C;label&#x201D;
108 element must refer to a form control.
109 </report>
110 </rule>
111
112 <rule context='h:section|h:nav|h:article|h:aside'>
113 <report test='ancestor::h:address'>
114 The sectioning element &#x201C;<name/>&#x201D; must not
115 appear as a descendant of the &#x201C;address&#x201D; element.
116 </report>
117 </rule>
118
119 <rule context='h:footer'>
120 <report test='ancestor::h:header'>
121 The element &#x201C;footer&#x201D; must not
122 appear as a descendant of the &#x201C;header&#x201D; element.
123 </report>
124 <report test='ancestor::h:footer'>
125 The element &#x201C;footer&#x201D; must not
126 appear as a descendant of the &#x201C;footer&#x201D; element.
127 </report>
128 <report test='ancestor::h:address'>
129 The element &#x201C;footer&#x201D; must not
130 appear as a descendant of the &#x201C;address&#x201D; element.
131 </report>
132 </rule>
133
134 <rule context='h:h1|h:h2|h:h3|h:h4|h:h5|h:h6'>
135 <report test='ancestor::h:address'>
136 The &#x201C;<name/>&#x201D; element must not appear as a
137 descendant of the &#x201C;address&#x201D; element.
138 </report>
139 </rule>
140
141 <rule context='h:header'>
142 <report test='ancestor::h:footer'>
143 The &#x201C;<name/>&#x201D; element must not appear as a
144 descendant of the &#x201C;footer&#x201D; element.
145 </report>
146 <report test='ancestor::h:address'>
147 The &#x201C;<name/>&#x201D; element must not appear as a
148 descendant of the &#x201C;address&#x201D; element.
149 </report>
150 <report test='ancestor::h:header'>
151 The &#x201C;header&#x201D; element must not appear as a
152 descendant of the &#x201C;header&#x201D; element.
153 </report>
154 </rule>
155
156 <rule context='h:table'>
157 <report test='ancestor::h:caption'>
158 The element &#x201C;table&#x201D; must not appear as a
159 descendant of the &#x201C;caption&#x201D; element.
160 </report>
161 <report test='@summary' role='warning'>
162 The &#x201C;summary&#x201D; attribute on the
163 &#x201C;table&#x201D; element is obsolete.
164 Consider describing the structure of the table
165 in a &#x201C;caption&#x201D; element or
166 in a &#x201C;figure&#x201D; element containing
167 the &#x201C;table&#x201D; element; or, simplify
168 the structue of the table so that no
169 description is needed.
170 </report>
171 </rule>
172 </pattern>
173
174 <!-- Interactive element exclusions -->
175 <pattern name='interactive element exclusions'>
176
177 <!--
178 - Interactive descendants:
179 - a
180 - video[controls]
181 - audio[controls]
182 - details
183 - menu[type=toolbar]
184 - button
185 - input[type!=hidden]
186 - textarea
187 - select
188 - img[usemap]
189 - embed
190 - iframe
191 - keygen
192 - label
193 - object[usemap]
194
195 - Interactive ancestors
196 - a
197 - button
198 -->
199
200 <rule context='h:a|h:details|h:embed|h:iframe|h:label'>
201 <report test='ancestor::h:a'>
202 The interactive element &#x201C;<name/>&#x201D; must not
203 appear as a descendant of the &#x201C;a&#x201D; element.
204 </report>
205 <report test='ancestor::h:button'>
206 The interactive element &#x201C;<name/>&#x201D; must not
207 appear as a descendant of the &#x201C;button&#x201D; element.
208 </report>
209 </rule>
210
211 <rule context='h:button|h:textarea|h:select|h:keygen|h:input[not(translate(@type, "HIDEN", "hiden")="hidden")]'>
212 <report test='ancestor::h:a'>
213 The interactive element &#x201C;<name/>&#x201D; must not
214 appear as a descendant of the &#x201C;a&#x201D; element.
215 </report>
216 <report test='ancestor::h:button'>
217 The interactive element &#x201C;<name/>&#x201D; must not
218 appear as a descendant of the &#x201C;button&#x201D; element.
219 </report>
220 <report test='ancestor::h:label[@for] and not(ancestor::h:label[@for = current()/@id])'>
221 Any &#x201C;<name/>&#x201D; element descendant of a &#x201C;label&#x201D; element
222 with a &#x201C;for&#x201D; attribute must have an
223 ID value that matches that &#x201C;for&#x201D; attribute.
224 </report>
225 </rule>
226
227 <rule context='h:video[@controls]|h:audio[@controls]'>
228 <report test='ancestor::h:a'>
229 The interactive element &#x201C;<name/>&#x201D;
230 with the attribute &#x201C;controls&#x201D; must not
231 appear as a descendant of the &#x201C;a&#x201D; element.
232 </report>
233 <report test='ancestor::h:button'>
234 The interactive element &#x201C;<name/>&#x201D;
235 with the attribute &#x201C;controls&#x201D; must not
236 appear as a descendant of the &#x201C;button&#x201D; element.
237 </report>
238 </rule>
239
240 <rule context='h:menu[translate(@type, "TOLBAR", "tolbar")="toolbar"]'>
241 <report test='ancestor::h:a'>
242 The element &#x201C;menu&#x201D;
243 with the attribute &#x201C;type&#x201D; whose value is &#x201C;toolbar&#x201D; must not
244 appear as a descendant of the &#x201C;a&#x201D; element.
245 </report>
246 <report test='ancestor::h:button'>
247 The element &#x201C;menu&#x201D;
248 with the attribute &#x201C;type&#x201D; whose value is &#x201C;toolbar&#x201D; must not
249 appear as a descendant of the &#x201C;button&#x201D; element.
250 </report>
251 </rule>
252
253 <rule context='h:img[@usemap]'>
254 <report test='ancestor::h:a'>
255 The element &#x201C;img&#x201D;
256 with the attribute &#x201C;usemap&#x201D; must not
257 appear as a descendant of the &#x201C;a&#x201D; element.
258 </report>
259 <report test='ancestor::h:button'>
260 The element &#x201C;img&#x201D;
261 with the attribute &#x201C;usemap&#x201D; must not
262 appear as a descendant of the &#x201C;button&#x201D; element.
263 </report>
264 </rule>
265
266 <rule context='h:object[@usemap]'>
267 <report test='ancestor::h:a'>
268 The element &#x201C;object&#x201D;
269 with the attribute &#x201C;usemap&#x201D; must not
270 appear as a descendant of the &#x201C;a&#x201D; element.
271 </report>
272 <report test='ancestor::h:button'>
273 The element &#x201C;object&#x201D;
274 with the attribute &#x201C;usemap&#x201D; must not
275 appear as a descendant of the &#x201C;button&#x201D; element.
276 </report>
277 </rule>
278 </pattern>
279
280 <!-- REVISIT fieldset http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2006-April/006181.html -->
281
282 <!-- Misc requirements -->
283
284 <pattern name="miscellaneous requirements">
285 <rule context='h:area'>
286 <assert test='ancestor::h:map'>
287 The &#x201C;area&#x201D; element must have an ancestor
288 &#x201C;map&#x201D; element.
289 </assert>
290 </rule>
291
292 <rule context='h:img[@ismap]'>
293 <assert test='ancestor::h:a[@href]'>
294 The &#x201C;img&#x201D; element with the
295 &#x201C;ismap&#x201D; attribute set must have an ancestor
296 &#x201C;a&#x201D; element with the &#x201C;href&#x201D; attribute.
297 </assert>
298 </rule>
299
300 <rule context='h:input'>
301 <report test='@list and not(//h:datalist[@id = current()/@list])'>
302 The &#x201C;list&#x201D; attribute of the &#x201C;input&#x201D;
303 element must refer to a &#x201C;datalist&#x201D; element.
304 </report>
305 <report test='@type = "button" and (not(@value) or @value = "")'>
306 Element &#x201C;input&#x201D; with attribute &#x201C;type&#x201D;
307 whose value is &#x201C;button&#x201D; must have non-empty attribute
308 &#x201C;value&#x201D;.
309 </report>
310 </rule>
311
312 <rule context='h:track'>
313 <report test='@label = ""'>
314 Attribute &#x201C;label&#x201D; for element &#x201C;track&#x201D;
315 must have non-empty value.
316 </report>
317 <report test='@default and preceding-sibling::h:track[@default]'>
318 The &#x201C;default&#x201D; attribute must not occur on more than one
319 &#x201C;track&#x201D; element within the same &#x201C;audio&#x201D;
320 element or &#x201C;video&#x201D; element.
321 </report>
322 </rule>
323
324 <rule context='h:map[@id and @name]'>
325 <assert test='@id = @name'>
326 The &#x201C;id&#x201D; attribute on a &#x201C;map&#x201D; element must have
327 the same value as the &#x201C;name&#x201D; attribute.
328 </assert>
329 </rule>
330
331 <rule context='h:select'>
332 <report test='not(@multiple) and count(descendant::h:option[@selected]) > 1'>
333 The &#x201C;select&#x201D; element cannot have more than one
334 selected &#x201C;option&#x201D; element descendant unless the
335 &#x201C;multiple&#x201D; attribute is specified.
336 </report>
337 <report test='@required and not(@multiple)
338 and (not(@size)
339 or (starts-with(normalize-space(@size), "+")
340 and substring-after(@size,"+") = 1)
341 or @size = 1)
342 and not(h:option)'>
343 A &#x201C;select&#x201D; element with
344 a &#x201C;required&#x201D; attribute and without
345 a &#x201C;multiple&#x201D; attribute, and whose
346 size is &#x201C;1&#x201D;, must have a child
347 &#x201C;option&#x201D; element.
348 </report>
349 </rule>
350
351 <rule context='h:select[@required and not(@multiple)
352 and (not(@size)
353 or (starts-with(normalize-space(@size), "+")
354 and substring-after(@size,"+") = 1)
355 or @size = 1)]/h:option[1]'>
356 <assert test='(@value and @value = "")
357 or ((not(@value) or @value = "") and . = "")'>
358 The first child &#x201C;option&#x201D; element
359 of a &#x201C;select&#x201D; element with
360 a &#x201C;required&#x201D; attribute and without
361 a &#x201C;multiple&#x201D; attribute, and whose
362 size is &#x201C;1&#x201D;, must have either an
363 empty &#x201C;value&#x201D; attribute, or must
364 have no text content.
365 </assert>
366 </rule>
367
368 <rule context='h:script'>
369 <report test='@language and translate(@language, "JAVSCRIPT", "javscript")="javascript"
370 and @type and not(translate(@type, "EXJAVSCRIPT", "exjavscript")="text/javascript")'>
371 Element &#x201C;script&#x201D; with attribute
372 &#x201C;language&#x201D; whose value is &#x201C;JavaScript&#x201D;
373 must not have attribute &#x201C;type&#x201D; whose value is not
374 &#x201C;text/javascript&#x201D;.
375 </report>
376 <report test='not(@src) and @charset'>
377 Element &#x201C;script&#x201D; must not have attribute
378 &#x201C;charset&#x201D; unless attribute &#x201C;src&#x201D; is
379 also specified.
380 </report>
381 <report test='not(@src) and @defer'>
382 Element &#x201C;script&#x201D; must not have attribute
383 &#x201C;defer&#x201D; unless attribute &#x201C;src&#x201D; is
384 also specified.
385 </report>
386 <report test='not(@src) and @async'>
387 Element &#x201C;script&#x201D; must not have attribute
388 &#x201C;async&#x201D; unless attribute &#x201C;src&#x201D; is
389 also specified.
390 </report>
391 </rule>
392
393 <rule context='h:time'>
394 <report test='ancestor::h:time'>
395 The element &#x201C;time&#x201D; must not
396 appear as a descendant of the &#x201C;time&#x201D; element.
397 </report>
398 </rule>
399
400 <rule context='h:progress'>
401 <report test='ancestor::h:progress'>
402 The element &#x201C;progress&#x201D; must not
403 appear as a descendant of the &#x201C;progress&#x201D; element.
404 </report>
405 <assert test='@max and @value and number(@value) &lt;= number(@max)'>
406 The value of the &#x201C;value&#x201D; attribute must be less than or equal to
407 the value of the &#x201C;max&#x201D; attribute.
408 </assert>
409 <assert test='not(@max) and @value and number(@value) &lt;= 1'>
410 The value of the &#x201C;value&#x201D; attribute must be less than or equal to
411 one when the &#x201C;max&#x201D; attribute is absent.
412 </assert>
413 </rule>
414
415 <!--
416 min <= value <= max
417 min <= low <= high <= max
418 min <= optimum <= max
419 -->
420
421 <rule context='h:meter'>
422 <report test='ancestor::h:meter'>
423 The element &#x201C;meter&#x201D; must not
424 appear as a descendant of the &#x201C;meter&#x201D; element.
425 </report>
426 <report test='@min and @value and not(number(@min) &lt;= number(@value))'>
427 The value of the &#x201C;min&#x201D; attribute must be less than or equal to
428 the value of the &#x201C;value&#x201D; attribute.
429 </report>
430 <report test='not(@min) and @value and not(0 &lt;= number(@value))'>
431 The value of the &#x201C;value&#x201D; attribute must be greater than or equal to
432 zero when the &#x201C;min&#x201D; attribute is absent.
433 </report>
434 <report test='@value and @max and not(number(@value) &lt;= number(@max))'>
435 The value of the &#x201C;value&#x201D; attribute must be less than or equal to
436 the value of the &#x201C;max&#x201D; attribute.
437 </report>
438 <report test='@value and not(@max) and not(number(@value) &lt;= 1)'>
439 The value of the &#x201C;value&#x201D; attribute must be less than or equal to
440 one when the &#x201C;max&#x201D; attribute is absent.
441 </report>
442 <report test='@min and @max and not(number(@min) &lt;= number(@max))'>
443 The value of the &#x201C;min&#x201D; attribute must be less than or equal to
444 the value of the &#x201C;max&#x201D; attribute.
445 </report>
446 <report test='not(@min) and @max and not(0 &lt;= number(@max))'>
447 The value of the &#x201C;max&#x201D; attribute must be greater than or equal to
448 zero when the &#x201C;min&#x201D; attribute is absent.
449 </report>
450 <report test='@min and not(@max) and not(number(@min) &lt;= 1)'>
451 The value of the &#x201C;min&#x201D; attribute must be less than or equal to
452 one when the &#x201C;max&#x201D; attribute is absent.
453 </report>
454 <report test='@min and @low and not(number(@min) &lt;= number(@low))'>
455 The value of the &#x201C;min&#x201D; attribute must be less than or equal to
456 the value of the &#x201C;low&#x201D; attribute.
457 </report>
458 <report test='not(@min) and @low and not(0 &lt;= number(@low))'>
459 The value of the &#x201C;low&#x201D; attribute must be greater than or equal to
460 zero when the &#x201C;min&#x201D; attribute is absent.
461 </report>
462 <report test='@min and @high and not(number(@min) &lt;= number(@high))'>
463 The value of the &#x201C;min&#x201D; attribute must be less than or equal to
464 the value of the &#x201C;high&#x201D; attribute.
465 </report>
466 <report test='not(@min) and @high and not(0 &lt;= number(@high))'>
467 The value of the &#x201C;high&#x201D; attribute must be greater than or equal to
468 zero when the &#x201C;min&#x201D; attribute is absent.
469 </report>
470 <report test='@low and @high and not(number(@low) &lt;= number(@high))'>
471 The value of the &#x201C;low&#x201D; attribute must be less than or equal to
472 the value of the &#x201C;high&#x201D; attribute.
473 </report>
474 <report test='@high and @max and not(number(@high) &lt;= number(@max))'>
475 The value of the &#x201C;high&#x201D; attribute must be less than or equal to
476 the value of the &#x201C;max&#x201D; attribute.
477 </report>
478 <report test='@high and not(@max) and not(number(@high) &lt;= 1)'>
479 The value of the &#x201C;high&#x201D; attribute must be less than or equal to
480 one when the &#x201C;max&#x201D; attribute is absent.
481 </report>
482 <report test='@low and @max and not(number(@low) &lt;= number(@max))'>
483 The value of the &#x201C;low&#x201D; attribute must be less than or equal to
484 the value of the &#x201C;max&#x201D; attribute.
485 </report>
486 <report test='@low and not(@max) and not(number(@low) &lt;= 1)'>
487 The value of the &#x201C;low&#x201D; attribute must be less than or equal to
488 one when the &#x201C;max&#x201D; attribute is absent.
489 </report>
490 <report test='@min and @optimum and not(number(@min) &lt;= number(@optimum))'>
491 The value of the &#x201C;min&#x201D; attribute must be less than or equal to
492 the value of the &#x201C;optimum&#x201D; attribute.
493 </report>
494 <report test='not(@min) and @optimum and not(0 &lt;= number(@optimum))'>
495 The value of the &#x201C;optimum&#x201D; attribute must be greater than or equal to
496 zero when the &#x201C;min&#x201D; attribute is absent.
497 </report>
498 <report test='@optimum and @max and not(number(@optimum) &lt;= number(@max))'>
499 The value of the &#x201C;optimum&#x201D; attribute must be less than or equal to
500 the value of the &#x201C;max&#x201D; attribute.
501 </report>
502 <report test='@optimum and not(@max) and not(number(@optimum) &lt;= 1)'>
503 The value of the &#x201C;optimum&#x201D; attribute must be less than or equal to
504 one when the &#x201C;max&#x201D; attribute is absent.
505 </report>
506 </rule>
507 </pattern>
508
509 <!-- Obsolete Elements - - - - - - - - - - - - - - - - - - - - - - -->
510 <pattern name="obsolete elements">
511 <rule context='h:acronym'>
512 <report test='true()'>
513 The &#x201C;acronym&#x201D; element is obsolete. Use the &#x201C;abbr&#x201D; element instead.
514 </report>
515 </rule>
516
517 <rule context='h:applet'>
518 <report test='true()'>
519 The &#x201C;applet&#x201D; element is obsolete. Use the &#x201C;object&#x201D; element instead.
520 </report>
521 </rule>
522
523 <rule context='h:center|h:font|h:big|h:strike|h:tt|h:basefont'>
524 <report test='true()'>
525 The &#x201C;<name/>&#x201D; element is obsolete.
526 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
527 </report>
528 </rule>
529
530 <rule context='h:dir'>
531 <report test='true()'>
532 The &#x201C;dir&#x201D; element is obsolete. Use the &#x201C;ul&#x201D; element instead.
533 </report>
534 </rule>
535
536 <rule context='h:frameset|h:noframes'>
537 <report test='true()'>
538 The &#x201C;<name/>&#x201D; element is obsolete.
539 Use the &#x201C;iframe&#x201D; element and CSS instead, or use server-side includes.
540 </report>
541 </rule>
542 </pattern>
543
544 <!-- Obsolete Attributes- - - - - - - - - - - - - - - - - - - - - - -->
545
546 <pattern name="obsolete attributes">
547 <rule context='h:a'>
548 <report test='@coords'>
549 The &#x201C;coords&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
550 For image maps, use the &#x201C;area&#x201D; element instead of the &#x201C;a&#x201D; element.
551 </report>
552 <report test='@shape'>
553 The &#x201C;shape&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
554 For image maps, use the &#x201C;area&#x201D; element instead of the &#x201C;a&#x201D; element.
555 </report>
556 <report test='@urn'>
557 The &#x201C;urn&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
558 Specify the preferred persistent identifier using the &#x201C;href&#x201D; attribute instead.
559 </report>
560 <report test='@charset'>
561 The &#x201C;charset&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
562 Use an HTTP Content-Type header on the linked resource instead.
563 </report>
564 <report test='@methods'>
565 The &#x201C;methods&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
566 Use the HTTP OPTIONS feature instead.
567 </report>
568 <report test='@rev'>
569 The &#x201C;rev&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
570 Use the &#x201C;rel&#x201D; attribute instead, with a term having the opposite meaning.
571 </report>
572 </rule>
573
574 <rule context='h:link'>
575 <report test='@target'>
576 The &#x201C;target&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
577 You can safely omit it.
578 </report>
579 <report test='@urn'>
580 The &#x201C;urn&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
581 Specify the preferred persistent identifier using the &#x201C;href&#x201D; attribute instead.
582 </report>
583 <report test='@charset'>
584 The &#x201C;charset&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
585 Use an HTTP Content-Type header on the linked resource instead.
586 </report>
587 <report test='@methods'>
588 The &#x201C;methods&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
589 Use the HTTP OPTIONS feature instead.
590 </report>
591 <report test='@rev'>
592 The &#x201C;rev&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
593 Use the &#x201C;rel&#x201D; attribute instead, with a term having the opposite meaning.
594 </report>
595 </rule>
596
597 <rule context="h:area">
598 <report test='@nohref'>
599 The &#x201C;nohref&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
600 Omitting the &#x201C;href&#x201D; attribute is sufficient.
601 </report>
602 </rule>
603
604 <rule context='h:embed'>
605 <report test='@name'>
606 The &#x201C;name&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
607 Use the &#x201C;id&#x201D; attribute instead.
608 </report>
609 </rule>
610
611 <rule context='h:head'>
612 <report test='@profile'>
613 The &#x201C;profile&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
614 To declare which &#x201C;meta&#x201D; element terms are used in the document, instead register the
615 names as meta extensions. &lt;http://wiki.whatwg.org/wiki/MetaExtensions>
616 To trigger specific UA behaviors, use a &#x201C;link&#x201D; element instead.
617 </report>
618 </rule>
619
620 <rule context='h:html'>
621 <report test='@version'>
622 The &#x201C;version&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
623 You can safely omit it.
624 </report>
625 </rule>
626
627 <rule context='h:iframe'>
628 <report test='@longdesc'>
629 The &#x201C;longdesc&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
630 Use a regular &#x201C;a&#x201D; element to link to the description.
631 </report>
632 </rule>
633
634 <rule context='h:img'>
635 <report test='@longdesc'>
636 The &#x201C;longdesc&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
637 Use a regular &#x201C;a&#x201D; element to link to the description.
638 </report>
639 <report test='@name'>
640 The &#x201C;name&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
641 Use the &#x201C;id&#x201D; attribute instead.
642 </report>
643 </rule>
644
645 <rule context='h:input'>
646 <report test='@usemap'>
647 The &#x201C;usemap&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
648 Use the &#x201C;img&#x201D; element instead of the &#x201C;input&#x201D; element for image maps.
649 </report>
650 </rule>
651
652 <rule context='h:li|h:ul'>
653 <report test='@type'>
654 The &#x201C;type&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
655 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
656 </report>
657 </rule>
658
659 <rule context='h:meta'>
660 <report test='@scheme'>
661 The &#x201C;scheme&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
662 Use only one scheme per field, or make the scheme declaration part of the value.
663 </report>
664 <report test='translate(@http-equiv,"CONTELAGUA", "contelagua")="content-language"' role='warning'>
665 Using the &#x201C;meta&#x201D; element to specify the document-wide default language is obsolete.
666 Consider specifying the language on the root element instead.
667 </report>
668 </rule>
669
670 <rule context='h:object'>
671 <report test='@archive'>
672 The &#x201C;archive&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
673 Use the &#x201C;data&#x201D; attribute and &#x201C;type&#x201D; attribute to invoke plugins.
674 To set a parameter with the name &#x201C;archive&#x201D;, use the &#x201C;param&#x201D; element.
675 </report>
676 <report test='@classid'>
677 The &#x201C;classid&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
678 Use the &#x201C;data&#x201D; attribute and &#x201C;type&#x201D; attribute to invoke plugins.
679 To set a parameter with the name &#x201C;classid&#x201D;, use the &#x201C;param&#x201D; element.
680 </report>
681 <report test='@code'>
682 The &#x201C;code&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
683 Use the &#x201C;data&#x201D; attribute and &#x201C;type&#x201D; attribute to invoke plugins.
684 To set a parameter with the name &#x201C;code&#x201D;, use the &#x201C;param&#x201D; element.
685 </report>
686 <report test='@codebase'>
687 The &#x201C;codebase&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
688 Use the &#x201C;data&#x201D; attribute and &#x201C;type&#x201D; attribute to invoke plugins.
689 To set a parameter with the name &#x201C;codebase&#x201D;, use the &#x201C;param&#x201D; element.
690 </report>
691 <report test='@codetype'>
692 The &#x201C;codetype&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
693 Use the &#x201C;data&#x201D; attribute and &#x201C;type&#x201D; attribute to invoke plugins.
694 To set a parameter with the name &#x201C;codetype&#x201D;, use the &#x201C;param&#x201D; element.
695 </report>
696 <report test='@declare'>
697 The &#x201C;declare&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
698 Repeat the &#x201C;object&#x201D; element completely each time the resource is to be reused.
699 </report>
700 <report test='@standby'>
701 The &#x201C;standby&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
702 Optimize the linked resource so that it loads quickly or, at least, incrementally.
703 </report>
704 </rule>
705
706 <rule context='h:option'>
707 <report test='@name'>
708 The &#x201C;name&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
709 Use the &#x201C;id&#x201D; attribute instead.
710 </report>
711 </rule>
712
713 <rule context='h:param'>
714 <report test='@type'>
715 The &#x201C;type&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
716 Use the &#x201C;name&#x201D; attribute and &#x201C;value&#x201D; attribute without declaring value types.
717 </report>
718 <report test='@valuetype'>
719 The &#x201C;valuetype&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
720 Use the &#x201C;name&#x201D; attribute and &#x201C;value&#x201D; attribute without declaring value types.
721 </report>
722 </rule>
723
724 <rule context='h:script[@language and not(translate(@language, "JAVSCRIPT", "javscript")="javascript")]'>
725 <report test='true()'>
726 The &#x201C;language&#x201D; attribute on the &#x201C;script&#x201D; element is obsolete.
727 Use the &#x201C;type&#x201D; attribute instead.
728 </report>
729 </rule>
730
731 <rule context='h:td|h:th'>
732 <report test='@scope and self::h:td'>
733 The &#x201C;scope&#x201D; attribute on the &#x201C;td&#x201D; element is obsolete.
734 Use the &#x201C;scope&#x201D; attribute on a &#x201C;th&#x201D; element instead.
735 </report>
736 <report test='@abbr'>
737 The &#x201C;abbr&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
738 Consider instead beginning the cell contents with concise text, followed by further elaboration if needed.
739 </report>
740 <report test='@axis'>
741 The &#x201C;axis&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
742 Use the &#x201C;scope&#x201D; attribute instead.
743 </report>
744 </rule>
745 </pattern>
746
747 <pattern name="obsolete presentational align attribute">
748 <rule context='h:caption|h:iframe|h:img|h:input|h:object|h:embed|h:legend
749 |h:table|h:hr|h:div|h:h1|h:h2|h:h3|h:h4|h:h5|h:h6|h:p|h:col|h:colgroup
750 |h:tbody|h:td|h:tfoot|h:th|h:thead|h:tr'>
751 <report test='@align'>
752 The &#x201C;align&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
753 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
754 </report>
755 </rule>
756 </pattern>
757
758 <pattern name="obsolete presentational width attribute">
759 <rule context='h:col|h:colgroup|h:hr|h:pre|h:table|h:td|h:th'>
760 <report test='@width'>
761 The &#x201C;width&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
762 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
763 </report>
764 </rule>
765 </pattern>
766
767 <pattern name="obsolete presentational table attributes">
768 <rule context='h:col|h:colgroup|h:tbody|h:td|h:tfoot|h:th|h:thead|h:tr'>
769 <report test='@char'>
770 The &#x201C;char&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
771 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
772 </report>
773 <report test='@charoff'>
774 The &#x201C;charoff&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
775 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
776 </report>
777 <report test='@valign'>
778 The &#x201C;valign&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
779 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
780 </report>
781 </rule>
782 </pattern>
783
784 <pattern name="obsolete presentational attributes">
785 <rule context='h:body'>
786 <report test='@alink'>
787 The &#x201C;alink&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
788 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
789 </report>
790 <report test='@background'>
791 The &#x201C;background&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
792 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
793 </report>
794 <report test='@bgcolor'>
795 The &#x201C;bgcolor&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
796 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
797 </report>
798 <report test='@link'>
799 The &#x201C;link&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
800 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
801 </report>
802 <report test='@marginbottom'>
803 The &#x201C;marginbottom&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
804 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
805 </report>
806 <report test='@marginheight'>
807 The &#x201C;marginheight&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
808 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
809 </report>
810 <report test='@marginleft'>
811 The &#x201C;marginleft&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
812 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
813 </report>
814 <report test='@marginright'>
815 The &#x201C;marginright&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
816 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
817 </report>
818 <report test='@margintop'>
819 The &#x201C;margintop&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
820 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
821 </report>
822 <report test='@marginwidth'>
823 The &#x201C;marginwidth&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
824 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
825 </report>
826 <report test='@text'>
827 The &#x201C;text&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
828 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
829 </report>
830 <report test='@vlink'>
831 The &#x201C;vlink&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
832 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
833 </report>
834 </rule>
835
836 <rule context='h:br'>
837 <report test='@clear'>
838 The &#x201C;clear&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
839 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
840 </report>
841 </rule>
842
843 <rule context='h:embed'>
844 <report test='@hspace'>
845 The &#x201C;hspace&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
846 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
847 </report>
848 <report test='@vspace'>
849 The &#x201C;vspace&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
850 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
851 </report>
852 </rule>
853
854 <rule context='h:hr'>
855 <report test='@noshade'>
856 The &#x201C;noshade&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
857 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
858 </report>
859 <report test='@size'>
860 The &#x201C;size&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
861 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
862 </report>
863 <report test='@color'>
864 The &#x201C;color&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
865 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
866 </report>
867 </rule>
868
869 <rule context='h:dl|h:menu|h:ol|h:ul'>
870 <report test='@compact'>
871 The &#x201C;compact&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
872 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
873 </report>
874 </rule>
875
876 <rule context='h:iframe'>
877 <report test='@allowtransparency'>
878 The &#x201C;allowtransparency&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
879 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
880 </report>
881 <report test='@frameborder'>
882 The &#x201C;frameborder&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
883 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
884 </report>
885 <report test='@marginheight'>
886 The &#x201C;marginheight&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
887 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
888 </report>
889 <report test='@marginwidth'>
890 The &#x201C;marginwidth&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
891 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
892 </report>
893 <report test='@scrolling'>
894 The &#x201C;scrolling&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
895 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
896 </report>
897 </rule>
898
899 <rule context='h:img|h:object'>
900 <report test='@hspace'>
901 The &#x201C;hspace&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
902 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
903 </report>
904 <report test='@vspace'>
905 The &#x201C;vspace&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
906 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
907 </report>
908 <report test='@border and self::h:object'>
909 The &#x201C;border&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
910 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
911 </report>
912 </rule>
913
914 <rule context='h:table'>
915 <report test='@bgcolor'>
916 The &#x201C;bgcolor&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
917 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
918 </report>
919 <report test='@border and not(@border = "" or @border = "1")'>
920 The value of the &#x201C;border&#x201D; attribute on the &#x201C;<name/>&#x201D; element
921 must be either &#x201C;1&#x201D; or the empty string. To regulate the thickness of table borders,
922 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
923 </report>
924 <report test='@cellpadding'>
925 The &#x201C;cellpadding&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
926 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
927 </report>
928 <report test='@cellspacing'>
929 The &#x201C;cellspacing&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
930 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
931 </report>
932 <report test='@frame'>
933 The &#x201C;frame&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
934 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
935 </report>
936 <report test='@rules'>
937 The &#x201C;rules&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
938 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
939 </report>
940 </rule>
941
942 <rule context='h:td|h:th'>
943 <report test='@bgcolor'>
944 The &#x201C;bgcolor&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
945 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
946 </report>
947 <report test='@height'>
948 The &#x201C;height&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
949 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
950 </report>
951 <report test='@nowrap'>
952 The &#x201C;nowrap&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
953 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
954 </report>
955 </rule>
956
957 <rule context='h:tr'>
958 <report test='@bgcolor'>
959 The &#x201C;bgcolor&#x201D; attribute on the &#x201C;<name/>&#x201D; element is obsolete.
960 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
961 </report>
962 </rule>
963 </pattern>
964
965 <!-- lang and xml:lang in XHTML - - - - - - - - - - - - - - - - - -->
966
967 <pattern name='lang and xml:lang in XHTML'>
968 <rule context='h:*[@lang and @xml:lang]'>
969 <assert test='translate(@lang, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz") = translate(@xml:lang, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")'>
970 When the attribute &#x201C;lang&#x201D; in no namespace and the attribute &#x201C;lang&#x201D;
971 in the XML namespace are both present, they must have the same value.
972 </assert>
973 </rule>
974 </pattern>
975
976 <!-- IDREFs - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
977
978 <!-- Assuming that ID uniqueness is already enforced. -->
979
980 <pattern name='contextmenu must refer to a menu'>
981 <rule context='h:*[@contextmenu]'>
982 <assert test='//h:menu[@id = current()/@contextmenu]'>
983 The &#x201C;contextmenu&#x201D; attribute must refer to a
984 &#x201C;menu&#x201D; element.
985 </assert>
986 </rule>
987 </pattern>
988
989 <!-- FIXME form attribute -->
990
991 <!-- FIXME output for -->
992
993 <!-- Unique Definitions - - - - - - - - - - - - - - - - - - - - - -->
994
995 <!-- Only one definition per term per document' -->
996
997 <!-- ARIA containment - - - - - - - - - - - - - - - - - - - - - -->
998
999 <pattern name='Mutually Exclusive Role triggers'>
1000
1001 <!-- XXX columnheader and rowheader require row parent -->
1002
1003 <rule context='*[@role="option"]'>
1004 <assert test='../@role="listbox"'>
1005 An element with &#x201C;role=option&#x201D; requires
1006 &#x201C;role=listbox&#x201D; on the parent.
1007 </assert>
1008 </rule>
1009
1010 <rule context='*[@role="menuitem"]'>
1011 <assert test='../@role="menu"'>
1012 An element with &#x201C;role=menuitem&#x201D; requires
1013 &#x201C;role=menu&#x201D; on the parent.
1014 </assert>
1015 </rule>
1016
1017 <rule context='*[@role="menuitemcheckbox"]'>
1018 <assert test='../@role="menu"'>
1019 An element with &#x201C;role=menuitemcheckbox&#x201D; requires
1020 &#x201C;role=menu&#x201D; on the parent.
1021 </assert>
1022 </rule>
1023
1024 <rule context='*[@role="menuitemradio"]'>
1025 <assert test='../@role="menu"'>
1026 An element with &#x201C;role=menuitemradio&#x201D; requires
1027 &#x201C;role=menu&#x201D; on the parent.
1028 </assert>
1029 </rule>
1030
1031 <rule context='*[@role="tab"]'>
1032 <assert test='../@role="tablist"'>
1033 An element with &#x201C;role=tab&#x201D; requires
1034 &#x201C;role=tablist&#x201D; on the parent.
1035 </assert>
1036 </rule>
1037
1038 <rule context='*[@role="treeitem"]'>
1039 <assert test='../@role="tree"'>
1040 An element with &#x201C;role=treeitem&#x201D; requires
1041 &#x201C;role=tree&#x201D; on the parent.
1042 </assert>
1043 </rule>
1044
1045 <rule context='*[@role="listitem"]'>
1046 <assert test='../@role="list"'>
1047 An element with &#x201C;role=listitem&#x201D; requires
1048 &#x201C;role=list&#x201D; on the parent.
1049 </assert>
1050 </rule>
1051
1052 <rule context='*[@role="row"]'>
1053 <assert test='../@role="grid" or
1054 ../../@role="grid" or
1055 ../@role="treegrid" or
1056 ../../@role="treegrid"'>
1057 An element with &#x201C;role=row&#x201D; requires
1058 &#x201C;role=treegrid&#x201D; or &#x201C;role=grid&#x201D; on the parent or grandparent.
1059 </assert>
1060 </rule>
1061 <!-- XXX hoping for a spec change so not bothering with the reciprocal case -->
1062
1063 <rule context='*[@role="gridcell"]'>
1064 <assert test='../@role="row"'>
1065 An element with &#x201C;role=gridcell&#x201D; requires
1066 &#x201C;role=row&#x201D; on the parent.
1067 </assert>
1068 </rule>
1069 <!-- XXX hoping for a spec change so not bothering with the reciprocal case -->
1070
1071 </pattern>
1072
1073 <pattern name='Not Option'>
1074 <rule context='*[not(@role="option")]'>
1075 <report test='../@role="listbox"'>
1076 An element must not be a child of
1077 &#x201C;role=listbox&#x201D; unless it has &#x201C;role=option&#x201D;.
1078 </report>
1079 </rule>
1080 </pattern>
1081
1082 <pattern name='Not menuitem*'>
1083 <rule context='*[not(@role="menuitem" or
1084 @role="menuitemcheckbox" or
1085 @role="menuitemradio")]'>
1086 <report test='../@role="menu"'>
1087 An element must not be a child of
1088 &#x201C;role=menu&#x201D; unless it has
1089 &#x201C;role=menuitem&#x201D;,
1090 &#x201C;role=menuitemcheckbox&#x201D; or
1091 &#x201C;role=menuitemradio&#x201D;.
1092 </report>
1093 </rule>
1094 </pattern>
1095
1096 <pattern name='Not treeitem'>
1097 <rule context='*[not(@role="treeitem")]'>
1098 <report test='../@role="tree"'>
1099 An element must not be a child of
1100 &#x201C;role=tree&#x201D; unless it has
1101 &#x201C;role=treeitem&#x201D;.
1102 </report>
1103 </rule>
1104 </pattern>
1105
1106 <pattern name='Not listitem'>
1107 <rule context='*[not(@role="listitem")]'>
1108 <report test='../@role="list"'>
1109 An element must not be a child of
1110 &#x201C;role=list&#x201D; unless it has
1111 &#x201C;role=listitem&#x201D;.
1112 </report>
1113 </rule>
1114 <!-- XXX role=group omitted due to lack of detail in spec -->
1115 </pattern>
1116
1117 <pattern name='Not radio'>
1118 <rule context='*[not(@role="radio")]'>
1119 <report test='../@role="radiogroup"'>
1120 An element must not be a child of
1121 &#x201C;role=radiogroup&#x201D; unless it has
1122 &#x201C;role=radio&#x201D;.
1123 </report>
1124 </rule>
1125 </pattern>
1126
1127 <pattern name='Not gridcell'>
1128 <rule context='*[not(@role="gridcell")]'>
1129 <report test='../@role="row"'>
1130 An element must not be a child of
1131 &#x201C;role=row&#x201D; unless it has
1132 &#x201C;role=gridcell&#x201D;.
1133 </report>
1134 </rule>
1135 </pattern>
1136
1137 <pattern name='Not tab'>
1138 <rule context='*[not(@role="tab")]'>
1139 <report test='../@role="tablist"'>
1140 An element must not be a child of
1141 &#x201C;role=tablist&#x201D; unless it has
1142 &#x201C;role=role&#x201D;.
1143 </report>
1144 </rule>
1145 </pattern>
1146
1147 <!-- XXX combobox requires a listbox child -->
1148
1149 <pattern name='aria-activedescendant must refer to a descendant'>
1150 <rule context='*[@aria-activedescendant]'>
1151 <assert test='descendant::*[@id = current()/@aria-activedescendant]'>
1152 The &#x201C;aria-activedescendant&#x201D; attribute must refer to a
1153 descendant element.
1154 </assert>
1155 </rule>
1156 </pattern>
1157
1158 <pattern name='controls must not dangle'>
1159 <rule context='*[@aria-controls]'>
1160 <assert test='//*[@id = current()/@aria-controls]'>
1161 The &#x201C;aria-controls&#x201D; attribute must point to an element in the
1162 same document.
1163 </assert>
1164 </rule>
1165 </pattern>
1166
1167 <pattern name='describedby must not dangle'>
1168 <rule context='*[@aria-describedby]'>
1169 <assert test='//*[@id = current()/@aria-describedby]'>
1170 The &#x201C;aria-describedby&#x201D; attribute must point to an element in the
1171 same document.
1172 </assert>
1173 </rule>
1174 </pattern>
1175
1176 <pattern name='flowto must not dangle'>
1177 <rule context='*[@aria-flowto]'>
1178 <assert test='//*[@id = current()/@aria-flowto]'>
1179 The &#x201C;aria-flowto&#x201D; attribute must point to an element in the
1180 same document.
1181 </assert>
1182 </rule>
1183 </pattern>
1184
1185 <pattern name='labelledby must not dangle'>
1186 <rule context='*[@aria-labelledby]'>
1187 <assert test='//*[@id = current()/@aria-labelledby]'>
1188 The &#x201C;aria-labelledby&#x201D; attribute must point to an element in the
1189 same document.
1190 </assert>
1191 </rule>
1192 </pattern>
1193
1194 <pattern name='owns must not dangle'>
1195 <rule context='*[@aria-owns]'>
1196 <assert test='//*[@id = current()/@aria-owns]'>
1197 The &#x201C;aria-owns&#x201D; attribute must point to an element in the
1198 same document.
1199 </assert>
1200 </rule>
1201 </pattern>
1202
1203 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1204 <!-- Warnings -->
1205 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
1206 <pattern name="Warnings for HTML5 attributes that are obsolete but conforming">
1207 <rule context='h:img'>
1208 <report test='@border' role='warning'>
1209 The &#x201C;border&#x201D; attribute on the &#x201C;img&#x201D; element is obsolete.
1210 Consider specifying &#x201C;img { border: 0; }&#x201C; in CSS instead.
1211 </report>
1212 </rule>
1213 <rule context='h:script[translate(@language, "JAVSCRIPT", "javscript")="javascript"]'>
1214 <report test='not(@type) or translate(@type, "EXJAVSCRIPT", "exjavscript")="text/javascript"' role='warning'>
1215 The &#x201C;language&#x201D; attribute on the &#x201C;script&#x201D; element is obsolete. You can safely omit it.
1216 </report>
1217 </rule>
1218 <rule context='h:a'>
1219 <report test='@name' role='warning'>
1220 The &#x201C;name&#x201D; attribute on the &#x201C;a&#x201D; element is obsolete. Consider putting an
1221 &#x201C;id&#x201D; attribute on the nearest container instead.
1222 </report>
1223 </rule>
1224 </pattern>
1225
1226 <pattern name="Other warnings">
1227 <rule context='h:video|h:audio'>
1228 <report test='count(h:track[@default]) > 1' role='warning'>
1229 &#x201C;<name/>&#x201D; element has more than one &#x201C;track&#x201D;
1230 child element with a &#x201C;default&#x201D; attribute.
1231 </report>
1232 </rule>
1233 </pattern>
1234
1235 </schema>