These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:06 pm Advanced search

Global attribute suggestion: for

Do you think the HTML spec should do something differently? You can discuss spec feedback here, but you should send it to the WHATWG mailing list or file a bug in the W3C bugzilla for it to be considered.

Global attribute suggestion: for

Postby haka » Mon Nov 19, 2007 11:35 pm

I hope me half-backed german understand it right ;-):

- The template attribute should (re)use elements from other parts of the current or other document.
- The ref attribute is a pointer on an element used by a template.

So there is no semantic relation between elements like to <label for=""> and the form element with the ID.

In the curent situation only link elements supports href. And if the href attribute goes to be a global attribute, will there be a use for the for attribute? In my opinion, a hyperlink is not very semantic, its in prior technical. A hyperlink must link to the reference, a for attribute does not.

A relation with a global (inside template) "for" attribute this can be used as image legend
Code: Select all
<img src="x.gif" alt="" id="xgif" /> <p for="#xgif">My cats</p>

or for footnotes:

Code: Select all
<p>Lorem ipsum dolor sit<sup for="footnote1">1</sup></p>
<hr />
<p class="footnote" id="footnote1"><em>The</em> blind text</p>
haka
<h5>
 
Posts: 15
Joined: Mon Nov 19, 2007 10:39 pm

Postby zcorpan » Tue Nov 27, 2007 3:50 pm

Can you elaborate on what the problem is that you're trying to solve?
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby haka » Thu Nov 29, 2007 7:51 pm

Using the for attribute as semantic connection to an other element. The description is for the image, the cite is for the text. Its a bit like microformats. You can find related elements in the document.
Last edited by haka on Fri Dec 07, 2007 3:41 am, edited 1 time in total.
haka
<h5>
 
Posts: 15
Joined: Mon Nov 19, 2007 10:39 pm

Postby zcorpan » Fri Nov 30, 2007 3:26 pm

For images with captions, that is covererd by the <figure> element. I believe footnotes is still an open issue, something that might be solved by CSS. However, I'm not convinced that there needs to be a generic global attribute in HTML for all types of "semantic connections".
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby haka » Sun Dec 02, 2007 7:21 pm

I think it would be a "nice to have" in a lot of usecases. But I'd like to here other meanings about it.
haka
<h5>
 
Posts: 15
Joined: Mon Nov 19, 2007 10:39 pm

Postby mmilo » Tue Dec 04, 2007 6:08 am

I was thinking along this same path. Especially with the new proposed section and aside tags. It would be great to have a 'for' attribute to specify which section the aside pertains to. I suppose this could be achieved by simply nesting the elements as well, but I would agree with haka that a general purpose semantic connector would be useful in some circumstances.
mmilo
<h6>
 
Posts: 1
Joined: Tue Dec 04, 2007 6:02 am

Postby zcorpan » Mon Dec 10, 2007 6:47 pm

Could you please list some specific use-cases where this would be useful? Perhaps link to existing pages that would benefit from this feature?

How would this feature be implemented?

Why would authors use this feature?
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby haka » Sat Dec 22, 2007 5:45 pm

With citations, the source can be accociated. This can be used by document conversion or with javascript extension as mouseover content (like a "formated" title).

Code: Select all
...
<p>Lorem ipsum dolor sit</p>
<blockquote for="cite1">Lorem ipsum dolor sit</blockqoute>
<p>Lorem ipsum dolor sit</p>
<blockquote for="cite1">Lorem ipsum dolor sit</blockqoute>
<p>Lorem ipsum dolor sit</p>
<blockquote for="cite2">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</blockqoute>
...


And then, in another place of the document:

Code: Select all
<ul>
<li><cite id="cite1">From the book blindtext by John Doe</cite></li>
<li><cite id="cite2">From the book blindtext in the depth by John Doe</cite></li>
</ul>


Using it like the W3C-example for <cite>:

Code: Select all
As <CITE id="HarrySTruman" >Harry S. Truman</CITE> said,
<Q lang="en-us" for="HarrySTruman">The buck stops here.</Q>
He said also <Q lang="en-us" for="HarrySTruman">Good Evening, My Fellow Americans</Q>


A combination of <article> and <form>. The <article> may be able to set the focus on the form.

Code: Select all
<article for="downloadLogin"><p>To get the software you must login</p></article>


And then, in another place of the document:

Code: Select all
<form id="downloadLogin">... Login ...</form>


An image description can be combinded with a text. This can be used for more accesibility and to parse documents in a microformats way.

Code: Select all
<img id="myImage" src="people.gif" alt="people">
<p for="myImage">This is John Doe on the convention</p>


With an additional relation to an <article>, you can parse the related content, for example if you want to change the page layout and you have to retrieve the content inherit from design.

Code: Select all
<section>
<article id="convention">
<h1>The convention</h1>
<p>Lorem ipsum dolor sit</p>
</article>
</section>

<aside for="convention">
<img id="myImage" src="people.gif" alt="people">
<p for="myImage">This is John Doe on the convention</p>
</aside>


A usecase with microformats:

Code: Select all
<article>Hello, I'm <span for="commerceNet">John Doe</span></article>

<aside id="commerceNet" class="vcard">
  <a class="fn org url" href="http://www.commerce.net/">CommerceNet</a>
  <div class="adr">
    <span class="type">Work</span>:
    <div class="street-address">169 University Avenue</div>
    <span class="locality">Palo Alto</span>,
    <abbr class="region" title="California">CA</abbr>
    <span class="postal-code">94301</span>
    <div class="country-name">USA</div>
  </div>
  <div class="tel">
   <span class="type">Work</span> +1-650-289-4040
  </div>
  <div class="tel">
    <span class="type">Fax</span> +1-650-289-4041
  </div>
  <div>Email:
   <span class="email">info@commerce.net</span>
  </div>
</aside>


There are several usecases: semantic relations, setting a focus, hightlight related elements, formated "titles" instead of title attribute, retrieve related data. In opposite to <a> anchors, it must not be a link and you can used it with nearly each element.

I don't know how existing UAs handle a for-attribute outside of <label>. "for" is a well-known attribute name, but if it don't work, it must be renamed, for example to "iref" (inline reference).
haka
<h5>
 
Posts: 15
Joined: Mon Nov 19, 2007 10:39 pm


Return to Feedback on the Specs

Who is online

Users browsing this forum: No registered users and 1 guest