Warning:
    This wiki has been archived and is now read-only.
Conformance Study Rules
From HTML WG Wiki
								
												
				
$rules = []
def rule *args
  keywords = args.slice!(-1)
  args.each do |pattern|
    $rules << [pattern, keywords[:code], keywords[:weight]]
  end
end
rule %r{<strong>Warning</strong>:},
     :code => :warning, :weight => 0
rule %r{Using <code>windows-1252</code> instead of the declared encoding},
     :code => :encoding_warning, :weight => 1
rule %r{Changing character encoding <code>utf-8</code> and reparsing},
     :code => :encoding_warning, :weight => 1
rule %r{Bad value .*<code>rectangle.* for attribute .*<code>shape.* on element .*<code>area},
     :code => :bad_area_shape, :weight => 20
rule %r{Bad value <code>\d+\.\d+</code> for attribute <code>content</code> on element .*<code>meta</code>},
     %r{Bad value <code>\d+;url=.*</code> for attribute <code>content</code> on element .*<code>meta</code>},
     :code => :meta_refresh, :weight => 10
rule %r{Almost standards mode doctype\.},
     :code => :almost_standards_doctype, :weight => 95
rule %r{Quirky doctype\.},
     :code => :quirks_doctype, :weight => 95
rule %r{Obsolete doctype\.},
     %r{Legacy doctype\.},
     %r{skipping entity: \[dtd\]},
     :code => :versioned_doctype, :weight => 15
rule %r{Self-closing syntax \(<code>/\></code>\) used on a non-void HTML element},
     :code => :self_closing, :weight => 16
rule %r{Start tag seen without seeing a doctype first\.},
     :code => :missing_doctype, :weight => 19
rule %r{Element <code>nobr</code> not allowed as child of element},
     %r{Element <code>center</code> not allowed as child of element},
     %r{Presentational_elements_and_attributes},
     :code => :presentational_markup, :weight => 45
rule %r{Element .*<code>style</code>.* not allowed as child of element .*},
     %r{Required attributes missing on element .*<code>style.},
     :code => :style_outside_head, :weight => 44
rule %r{Attribute .*<code>http-equiv</code>.* not allowed on element .*<code>meta},
     %r{Required attributes missing on element .*<code>meta},
     :code => :meta_outside_head, :weight => 43
rule %r{Element .*<code>align=right<.* not allowed as child of element},
     :code => :nonstandard_element, :weight => 20
rule %r{not allowed as child of element .*<span},
     %r{Element .*<code>div<.* not allowed as child of element <},
     %r{Element .*<code>n<.* not allowed as child of element <},
     %r{Element .*<code>p<.* not allowed as child of element <},
     %r{Element .*<code>form<.* not allowed as child of element <},
     %r{Element .*<code>style<.* not allowed as child of element <},
     %r{Required children missing from element .*<dl},
     :code => :content_model, :weight => 20
rule %r{End of file seen and there were open elements},
     :code => :unclosed_tag, :weight => 25
rule %r{[Cc]onsecutive hyphens},
     %r{trailing hyphen in a comment},
     :code => :consecutive_hyphens, :weight => 28
rule %r{No space between the doctype public and system identifiers},
     :code => :bogus_doctype, :weight => 28
rule %r{<code>=</code> in an unquoted attribute value},
     :code => :unquoted_equals, :weight => 28
rule %r{No space between attributes},
     :code => :no_space, :weight => 29
rule %r{Attribute <code>y-},
     %r{Attribute <code>_sp},
     :code => :nonstandard_attribute, :weight => 46
rule %r{Attribute <code>xmlns:.*</code> not allowed here},
     %r{local name <code>xmlns:.*</code> is not serializable as XML 1.0},
     %r{Attribute <code>xmlns</code> is not serializable as XML 1.0},
     :code => :xmlns, :weight=>36
rule %r{Bad value <code>.*</code> for attribute <code>http-equiv</code>},
     :code => :nonstandard_meta_http_equiv, :weight=>38
rule %r{Element .*<code>script<.* not allowed as child of element <},
     %r{Stray <code>script</code> start tag},
     :code => :element_after_body_close, :weight=>39
rule %r{unnamed script},
     :code => :unnamed_script, :weight=>40
rule %r{Required attributes missing on element .*<code>input},
     %r{Required attributes missing on element .*<code>area},
     :code => :missing_alt, :weight => 47
rule %r{Required attributes missing on element .*<code>script.*defer},
     :code => :inline_script_defer, :weight => 47
rule %r{Required attributes missing on element .*<code>script.*charset=},
     :code => :inline_script_charset, :weight => 47
rule %r{Required attributes missing on element .*<code>link},
     %r{Required attributes missing on element .*<code>area},
     %r{Required attributes missing on element .*<code>style},
     %r{Required attributes missing on element .*<code>script},
     :code => :optional_attrs, :weight => 46
rule %r{<code>center</code>},
     :code => :presentational_markup, :weight => 45
