support type=text/less and text/x-less for specifying stylesheets

This commit is contained in:
cloudhead
2010-07-01 11:08:27 +02:00
parent cbb432edef
commit 6426ac5c7a

View File

@@ -61,11 +61,13 @@ try {
// Get all <link> tags with the 'rel' attribute set to "stylesheet/less"
//
var links = document.getElementsByTagName('link');
var typePattern = /^text\/(x-)?less$/;
less.sheets = [];
for (var i = 0; i < links.length; i++) {
if (links[i].rel === 'stylesheet/less') {
if (links[i].rel === 'stylesheet/less' || (links[i].rel.match(/stylesheet/) &&
(links[i].type.match(typePattern)))) {
less.sheets.push(links[i]);
}
}