K
Kevin Hamr
I'm looking for simple ways to provide additional functionality to web
pages without sacrificing the legibility of the HTML, so that people
can reuse my JavaScript functionality with only really understanding
HTML.
I know in HTML5 they introduced custom data-* attributes, but it'd be
much easier to use <foobar.../> instead of <span data-foobar=.../>.
Any suggestions? Do you think using custom elements even though its
not valid HTML5 is still legitimate?
Lastly, my sample is just a highlight, but the actual applications I'm
looking at are things for embedding RSS feeds, remote content, etc;
things that will interact with some server side functionality that I
want to can and keep out of sight from the HTML web developer.
Thoughts?
Sample:
<!DOCTYPE html>
<html>
<head>
<title>Enhanced Tags with HTML5</title>
</head>
<body onload="init()">
This is using a <highlight>custom element</highlight>.
<script type="text/javascript">
window.init = function() {
elems = document.body.getElementsByTagName("highlight");
for (var i = 0; i<elems.length; i++) {
console.log(elems);
elems.style.backgroundColor = "yellow";
}
}
</script>
</body>
</html>
pages without sacrificing the legibility of the HTML, so that people
can reuse my JavaScript functionality with only really understanding
HTML.
I know in HTML5 they introduced custom data-* attributes, but it'd be
much easier to use <foobar.../> instead of <span data-foobar=.../>.
Any suggestions? Do you think using custom elements even though its
not valid HTML5 is still legitimate?
Lastly, my sample is just a highlight, but the actual applications I'm
looking at are things for embedding RSS feeds, remote content, etc;
things that will interact with some server side functionality that I
want to can and keep out of sight from the HTML web developer.
Thoughts?
Sample:
<!DOCTYPE html>
<html>
<head>
<title>Enhanced Tags with HTML5</title>
</head>
<body onload="init()">
This is using a <highlight>custom element</highlight>.
<script type="text/javascript">
window.init = function() {
elems = document.body.getElementsByTagName("highlight");
for (var i = 0; i<elems.length; i++) {
console.log(elems);
elems.style.backgroundColor = "yellow";
}
}
</script>
</body>
</html>