rule %r{An <code>object</code> element must have a <code>data</code> attribute or a <code>type</code> attribute},
     %r{The <code>classid</code> attribute on the <code>object</code> element is obsolete},
     %r{The <code>codebase</code> attribute on the <code>object</code> element is obsolete},
     :code => :nonstandard_object, :weight => 84
rule %r{Attribute <code>name</code> not allowed on element .*<code>},
     %r{The <code>name</code> attribute on the .* element is obsolete},
     :code => :name_attr, :weight => 87
rule %r{The .*<code>scheme.* attribute on the .*<code>meta.* element is obsolete.},
     :code => :meta_scheme, :weight => 90     
rule %r{The .*<code>link.* attribute on the .*<code>link.* element is obsolete},
     :code => :link_charset, :weight => 92
rule %r{The .*<code>acronym.* element is obsolete},
     %r{The .*<code>nohref.* attribute on the .*<code>area.* element is obsolete.},
     %r{The .*<code>abbr.* attribute on the .*<code>th.* element is obsolete.},
     %r{The .*<code>urn.* attribute on the .*<code>a.* element is obsolete},
     :code => :obsolete_misc, :weight => 97
rule %r{The .*<code>language.* attribute on the .*<code>script.* element is obsolete},
     :code => :bad_script_language, :weight => 94
rule %r{The .*<code>profile.* attribute on the .*<code>head.* element is obsolete.},
     :code => :profile, :weight => 96
rule %r{attribute on the .* element is obsolete},
     %r{The <code>Content-Language</code> state is obsolete},
     %r{The .* attribute is obsolete},
     %r{The .* element is obsolete},
     :code => :versioned, :weight => 99
rule %r{Attribute <code>src</code> not allowed on element .*<code>span<},
     %r{Attribute <code>alt</code> not allowed on element .*<code>span<},
     %r{Attribute <code>width</code> not allowed on element .*<code>span<},
     %r{Attribute <code>height</code> not allowed on element .*<code>span<},
     :code => :span_as_image, :weight => 47
# http://www.aptana.com/reference/html/api/HTML.field.vspace.html
rule %r{Attribute <code>border</code> not allowed on element},
     %r{Attribute <code>color</code> not allowed on element .*<code>hr<},
     %r{Attribute <code>background</code> not allowed on element},
     %r{Attribute <code>hspace</code> not allowed on element},
     %r{Attribute <code>vspace</code> not allowed on element},
     %r{Attribute <code>height</code> not allowed on element},
     :code => :presentational_markup, :weight => 45
# http://www.aptana.com/reference/html/api/HTML.field.allowtransparency.html
rule %r{Attribute <code>allowtransparency</code> not allowed on element},
     :code => :browser_specific_markup, :weight => 45
rule %r{Attribute <code>marginheight</code> not allowed on element},
     %r{Attribute <code>leftmargin</code> not allowed on element},
     %r{Attribute <code>marginwidth</code> not allowed on element},
     %r{Attribute <code>width</code> not allowed on element},
     %r{Attribute <code>topmargin</code> not allowed on element},
     :code => :presentational_markup, :weight => 45
rule %r{Attribute <code>onpropertychange</code> not allowed on element},
     %r{Attribute <code>cid</code> not allowed on element},
     %r{Attribute <code>cpgn</code> not allowed on element},
     %r{Attribute <code>xyz</code> not allowed on element},
     :code => :nonstandard_attribute, :weight => 46
# http://msdn.microsoft.com/en-us/library/ms533486(VS.85).aspx
# https://developer.mozilla.org/en/How_to_Turn_Off_Form_Autocompletion
rule %r{Attribute <code>autocomplete</code> not allowed on element},
     :code => :autocomplete_attr, :weight=>49
rule %r{<code>nobr</code>},
     :code => :nonstandard_element, :weight => 49
rule %r{<code>&</code> did not start a character reference},
     :code => :unescaped_amp, :weight => 55
rule %r{No .* element in list scope but a .* end tag seen},
     %r{Stray end tag <code>},
     %r{No element <code>font</code> to close},
     %r{No element <code>a</code> to close},
     %r{violates nesting rules},
     %r{End tag <code>.*</code> seen but there were unclosed elements},
     %r{End tag for <code>.*</code> seen, but there were unclosed elements},
     :code => :stray_end_tag, :weight => 65
rule %r{A table row was \d+ columns wide, which is less than the column count established by the first row},
     %r{A table row was \d+ columns wide and exceeded the column count established by the first row},
     %r{Table column \d+ .* has no cells beginning in it},
     :code => :table_width, :weight => 71
rule %r{COMPATIBILITY_CHARACTER in PATH\.},
     :code => :compat_char, :weight => 74
rule %r{The character encoding <code>.*</code> is not widely supported},
     %r{Using <code>gbk</code> instead of the declared encoding},
     :code => :char_encoding, :weight => 73
     
