Reputation:
Is it possible to create HTML functions like you can do with... I don't know... JS?
Could you do something like this?
<!DOCTYPE html>
<html version=5>
<body>
<function name="para" attr1="text">
<p localName="para"></p>
<script type="functionHTML/javaScript">
function.data("attr1")includes = getLocalElementByName("para")
</script>
</function>
<-para text="Hello World!"></-para>
</body>
</html>
This would come out on the webpage as:
Hello World!
Upvotes: 1
Views: 68
Reputation: 191
You can't create html functions, but the JS is here to create functions and manipulate the DOM, so you can do that whit JS (use jQuery, it's easier)
Upvotes: 0
Reputation: 522081
Not in general HTML, no. However, there are specifications, centrally the Custom Elements spec, and projects build around it, which enable you to define and reuse your own HTML elements.
Upvotes: 1