OscarGodson / HTML6

A spec to HTML6
http://html6spec.com
169 stars 25 forks source link

use role="a", role="text" to display a link, input:text #43

Open reyhappen opened 9 years ago

reyhappen commented 9 years ago

we should use role attribute to display a custom tag like an anchor or like text input

reyhappen commented 9 years ago

<customtag role="a" href="#">this is an anchor</customtag> <customtag role="input" value="123" /> <customtag role="submit" value="post" />

cshaa commented 9 years ago

I don't see the point of doing so. You can just style them and use JavaScript to make them behave in the right way. However it would be cool to be able to extend the default elements... The good news is that they're already working on it. See HTML5Rocks!

Example of registerElement:

<script>
 document.registerElement("custom-anchor",{
   extends: HTMLAnchorElement,
   prototype: HTMLAnchorElement.prototype
 }
</script>
<custom-anchor href=#>I am an anchor!</custom-anchor>

I haven't tested it so don't know if it actually works. It's an early draft and afaik supported only in Chrome.