I've been finding this little meta[name='tmpl'] pattern useful lately when making template-based decisions in JS, such as when loading a particular file or set of files that are needed only on a particular page of a site.
First, in the HTML of a particular template, like say, a search result page:
<head>
...
<meta name="tmpl" content="searchresult">
</head>
..and then in JS:
var tmplmeta = document.querySelector && document.querySelector( "meta[name='tmpl']" );
var tmpl;
if( tmplmeta ){
var tmpl = tmplmeta.content;
}
...now tmpl
can be used just like you might use other feature or environmental tests, such as perhaps when loading files via a tool like yepnope.js:
yepnope({
test: tmpl === "searchresult"
yep: "js/searchresult.js"
});
Any downsides you've come across?