html 5 <a> structure

R

richard

Anyone have a site that shows what all can be placed in the anchor tag for
html5?
And what those items can do?

<a href="#" data-select="#item1" rel="ajaxpanel" data-loadtype="iframe" >

Like what other offshoots of "data" are there?
I'm looking for a full explanation of what the things are used for, not
just what is available.
 
I

Idle

Anyone have a site that shows what all can be placed in the anchor tag for
html5?
And what those items can do?

<a href="#" data-select="#item1" rel="ajaxpanel" data-loadtype="iframe" >

Like what other offshoots of "data" are there?
I'm looking for a full explanation of what the things are used for, not
just what is available.

http://www.w3schools.com/tags/tag_a.asp

--
idle
One time, I was watching a shootout live on CNN, and it went on for so
long that the criminal eventually shot himself. And the cops are
complaining by saying, "He's got on body armor, he's got on body armor!"
And I'm thinking, "I can see his head! Shoot him in his fuckin' head!"
 
T

Tim Streater

richard said:
Anyone have a site that shows what all can be placed in the anchor tag for
html5?
And what those items can do?

<a href="#" data-select="#item1" rel="ajaxpanel" data-loadtype="iframe" >

Like what other offshoots of "data" are there?
I'm looking for a full explanation of what the things are used for, not
just what is available.

As many as you like - you define them. If f'rinstance in my JavaScript I
have a pointer to a table cell, cellPtr, then I can do:

cellPtr.dataset.wiggy = "some string";

and that datum gets stored with that table cell. Later I can recover it
by the reverse process:

somevar = cellPtr.dataset.wiggy;

If you examine that table cell with your browser's Web Inspector, you'll
see it'll look like:

<td data-wiggy="some string">Visible cell text</td>

You use it for whatever you need to use it for.
 
R

richard

As many as you like - you define them. If f'rinstance in my JavaScript I
have a pointer to a table cell, cellPtr, then I can do:

cellPtr.dataset.wiggy = "some string";

and that datum gets stored with that table cell. Later I can recover it
by the reverse process:

somevar = cellPtr.dataset.wiggy;

If you examine that table cell with your browser's Web Inspector, you'll
see it'll look like:

<td data-wiggy="some string">Visible cell text</td>

You use it for whatever you need to use it for.

Thanks for the insight. So it's actually working in conjunction with
javascript. Right?
 
T

Tim Streater

richard said:
Thanks for the insight. So it's actually working in conjunction with
javascript. Right?

Well that's what I do (I've not heard of what else it might be used
for). I find it very useful. But the stuff that can be stored is only
strings, so somevar, above, will contain a string value even if I
previously set wiggy to a numeric value.
 
J

Jukka K. Korpela

Anyone have a site that shows what all can be placed in the anchor tag for
html5?

Yes, http://www.w3.org
And what those items can do?

They don't do anything. They are data. Data does do things, except in
Star Trek.
<a href="#" data-select="#item1" rel="ajaxpanel" data-loadtype="iframe" >

Like what other offshoots of "data" are there?

You haven't actually read the HTML5 draft, have you? Or even a decent
tutorial on it? Try this:
http://www.w3.org/TR/html5/global-a...tom-non-visible-data-with-the-data-attributes
I'm looking for a full explanation of what the things are used for, not
just what is available.

The very point is that there is no such explanation.

Attributes with names starting with "data-" are a playground for
authors, where they can add attributes without fear of ever having any
default processing for them in browsers, search engines, etc.

You could use them for styling, with attribute selectors. But much more
importantly, they can be used to associate invisible data with elements,
so that this data can be retrieved and modified in client-side JavaScript.

They are by no means limited to <a> tags.

You might ask why authors won't just put the data in JavaScript objects.
Now, that would be a very good question. Instead of messing around with
"data-" attributes, why don't you just use e.g. id attributes for
elements and store element-specific data in a JavaScript object, using
the id value as key? Well, sometimes "data-" attributes are a little
simpler to use.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top