Bugzilla – Bug 339
improve error message for attributes not allowed on particular <input> element subtypes
Last modified: 2012-04-18 13:16:27 CEST
Consider <!doctype html><title></title><input type=image value=foo> You get Error: Attribute value not allowed on element input at this point. From line 1, column 31; to line 1, column 58 e></title><input type=image value=foo> Element-specific attributes for element input: accept action alt ... value This is confusing: the validator says value isn't allowed but still says value is an allowed attribute. You could make the <input> attribute list more useful by scraping the type states in the spec and removing attributes from the list that don't apply to the state. In the bookkeeping div, first paragraph of each such div, links whose href starts with #attr-. Then you'd say "Element-specific attributes for element input in the Image state:".
Oops, it's not in the first para for all states. I guess you could look at all links in the div.
Oops. You want just the <li> that starts with "The following content attributes must not be specified and do not apply to the element:".
See also bug 741.
(In reply to comment #2) > Oops. You want just the <li> that starts with "The following content attributes > must not be specified and do not apply to the element:". I think rather than scraping that part, we could implement this a little more easily just by hard-coding the per-type lists of "must not be specified" attributes instead. It'd be less fragile too (that is, the build wouldn't fail if Hixie changed the "The following content attributes must not be specified and do not apply to the element:" to something else).
Perhaps the generic message could be improved somewhat by changing the words "at this point" to e.g. "in this context" (or maybe "in this case", but it might be too restrictive). The words "at this point" strongly suggest that it's the placement of the element or of the attribute that matters, so people might look for a solution in a wrong direction. The wording "in this context" might at least a more useful hint.
https://bitbucket.org/validator/validator/changeset/5f1a14c441c8 see http://qa-dev.w3.org:8888/?doc=data%3Atext%2Fhtml%3Bcharset%3Dutf-8%2C%3C%21doctype%2520html%3E%250D%250A%3Ctitle%3E%3C%252Ftitle%3E%250D%250A%3Cinput%2520type%253Dimage%2520value%253Dfoo%2520alt%253Dbar%3E