Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit 1f3b023

Browse files
committed
Merge pull request #57 from jrabbe/non-namespaced-ie-elements
Updates IEShiv to support non-namespaced elements
2 parents 129c365 + d174ab5 commit 1f3b023

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

modules/ie-shiv/ie-shiv.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,24 @@
3030
return " " + $1.toLowerCase();
3131
});
3232
var tokens = dashed.split(' ');
33-
var ns = tokens[0];
34-
var dirname = tokens.slice(1).join('-');
35-
36-
// this is finite list and it seemed senseless to create a custom method
37-
result.push(ns + ":" + dirname);
38-
result.push(ns + "-" + dirname);
39-
result.push("x-" + ns + "-" + dirname);
40-
result.push("data-" + ns + "-" + dirname);
33+
34+
// If a token is just a single name (i.e. no namespace) then we juse define the elements the name given
35+
if (tokens.length === 1) {
36+
var name = tokens[0];
37+
38+
result.push(name);
39+
result.push("x-" + name);
40+
result.push("data-" + name);
41+
} else {
42+
var ns = tokens[0];
43+
var dirname = tokens.slice(1).join('-');
44+
45+
// this is finite list and it seemed senseless to create a custom method
46+
result.push(ns + ":" + dirname);
47+
result.push(ns + "-" + dirname);
48+
result.push("x-" + ns + "-" + dirname);
49+
result.push("data-" + ns + "-" + dirname);
50+
}
4151
return result;
4252
};
4353

@@ -49,4 +59,4 @@
4959
}
5060
}
5161

52-
})(window);
62+
})(window);

0 commit comments

Comments
 (0)