We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent acc7f46 commit b82f57bCopy full SHA for b82f57b
1 file changed
index.js
@@ -3,8 +3,9 @@ var inserted = {};
3
module.exports = function (css, options) {
4
if (inserted[css]) return;
5
inserted[css] = true;
6
-
7
- var elem = document.createElement('style');
+
+ var doc = options.document || document;
8
+ var elem = doc.createElement('style');
9
elem.setAttribute('type', 'text/css');
10
11
if ('textContent' in elem) {
@@ -13,7 +14,7 @@ module.exports = function (css, options) {
13
14
elem.styleSheet.cssText = css;
15
}
16
- var head = document.getElementsByTagName('head')[0];
17
+ var head = doc.getElementsByTagName('head')[0];
18
if (options && options.prepend) {
19
head.insertBefore(elem, head.childNodes[0]);
20
} else {
0 commit comments