What are "data-require" "data-semver" in HTML files?
JavascriptHtmlCssPlunkerJavascript Problem Overview
I have seen tags like this in HTML. What are these attributes?
This is NOT a duplicate of the data-*
question.
Edit:
I am looking for these two specific attributes, not data-*
in general, nor data-required, as Google suggests. If you search the web, you can find these attributes are used in many places. I guess this is some like of dependency management software?
<link data-require="bootstrap-css@*" data-semver="3.0.0" rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" />
<script data-require="[email protected]" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js" data-semver="1.1.5"></script>
<script data-require="[email protected]" data-semver="0.5.0" src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.6.0.js"></script>
Javascript Solutions
Solution 1 - Javascript
I was curious about this as well. These appear to be data- attributes that are created by plunker when including external libraries in its editor. Since plunker is used heavily throughout the development community that is probably why you see it appearing a lot.
By themselves they don't do anything special, unless a library or service decides to use them.
The 'data-semver' attribute appears to be an implementation of Semantic Versioning
To the best of my knowledge no libraries actually use them for any sort of dependency checking/loading.
Solution 2 - Javascript
The data-
attribute is new in HTML5 and can be used to store arbitrary (text) data. The part after the '-' can be chosen by the author of the document. So you could have an attribute called myAge on the image of a person: <img src="imageOfMe.jpg" data-myAge="42" />
. It is mostly used to save data for javascript applications.