NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 339 - improve error message for attributes not allowed on particular <input> element subtypes
improve error message for attributes not allowed on particular <input> elemen...
Status: RESOLVED FIXED
Product: Validator.nu
Classification: Unclassified
Component: Browser-based UI
HEAD
All All
: P2 enhancement
Assigned To: Michael[tm] Smith
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-27 16:49 CET by Simon Pieters
Modified: 2012-04-18 13:16 CEST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Pieters 2008-11-27 16:49:48 CET
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:".
Comment 1 Simon Pieters 2008-11-27 16:53:41 CET
Oops, it's not in the first para for all states. I guess you could look at all links in the div.
Comment 2 Simon Pieters 2008-11-28 01:27:22 CET
Oops. You want just the <li> that starts with "The following content attributes must not be specified and do not apply to the element:".
Comment 3 Andreas Kuckartz 2010-05-05 11:40:14 CEST
See also bug 741.
Comment 4 Michael[tm] Smith 2011-06-16 16:11:08 CEST
(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).
Comment 5 Jukka K. Korpela 2011-10-20 23:18:56 CEST
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.