[whatwg] Context help in Web Forms

Matthew Paul Thomas mpt at myrealbox.com
Mon Jun 2 05:40:55 PDT 2008


Ian Hickson wrote on 27/05/08 07:47:
> 
> On Mon, 12 Nov 2007, Matthew Paul Thomas wrote:
> 
>> On Oct 30, 2007, at 6:01 PM, Ian Hickson wrote:
>>> 
>>> On Mon, 13 Jun 2005, Matthew Thomas wrote:
>...
>>>> Many applications provide inline help which is not a label, and the 
>>>> same attributes would be appropriate here: <div rel="help" 
>>>> for="phone-number"><p>The full number, including country code.</p> 
>>>> <p>Example: <samp>+61 3 1234 5678</samp></p></div>
>>> 
>>> How would UAs use this?
>> 
>> UAs likely wouldn't, but scripts could. For example, a form might 
>> include sparing help by default, with a style sheet hiding more 
>> exhaustive help (as indicated by rel="help"). Then a script could add a 
>> small help button after each control that has associated help (i.e. each 
>> control with name="x" where there exists an element on the page with 
>> rel="help" for="x"). When a control's help button was clicked, the 
>> control's help would be shown.
>...
> The data-* attributes are intended for scripts like this.
>...

The disadvantage of using a data-* attribute is that more kinds of
mistakes would be undetectable by a validator. It would have no idea
that (a) the value of the attribute must be the ID of an element
elsewhere in the document, and (b) each value must be unique within the
document.

I wonder if the data-* attribute naming scheme could be classified
somehow to allow basic type checking like this. I expect there will be
other cases where authors want an attribute value to match the ID of an
element in the page.

Cheers
-- 
Matthew Paul Thomas
http://mpt.net.nz/



More information about the whatwg mailing list