rule %r{Bad value <code> +http:.*? for attribute <code>href},
     %r{Bad value <code> +http:.*? for attribute <code>src},
     %r{<code>href</code> on element .*<code>a<.*: DOUBLE_WHITESPACE},
     %r{<code>href</code> on element .*<code>area<.*: DOUBLE_WHITESPACE},
     %r{<code>src</code> on element .*<code>img<.*: DOUBLE_WHITESPACE},
     %r{<code>href</code> on element .*<code>a<.*: CONTROL_CHARACTER},
     %r{<code>href</code> on element .*<code>a<.*: WHITESPACE in QUERY},
     %r{<code>src</code> on element .*<code>img<.*: WHITESPACE in PATH},
     :code => :space_in_url, :weight => 75
rule %r{Zero is not a positive integer},
     :code => :nonpositive, :weight => 79
rule %r{An ID must not be the empty string},
     :code => :empty_id, :weight => 81
rule %r{Duplicate ID <code>.*</code>},
     %r{The first occurrence of ID <code>.*</code> was here},
     :code => :duplicate_id, :weight => 82
rule %r{Browsing context name must be at least one character long},
     :code => :empty_target, :weight => 83
rule %r{An ID must not contain whitespace},
     :code => :id_whitespace, :weight => 83
rule %r{Bad value .*<code>Javascript.* for attribute .*<code>type.* on element .*<code>script.*: Subtype missing.},
     :code => :bad_script_type, :weight => 70
rule %r{Attribute <code>modid},
     %r{Attribute <code>data},
     %r{Attribute <code>image</code> not allowed on element .*<code>img<},
     %r{Attribute <code>defaulturl</code> not allowed on element .*<code>form<},
     %r{Attribute <code>url</code> not allowed on element .*<code>img<},
     %r{Attribute <code>pos</code> not allowed on element .*<code>a<},
     %r{Attribute <code>qlicon</code> not allowed on element .*<code>img<},
     %r{Attribute <code>thumb</code> not allowed on element .*<code>img<},
     %r{Attribute <code>ql</code> not allowed on element .*<code>button<},
     %r{Attribute <code>smartpid</code> not allowed on element .*<code>input<},
     %r{Attribute <code>articleid</code> not allowed on element .*<code>span<},
     %r{Attribute <code>overflowurl</code> not allowed on element .*<code>span<},
     %r{Attribute <code>jotid</code> not allowed on element},
     :code => :nonstandard_attribute, :weight => 46
rule %r{Bad character .* Probable cause: Unescaped},
     :code => :private_extension, :weight => 84
rule %r{Start tag <code>p</code> seen in <code>table</code>},
     %r{Start tag <code>div</code> seen in <code>table</code>},
     :code => :parse_error_reparenting, :weight => 85
rule %r{The element <code>button</code> must not appear as a descendant of the <code>a</code> element},
     %r{The element <code>img</code> with the attribute <code>usemap</code> must not appear as a descendant of the <code>a</code> element.},
     %r{An <code>a</code> start tag seen with already an active <code>a</code> element},
     :code => :nested_interactive_elements, :weight => 82
rule %r{must have an ID value that matches that <code>for</code> attribute},
     %r{The <code>for</code> attribute of the <code>label</code> element must refer to a form control},
     %r{there is no <code>map</code> element with a <code>name</code> attribute with that value},
     :code => :reference_integrity, :weight => 75
rule %r{</code> must not appear as a descendant of the <code>},
     :code => :schema, :weight => 85
rule %r{Bad value <code>true</code> for attribute <code>defer</code>},
     %r{Bad value .* for attribute <code>dir</code> on element},
     :code => :bad_attr_value, :weight => 85
rule %r{Bad value <code>.*</code> for the attribute <code>xmlns</code>},
     :code => :bad_xmlns, :weight => 89
rule %r{An <code>img</code> element must have a <code>src</code> attribute},
     :code => :img_missing_src, :weight => 86
# rule %r{Required attributes missing on element},
rule %r{An <code>img</code> element must have a <code>src</code> attribute},
     :code => :required_attrs, :weight => 86
rule %r{Attribute <code>widh</code> not allowed on element},
     :code => :nonstandard_attribute_mispelled, :weight => 47
rule %r{Attribute <code>\w+:[^<]*;[^<]*</code>},
     :code => :style_as_attribute, :weight => 90
rule %r{Attribute <code>;</code>},
     :code => :stray_semicolon, :weight => 91
rule %r{Stray doctype},
     :code => :stray_doctype, :weight => 91
rule %r{Bogus comment},
     :code => :bogus_comment, :weight => 92
rule %r{Forbidden code point},
     :code => :forbidden_code_point, :weight => 93
rule %r{<code>src</code> on element .*<code>img<.*: CONTROL_CHARACTER in PATH},
     :code => :space_in_uri_path, :weight => 94
rule %r{Attribute <code>http:<},
     %r{<code>"</code> in an unquoted attribute value},
     %r{Attribute <code>www\.},
     %r{A slash was not immediate followed by <code>><},
     :code => :syntax_attr, :weight => 95
      
rule %r{Internal encoding declaration .* disagrees with the actual encoding of the document},
     :code => :encoding_error, :weight=>98