[whatwg] Add 'type' attribute to <mark>

Ian Hickson ian at hixie.ch
Sat Nov 1 07:34:09 PDT 2008


On Sat, 1 Nov 2008, Andy Lyttle wrote:
> On Oct 31, 2008, at 7:57 PM, Ian Hickson wrote:
> > > > That's what the "class" attribute is for.
> > > 
> > > What's the difference then between <mark> and <span> then? I mean, 
> > > does the <mark> element provide anything that <span> with an 
> > > appropriate class wouldn't?
> > 
> > A default style when there's no CSS support, support in accessibility 
> > tools, the ability for search engines to understand what's going on, 
> > easier round-tripping between editors, simpler rules in CSS and other 
> > selector-like environments, etc. The usual benefits of semantics.
> 
> Are we talking about assigning particular meanings to certain class 
> names?

All class names have meaning. That's what the class attribute is for -- 
it's a way for authors to extend the language to cover semantics the 
language doesn't have, using terms they have defined for their page, site, 
or organisation.


> Or are we saying "this is for semantic purposes, but do whatever 
> you want with it, because nobody will see it except UAs that are 
> applying CSS rules and users who view the HTML source code"?

If by "this" you mean the class attribute, then neither; it's an extension 
mechanism, authors should use it for the purpose of annotating their 
semantics so that they can use those annotated semantics from other 
contexts (such as tools, scripts, style sheets, etc).


On Sat, 1 Nov 2008, Pentasis wrote:
> >
> > The spec already describes how to do footnotes:
> > 
> >   http://www.whatwg.org/specs/web-apps/current-work/#footnotes
> 
> Yes, but this is a theoretical explanation that does not provide a 
> consistent, practical solution.

I don't understand why these solutions aren't consistent or practical.


> > > As the <mark> element has different usages defined on it already why 
> > > not include a "type" attribute (or similar) that defines what it is 
> > > used for. One of these types would then be "footnote", others could 
> > > be (relating to what is already in the spec) "term", "highlight" 
> > > etc. (I am sure others would be much better at thinking up names 
> > > than I am).
> > 
> > That's what the "class" attribute is for.
> 
> Like I said before, I think class (and id) should be reserved for 
> styling and not be content/semantic related at all.

I'm afraid that's not what class and id are for, they are entirely 
intended as a way for authors to annotate their semantics in more detail.


> It is strange how we all advocate separation of the two but allow these 
> attributes to encompass descriptive values for both.

You should never use class (or id) for specifically stylistic reasons. You 
should use class to annotate the semantics, and then separately use the 
style sheets to hook onto your annotated semantics to get the style you 
want in more fine grained detail than the elements allow.

This is why values like class="big" or class="green" are bad, but values 
like class="footnote" or class="user-search-terms" are fine.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list