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 <!-- * ********************************************************************* -->
9 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
10 <!-- Schematron assertions for HTML5 -->
11 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13 Copyright (c) 2005-2007 Elika J. Etemad (fantasai) and Henri Sivonen (hsivonen)
14 Copyright (c) 2007-2012 Mozilla Foundation
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:
23 The above copyright notice and this permission notice shall be included in all
24 copies or substantial portions of the Software.
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
33 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
35 <schema xmlns='http://www.ascc.net/xml/schematron'>
36 <ns prefix='h' uri='http://www.w3.org/1999/xhtml'/>
38 <pattern name="required attributes">
39 <rule context='h:bdo'>
41 A “bdo” element must have a
42 “dir” attribute.
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 “img” element must have an
65 “alt” 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
73 <pattern name='Triggered on mutually exclusive elements and prohibited-descendant cases'>
75 <!-- Exclusions and prohibited-descendant contraints - - - - - - - - - - - -->
77 <rule context='h:form|h:dfn|h:noscript|h:address'>
78 <report test='ancestor::*[name() = name(current())]'>
79 The “<name/>” element must not contain any nested
80 “<name/>” elements.
84 <rule context='h:label'>
85 <report test='ancestor::*[name() = name(current())]'>
86 The “<name/>” element must not contain any nested
87 “<name/>” elements.
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 “label” element may contain at most one descendant
95 “input” element,
96 “button” element,
97 “select” element,
98 or “textarea” element.
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 “for” attribute of the “label”
108 element must refer to a form control.
112 <rule context='h:section|h:nav|h:article|h:aside'>
113 <report test='ancestor::h:address'>
114 The sectioning element “<name/>” must not
115 appear as a descendant of the “address” element.
119 <rule context='h:footer'>
120 <report test='ancestor::h:header'>
121 The element “footer” must not
122 appear as a descendant of the “header” element.
124 <report test='ancestor::h:footer'>
125 The element “footer” must not
126 appear as a descendant of the “footer” element.
128 <report test='ancestor::h:address'>
129 The element “footer” must not
130 appear as a descendant of the “address” element.
134 <rule context='h:h1|h:h2|h:h3|h:h4|h:h5|h:h6'>
135 <report test='ancestor::h:address'>
136 The “<name/>” element must not appear as a
137 descendant of the “address” element.
141 <rule context='h:header'>
142 <report test='ancestor::h:footer'>
143 The “<name/>” element must not appear as a
144 descendant of the “footer” element.
146 <report test='ancestor::h:address'>
147 The “<name/>” element must not appear as a
148 descendant of the “address” element.
150 <report test='ancestor::h:header'>
151 The “header” element must not appear as a
152 descendant of the “header” element.
156 <rule context='h:table'>
157 <report test='ancestor::h:caption'>
158 The element “table” must not appear as a
159 descendant of the “caption” element.
161 <report test='@summary' role='warning'>
162 The “summary” attribute on the
163 “table” element is obsolete.
164 Consider describing the structure of the table
165 in a “caption” element or
166 in a “figure” element containing
167 the “table” element; or, simplify
168 the structue of the table so that no
169 description is needed.
174 <!-- Interactive element exclusions -->
175 <pattern name='interactive element exclusions'>
178 - Interactive descendants:
185 - input[type!=hidden]
195 - Interactive ancestors
200 <rule context='h:a|h:details|h:embed|h:iframe|h:label'>
201 <report test='ancestor::h:a'>
202 The interactive element “<name/>” must not
203 appear as a descendant of the “a” element.
205 <report test='ancestor::h:button'>
206 The interactive element “<name/>” must not
207 appear as a descendant of the “button” element.
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 “<name/>” must not
214 appear as a descendant of the “a” element.
216 <report test='ancestor::h:button'>
217 The interactive element “<name/>” must not
218 appear as a descendant of the “button” element.
220 <report test='ancestor::h:label[@for] and not(ancestor::h:label[@for = current()/@id])'>
221 Any “<name/>” element descendant of a “label” element
222 with a “for” attribute must have an
223 ID value that matches that “for” attribute.
227 <rule context='h:video[@controls]|h:audio[@controls]'>
228 <report test='ancestor::h:a'>
229 The interactive element “<name/>”
230 with the attribute “controls” must not
231 appear as a descendant of the “a” element.
233 <report test='ancestor::h:button'>
234 The interactive element “<name/>”
235 with the attribute “controls” must not
236 appear as a descendant of the “button” element.
240 <rule context='h:menu[translate(@type, "TOLBAR", "tolbar")="toolbar"]'>
241 <report test='ancestor::h:a'>
242 The element “menu”
243 with the attribute “type” whose value is “toolbar” must not
244 appear as a descendant of the “a” element.
246 <report test='ancestor::h:button'>
247 The element “menu”
248 with the attribute “type” whose value is “toolbar” must not
249 appear as a descendant of the “button” element.
253 <rule context='h:img[@usemap]'>
254 <report test='ancestor::h:a'>
255 The element “img”
256 with the attribute “usemap” must not
257 appear as a descendant of the “a” element.
259 <report test='ancestor::h:button'>
260 The element “img”
261 with the attribute “usemap” must not
262 appear as a descendant of the “button” element.
266 <rule context='h:object[@usemap]'>
267 <report test='ancestor::h:a'>
268 The element “object”
269 with the attribute “usemap” must not
270 appear as a descendant of the “a” element.
272 <report test='ancestor::h:button'>
273 The element “object”
274 with the attribute “usemap” must not
275 appear as a descendant of the “button” element.
280 <!-- REVISIT fieldset http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2006-April/006181.html -->
282 <!-- Misc requirements -->
284 <pattern name="miscellaneous requirements">
285 <rule context='h:area'>
286 <assert test='ancestor::h:map'>
287 The “area” element must have an ancestor
288 “map” element.
292 <rule context='h:img[@ismap]'>
293 <assert test='ancestor::h:a[@href]'>
294 The “img” element with the
295 “ismap” attribute set must have an ancestor
296 “a” element with the “href” attribute.
300 <rule context='h:input'>
301 <report test='@list and not(//h:datalist[@id = current()/@list])'>
302 The “list” attribute of the “input”
303 element must refer to a “datalist” element.
305 <report test='@type = "button" and (not(@value) or @value = "")'>
306 Element “input” with attribute “type”
307 whose value is “button” must have non-empty attribute
308 “value”.
312 <rule context='h:track'>
313 <report test='@label = ""'>
314 Attribute “label” for element “track”
315 must have non-empty value.
317 <report test='@default and preceding-sibling::h:track[@default]'>
318 The “default” attribute must not occur on more than one
319 “track” element within the same “audio”
320 element or “video” element.
324 <rule context='h:map[@id and @name]'>
325 <assert test='@id = @name'>
326 The “id” attribute on a “map” element must have
327 the same value as the “name” attribute.
331 <rule context='h:select'>
332 <report test='not(@multiple) and count(descendant::h:option[@selected]) > 1'>
333 The “select” element cannot have more than one
334 selected “option” element descendant unless the
335 “multiple” attribute is specified.
337 <report test='@required and not(@multiple)
339 or (starts-with(normalize-space(@size), "+")
340 and substring-after(@size,"+") = 1)
343 A “select” element with
344 a “required” attribute and without
345 a “multiple” attribute, and whose
346 size is “1”, must have a child
347 “option” element.
351 <rule context='h:select[@required and not(@multiple)
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 “option” element
359 of a “select” element with
360 a “required” attribute and without
361 a “multiple” attribute, and whose
362 size is “1”, must have either an
363 empty “value” attribute, or must
364 have no text content.
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 “script” with attribute
372 “language” whose value is “JavaScript”
373 must not have attribute “type” whose value is not
374 “text/javascript”.
376 <report test='not(@src) and @charset'>
377 Element “script” must not have attribute
378 “charset” unless attribute “src” is
381 <report test='not(@src) and @defer'>
382 Element “script” must not have attribute
383 “defer” unless attribute “src” is
386 <report test='not(@src) and @async'>
387 Element “script” must not have attribute
388 “async” unless attribute “src” is
393 <rule context='h:time'>
394 <report test='ancestor::h:time'>
395 The element “time” must not
396 appear as a descendant of the “time” element.
400 <rule context='h:progress'>
401 <report test='ancestor::h:progress'>
402 The element “progress” must not
403 appear as a descendant of the “progress” element.
405 <assert test='@max and @value and number(@value) <= number(@max)'>
406 The value of the “value” attribute must be less than or equal to
407 the value of the “max” attribute.
409 <assert test='not(@max) and @value and number(@value) <= 1'>
410 The value of the “value” attribute must be less than or equal to
411 one when the “max” attribute is absent.
417 min <= low <= high <= max
418 min <= optimum <= max
421 <rule context='h:meter'>
422 <report test='ancestor::h:meter'>
423 The element “meter” must not
424 appear as a descendant of the “meter” element.
426 <report test='@min and @value and not(number(@min) <= number(@value))'>
427 The value of the “min” attribute must be less than or equal to
428 the value of the “value” attribute.
430 <report test='not(@min) and @value and not(0 <= number(@value))'>
431 The value of the “value” attribute must be greater than or equal to
432 zero when the “min” attribute is absent.
434 <report test='@value and @max and not(number(@value) <= number(@max))'>
435 The value of the “value” attribute must be less than or equal to
436 the value of the “max” attribute.
438 <report test='@value and not(@max) and not(number(@value) <= 1)'>
439 The value of the “value” attribute must be less than or equal to
440 one when the “max” attribute is absent.
442 <report test='@min and @max and not(number(@min) <= number(@max))'>
443 The value of the “min” attribute must be less than or equal to
444 the value of the “max” attribute.
446 <report test='not(@min) and @max and not(0 <= number(@max))'>
447 The value of the “max” attribute must be greater than or equal to
448 zero when the “min” attribute is absent.
450 <report test='@min and not(@max) and not(number(@min) <= 1)'>
451 The value of the “min” attribute must be less than or equal to
452 one when the “max” attribute is absent.
454 <report test='@min and @low and not(number(@min) <= number(@low))'>
455 The value of the “min” attribute must be less than or equal to
456 the value of the “low” attribute.
458 <report test='not(@min) and @low and not(0 <= number(@low))'>
459 The value of the “low” attribute must be greater than or equal to
460 zero when the “min” attribute is absent.
462 <report test='@min and @high and not(number(@min) <= number(@high))'>
463 The value of the “min” attribute must be less than or equal to
464 the value of the “high” attribute.
466 <report test='not(@min) and @high and not(0 <= number(@high))'>
467 The value of the “high” attribute must be greater than or equal to
468 zero when the “min” attribute is absent.
470 <report test='@low and @high and not(number(@low) <= number(@high))'>
471 The value of the “low” attribute must be less than or equal to
472 the value of the “high” attribute.
474 <report test='@high and @max and not(number(@high) <= number(@max))'>
475 The value of the “high” attribute must be less than or equal to
476 the value of the “max” attribute.
478 <report test='@high and not(@max) and not(number(@high) <= 1)'>
479 The value of the “high” attribute must be less than or equal to
480 one when the “max” attribute is absent.
482 <report test='@low and @max and not(number(@low) <= number(@max))'>
483 The value of the “low” attribute must be less than or equal to
484 the value of the “max” attribute.
486 <report test='@low and not(@max) and not(number(@low) <= 1)'>
487 The value of the “low” attribute must be less than or equal to
488 one when the “max” attribute is absent.
490 <report test='@min and @optimum and not(number(@min) <= number(@optimum))'>
491 The value of the “min” attribute must be less than or equal to
492 the value of the “optimum” attribute.
494 <report test='not(@min) and @optimum and not(0 <= number(@optimum))'>
495 The value of the “optimum” attribute must be greater than or equal to
496 zero when the “min” attribute is absent.
498 <report test='@optimum and @max and not(number(@optimum) <= number(@max))'>
499 The value of the “optimum” attribute must be less than or equal to
500 the value of the “max” attribute.
502 <report test='@optimum and not(@max) and not(number(@optimum) <= 1)'>
503 The value of the “optimum” attribute must be less than or equal to
504 one when the “max” attribute is absent.
509 <!-- Obsolete Elements - - - - - - - - - - - - - - - - - - - - - - -->
510 <pattern name="obsolete elements">
511 <rule context='h:acronym'>
512 <report test='true()'>
513 The “acronym” element is obsolete. Use the “abbr” element instead.
517 <rule context='h:applet'>
518 <report test='true()'>
519 The “applet” element is obsolete. Use the “object” element instead.
523 <rule context='h:center|h:font|h:big|h:strike|h:tt|h:basefont'>
524 <report test='true()'>
525 The “<name/>” element is obsolete.
526 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
530 <rule context='h:dir'>
531 <report test='true()'>
532 The “dir” element is obsolete. Use the “ul” element instead.
536 <rule context='h:frameset|h:noframes'>
537 <report test='true()'>
538 The “<name/>” element is obsolete.
539 Use the “iframe” element and CSS instead, or use server-side includes.
544 <!-- Obsolete Attributes- - - - - - - - - - - - - - - - - - - - - - -->
546 <pattern name="obsolete attributes">
548 <report test='@coords'>
549 The “coords” attribute on the “<name/>” element is obsolete.
550 For image maps, use the “area” element instead of the “a” element.
552 <report test='@shape'>
553 The “shape” attribute on the “<name/>” element is obsolete.
554 For image maps, use the “area” element instead of the “a” element.
557 The “urn” attribute on the “<name/>” element is obsolete.
558 Specify the preferred persistent identifier using the “href” attribute instead.
560 <report test='@charset'>
561 The “charset” attribute on the “<name/>” element is obsolete.
562 Use an HTTP Content-Type header on the linked resource instead.
564 <report test='@methods'>
565 The “methods” attribute on the “<name/>” element is obsolete.
566 Use the HTTP OPTIONS feature instead.
569 The “rev” attribute on the “<name/>” element is obsolete.
570 Use the “rel” attribute instead, with a term having the opposite meaning.
574 <rule context='h:link'>
575 <report test='@target'>
576 The “target” attribute on the “<name/>” element is obsolete.
577 You can safely omit it.
580 The “urn” attribute on the “<name/>” element is obsolete.
581 Specify the preferred persistent identifier using the “href” attribute instead.
583 <report test='@charset'>
584 The “charset” attribute on the “<name/>” element is obsolete.
585 Use an HTTP Content-Type header on the linked resource instead.
587 <report test='@methods'>
588 The “methods” attribute on the “<name/>” element is obsolete.
589 Use the HTTP OPTIONS feature instead.
592 The “rev” attribute on the “<name/>” element is obsolete.
593 Use the “rel” attribute instead, with a term having the opposite meaning.
597 <rule context="h:area">
598 <report test='@nohref'>
599 The “nohref” attribute on the “<name/>” element is obsolete.
600 Omitting the “href” attribute is sufficient.
604 <rule context='h:embed'>
605 <report test='@name'>
606 The “name” attribute on the “<name/>” element is obsolete.
607 Use the “id” attribute instead.
611 <rule context='h:head'>
612 <report test='@profile'>
613 The “profile” attribute on the “<name/>” element is obsolete.
614 To declare which “meta” element terms are used in the document, instead register the
615 names as meta extensions. <http://wiki.whatwg.org/wiki/MetaExtensions>
616 To trigger specific UA behaviors, use a “link” element instead.
620 <rule context='h:html'>
621 <report test='@version'>
622 The “version” attribute on the “<name/>” element is obsolete.
623 You can safely omit it.
627 <rule context='h:iframe'>
628 <report test='@longdesc'>
629 The “longdesc” attribute on the “<name/>” element is obsolete.
630 Use a regular “a” element to link to the description.
634 <rule context='h:img'>
635 <report test='@longdesc'>
636 The “longdesc” attribute on the “<name/>” element is obsolete.
637 Use a regular “a” element to link to the description.
639 <report test='@name'>
640 The “name” attribute on the “<name/>” element is obsolete.
641 Use the “id” attribute instead.
645 <rule context='h:input'>
646 <report test='@usemap'>
647 The “usemap” attribute on the “<name/>” element is obsolete.
648 Use the “img” element instead of the “input” element for image maps.
652 <rule context='h:li|h:ul'>
653 <report test='@type'>
654 The “type” attribute on the “<name/>” element is obsolete.
655 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
659 <rule context='h:meta'>
660 <report test='@scheme'>
661 The “scheme” attribute on the “<name/>” element is obsolete.
662 Use only one scheme per field, or make the scheme declaration part of the value.
664 <report test='translate(@http-equiv,"CONTELAGUA", "contelagua")="content-language"' role='warning'>
665 Using the “meta” element to specify the document-wide default language is obsolete.
666 Consider specifying the language on the root element instead.
670 <rule context='h:object'>
671 <report test='@archive'>
672 The “archive” attribute on the “<name/>” element is obsolete.
673 Use the “data” attribute and “type” attribute to invoke plugins.
674 To set a parameter with the name “archive”, use the “param” element.
676 <report test='@classid'>
677 The “classid” attribute on the “<name/>” element is obsolete.
678 Use the “data” attribute and “type” attribute to invoke plugins.
679 To set a parameter with the name “classid”, use the “param” element.
681 <report test='@code'>
682 The “code” attribute on the “<name/>” element is obsolete.
683 Use the “data” attribute and “type” attribute to invoke plugins.
684 To set a parameter with the name “code”, use the “param” element.
686 <report test='@codebase'>
687 The “codebase” attribute on the “<name/>” element is obsolete.
688 Use the “data” attribute and “type” attribute to invoke plugins.
689 To set a parameter with the name “codebase”, use the “param” element.
691 <report test='@codetype'>
692 The “codetype” attribute on the “<name/>” element is obsolete.
693 Use the “data” attribute and “type” attribute to invoke plugins.
694 To set a parameter with the name “codetype”, use the “param” element.
696 <report test='@declare'>
697 The “declare” attribute on the “<name/>” element is obsolete.
698 Repeat the “object” element completely each time the resource is to be reused.
700 <report test='@standby'>
701 The “standby” attribute on the “<name/>” element is obsolete.
702 Optimize the linked resource so that it loads quickly or, at least, incrementally.
706 <rule context='h:option'>
707 <report test='@name'>
708 The “name” attribute on the “<name/>” element is obsolete.
709 Use the “id” attribute instead.
713 <rule context='h:param'>
714 <report test='@type'>
715 The “type” attribute on the “<name/>” element is obsolete.
716 Use the “name” attribute and “value” attribute without declaring value types.
718 <report test='@valuetype'>
719 The “valuetype” attribute on the “<name/>” element is obsolete.
720 Use the “name” attribute and “value” attribute without declaring value types.
724 <rule context='h:script[@language and not(translate(@language, "JAVSCRIPT", "javscript")="javascript")]'>
725 <report test='true()'>
726 The “language” attribute on the “script” element is obsolete.
727 Use the “type” attribute instead.
731 <rule context='h:td|h:th'>
732 <report test='@scope and self::h:td'>
733 The “scope” attribute on the “td” element is obsolete.
734 Use the “scope” attribute on a “th” element instead.
736 <report test='@abbr'>
737 The “abbr” attribute on the “<name/>” element is obsolete.
738 Consider instead beginning the cell contents with concise text, followed by further elaboration if needed.
740 <report test='@axis'>
741 The “axis” attribute on the “<name/>” element is obsolete.
742 Use the “scope” attribute instead.
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 “align” attribute on the “<name/>” element is obsolete.
753 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
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 “width” attribute on the “<name/>” element is obsolete.
762 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
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 “char” attribute on the “<name/>” element is obsolete.
771 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
773 <report test='@charoff'>
774 The “charoff” attribute on the “<name/>” element is obsolete.
775 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
777 <report test='@valign'>
778 The “valign” attribute on the “<name/>” element is obsolete.
779 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
784 <pattern name="obsolete presentational attributes">
785 <rule context='h:body'>
786 <report test='@alink'>
787 The “alink” attribute on the “<name/>” element is obsolete.
788 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
790 <report test='@background'>
791 The “background” attribute on the “<name/>” element is obsolete.
792 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
794 <report test='@bgcolor'>
795 The “bgcolor” attribute on the “<name/>” element is obsolete.
796 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
798 <report test='@link'>
799 The “link” attribute on the “<name/>” element is obsolete.
800 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
802 <report test='@marginbottom'>
803 The “marginbottom” attribute on the “<name/>” element is obsolete.
804 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
806 <report test='@marginheight'>
807 The “marginheight” attribute on the “<name/>” element is obsolete.
808 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
810 <report test='@marginleft'>
811 The “marginleft” attribute on the “<name/>” element is obsolete.
812 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
814 <report test='@marginright'>
815 The “marginright” attribute on the “<name/>” element is obsolete.
816 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
818 <report test='@margintop'>
819 The “margintop” attribute on the “<name/>” element is obsolete.
820 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
822 <report test='@marginwidth'>
823 The “marginwidth” attribute on the “<name/>” element is obsolete.
824 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
826 <report test='@text'>
827 The “text” attribute on the “<name/>” element is obsolete.
828 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
830 <report test='@vlink'>
831 The “vlink” attribute on the “<name/>” element is obsolete.
832 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
836 <rule context='h:br'>
837 <report test='@clear'>
838 The “clear” attribute on the “<name/>” element is obsolete.
839 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
843 <rule context='h:embed'>
844 <report test='@hspace'>
845 The “hspace” attribute on the “<name/>” element is obsolete.
846 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
848 <report test='@vspace'>
849 The “vspace” attribute on the “<name/>” element is obsolete.
850 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
854 <rule context='h:hr'>
855 <report test='@noshade'>
856 The “noshade” attribute on the “<name/>” element is obsolete.
857 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
859 <report test='@size'>
860 The “size” attribute on the “<name/>” element is obsolete.
861 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
863 <report test='@color'>
864 The “color” attribute on the “<name/>” element is obsolete.
865 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
869 <rule context='h:dl|h:menu|h:ol|h:ul'>
870 <report test='@compact'>
871 The “compact” attribute on the “<name/>” element is obsolete.
872 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
876 <rule context='h:iframe'>
877 <report test='@allowtransparency'>
878 The “allowtransparency” attribute on the “<name/>” element is obsolete.
879 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
881 <report test='@frameborder'>
882 The “frameborder” attribute on the “<name/>” element is obsolete.
883 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
885 <report test='@marginheight'>
886 The “marginheight” attribute on the “<name/>” element is obsolete.
887 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
889 <report test='@marginwidth'>
890 The “marginwidth” attribute on the “<name/>” element is obsolete.
891 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
893 <report test='@scrolling'>
894 The “scrolling” attribute on the “<name/>” element is obsolete.
895 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
899 <rule context='h:img|h:object'>
900 <report test='@hspace'>
901 The “hspace” attribute on the “<name/>” element is obsolete.
902 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
904 <report test='@vspace'>
905 The “vspace” attribute on the “<name/>” element is obsolete.
906 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
908 <report test='@border and self::h:object'>
909 The “border” attribute on the “<name/>” element is obsolete.
910 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
914 <rule context='h:table'>
915 <report test='@bgcolor'>
916 The “bgcolor” attribute on the “<name/>” element is obsolete.
917 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
919 <report test='@border and not(@border = "" or @border = "1")'>
920 The value of the “border” attribute on the “<name/>” element
921 must be either “1” or the empty string. To regulate the thickness of table borders,
922 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
924 <report test='@cellpadding'>
925 The “cellpadding” attribute on the “<name/>” element is obsolete.
926 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
928 <report test='@cellspacing'>
929 The “cellspacing” attribute on the “<name/>” element is obsolete.
930 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
932 <report test='@frame'>
933 The “frame” attribute on the “<name/>” element is obsolete.
934 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
936 <report test='@rules'>
937 The “rules” attribute on the “<name/>” element is obsolete.
938 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
942 <rule context='h:td|h:th'>
943 <report test='@bgcolor'>
944 The “bgcolor” attribute on the “<name/>” element is obsolete.
945 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
947 <report test='@height'>
948 The “height” attribute on the “<name/>” element is obsolete.
949 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
951 <report test='@nowrap'>
952 The “nowrap” attribute on the “<name/>” element is obsolete.
953 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
957 <rule context='h:tr'>
958 <report test='@bgcolor'>
959 The “bgcolor” attribute on the “<name/>” element is obsolete.
960 Use CSS instead. http://wiki.whatwg.org/wiki/Presentational_elements_and_attributes
965 <!-- lang and xml:lang in XHTML - - - - - - - - - - - - - - - - - -->
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 “lang” in no namespace and the attribute “lang”
971 in the XML namespace are both present, they must have the same value.
976 <!-- IDREFs - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
978 <!-- Assuming that ID uniqueness is already enforced. -->
980 <pattern name='contextmenu must refer to a menu'>
981 <rule context='h:*[@contextmenu]'>
982 <assert test='//h:menu[@id = current()/@contextmenu]'>
983 The “contextmenu” attribute must refer to a
984 “menu” element.
989 <!-- FIXME form attribute -->
991 <!-- FIXME output for -->
993 <!-- Unique Definitions - - - - - - - - - - - - - - - - - - - - - -->
995 <!-- Only one definition per term per document' -->
997 <!-- ARIA containment - - - - - - - - - - - - - - - - - - - - - -->
999 <pattern name='Mutually Exclusive Role triggers'>
1001 <!-- XXX columnheader and rowheader require row parent -->
1003 <rule context='*[@role="option"]'>
1004 <assert test='../@role="listbox"'>
1005 An element with “role=option” requires
1006 “role=listbox” on the parent.
1010 <rule context='*[@role="menuitem"]'>
1011 <assert test='../@role="menu"'>
1012 An element with “role=menuitem” requires
1013 “role=menu” on the parent.
1017 <rule context='*[@role="menuitemcheckbox"]'>
1018 <assert test='../@role="menu"'>
1019 An element with “role=menuitemcheckbox” requires
1020 “role=menu” on the parent.
1024 <rule context='*[@role="menuitemradio"]'>
1025 <assert test='../@role="menu"'>
1026 An element with “role=menuitemradio” requires
1027 “role=menu” on the parent.
1031 <rule context='*[@role="tab"]'>
1032 <assert test='../@role="tablist"'>
1033 An element with “role=tab” requires
1034 “role=tablist” on the parent.
1038 <rule context='*[@role="treeitem"]'>
1039 <assert test='../@role="tree"'>
1040 An element with “role=treeitem” requires
1041 “role=tree” on the parent.
1045 <rule context='*[@role="listitem"]'>
1046 <assert test='../@role="list"'>
1047 An element with “role=listitem” requires
1048 “role=list” on the parent.
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 “role=row” requires
1058 “role=treegrid” or “role=grid” on the parent or grandparent.
1061 <!-- XXX hoping for a spec change so not bothering with the reciprocal case -->
1063 <rule context='*[@role="gridcell"]'>
1064 <assert test='../@role="row"'>
1065 An element with “role=gridcell” requires
1066 “role=row” on the parent.
1069 <!-- XXX hoping for a spec change so not bothering with the reciprocal case -->
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 “role=listbox” unless it has “role=option”.
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 “role=menu” unless it has
1089 “role=menuitem”,
1090 “role=menuitemcheckbox” or
1091 “role=menuitemradio”.
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 “role=tree” unless it has
1101 “role=treeitem”.
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 “role=list” unless it has
1111 “role=listitem”.
1114 <!-- XXX role=group omitted due to lack of detail in spec -->
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 “role=radiogroup” unless it has
1122 “role=radio”.
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 “role=row” unless it has
1132 “role=gridcell”.
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 “role=tablist” unless it has
1142 “role=role”.
1147 <!-- XXX combobox requires a listbox child -->
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 “aria-activedescendant” attribute must refer to a
1158 <pattern name='controls must not dangle'>
1159 <rule context='*[@aria-controls]'>
1160 <assert test='//*[@id = current()/@aria-controls]'>
1161 The “aria-controls” attribute must point to an element in the
1167 <pattern name='describedby must not dangle'>
1168 <rule context='*[@aria-describedby]'>
1169 <assert test='//*[@id = current()/@aria-describedby]'>
1170 The “aria-describedby” attribute must point to an element in the
1176 <pattern name='flowto must not dangle'>
1177 <rule context='*[@aria-flowto]'>
1178 <assert test='//*[@id = current()/@aria-flowto]'>
1179 The “aria-flowto” attribute must point to an element in the
1185 <pattern name='labelledby must not dangle'>
1186 <rule context='*[@aria-labelledby]'>
1187 <assert test='//*[@id = current()/@aria-labelledby]'>
1188 The “aria-labelledby” attribute must point to an element in the
1194 <pattern name='owns must not dangle'>
1195 <rule context='*[@aria-owns]'>
1196 <assert test='//*[@id = current()/@aria-owns]'>
1197 The “aria-owns” attribute must point to an element in the
1203 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
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 “border” attribute on the “img” element is obsolete.
1210 Consider specifying “img { border: 0; }“ in CSS instead.
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 “language” attribute on the “script” element is obsolete. You can safely omit it.
1218 <rule context='h:a'>
1219 <report test='@name' role='warning'>
1220 The “name” attribute on the “a” element is obsolete. Consider putting an
1221 “id” attribute on the nearest container instead.
1226 <pattern name="Other warnings">
1227 <rule context='h:video|h:audio'>
1228 <report test='count(h:track[@default]) > 1' role='warning'>
1229 “<name/>” element has more than one “track”
1230 child element with a “default” attribute.