nav tabs on admin dashboard
This commit is contained in:
75
node_modules/style-loader/lib/addStyles.js
generated
vendored
75
node_modules/style-loader/lib/addStyles.js
generated
vendored
@@ -23,19 +23,42 @@ var isOldIE = memoize(function () {
|
||||
return window && document && document.all && !window.atob;
|
||||
});
|
||||
|
||||
var getTarget = function (target, parent) {
|
||||
if (parent){
|
||||
return parent.querySelector(target);
|
||||
}
|
||||
return document.querySelector(target);
|
||||
};
|
||||
|
||||
var getElement = (function (fn) {
|
||||
var memo = {};
|
||||
|
||||
return function(selector) {
|
||||
if (typeof memo[selector] === "undefined") {
|
||||
memo[selector] = fn.call(this, selector);
|
||||
return function(target, parent) {
|
||||
// If passing function in options, then use it for resolve "head" element.
|
||||
// Useful for Shadow Root style i.e
|
||||
// {
|
||||
// insertInto: function () { return document.querySelector("#foo").shadowRoot }
|
||||
// }
|
||||
if (typeof target === 'function') {
|
||||
return target();
|
||||
}
|
||||
if (typeof memo[target] === "undefined") {
|
||||
var styleTarget = getTarget.call(this, target, parent);
|
||||
// Special case to return head of iframe instead of iframe itself
|
||||
if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
|
||||
try {
|
||||
// This will throw an exception if access to iframe is blocked
|
||||
// due to cross-origin restrictions
|
||||
styleTarget = styleTarget.contentDocument.head;
|
||||
} catch(e) {
|
||||
styleTarget = null;
|
||||
}
|
||||
}
|
||||
memo[target] = styleTarget;
|
||||
}
|
||||
|
||||
return memo[selector]
|
||||
return memo[target]
|
||||
};
|
||||
})(function (target) {
|
||||
return document.querySelector(target)
|
||||
});
|
||||
})();
|
||||
|
||||
var singleton = null;
|
||||
var singletonCounter = 0;
|
||||
@@ -54,10 +77,10 @@ module.exports = function(list, options) {
|
||||
|
||||
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
|
||||
// tags it will allow on a page
|
||||
if (!options.singleton) options.singleton = isOldIE();
|
||||
if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
|
||||
|
||||
// By default, add <style> tags to the <head> element
|
||||
if (!options.insertInto) options.insertInto = "head";
|
||||
if (!options.insertInto) options.insertInto = "head";
|
||||
|
||||
// By default, add <style> tags to the bottom of the target
|
||||
if (!options.insertAt) options.insertAt = "bottom";
|
||||
@@ -160,8 +183,11 @@ function insertStyleElement (options, style) {
|
||||
stylesInsertedAtTop.push(style);
|
||||
} else if (options.insertAt === "bottom") {
|
||||
target.appendChild(style);
|
||||
} else if (typeof options.insertAt === "object" && options.insertAt.before) {
|
||||
var nextSibling = getElement(options.insertAt.before, target);
|
||||
target.insertBefore(style, nextSibling);
|
||||
} else {
|
||||
throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
|
||||
throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +204,16 @@ function removeStyleElement (style) {
|
||||
function createStyleElement (options) {
|
||||
var style = document.createElement("style");
|
||||
|
||||
options.attrs.type = "text/css";
|
||||
if(options.attrs.type === undefined) {
|
||||
options.attrs.type = "text/css";
|
||||
}
|
||||
|
||||
if(options.attrs.nonce === undefined) {
|
||||
var nonce = getNonce();
|
||||
if (nonce) {
|
||||
options.attrs.nonce = nonce;
|
||||
}
|
||||
}
|
||||
|
||||
addAttrs(style, options.attrs);
|
||||
insertStyleElement(options, style);
|
||||
@@ -189,7 +224,9 @@ function createStyleElement (options) {
|
||||
function createLinkElement (options) {
|
||||
var link = document.createElement("link");
|
||||
|
||||
options.attrs.type = "text/css";
|
||||
if(options.attrs.type === undefined) {
|
||||
options.attrs.type = "text/css";
|
||||
}
|
||||
options.attrs.rel = "stylesheet";
|
||||
|
||||
addAttrs(link, options.attrs);
|
||||
@@ -204,12 +241,22 @@ function addAttrs (el, attrs) {
|
||||
});
|
||||
}
|
||||
|
||||
function getNonce() {
|
||||
if (typeof __webpack_nonce__ === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return __webpack_nonce__;
|
||||
}
|
||||
|
||||
function addStyle (obj, options) {
|
||||
var style, update, remove, result;
|
||||
|
||||
// If a transform function was defined, run it on the css
|
||||
if (options.transform && obj.css) {
|
||||
result = options.transform(obj.css);
|
||||
result = typeof options.transform === 'function'
|
||||
? options.transform(obj.css)
|
||||
: options.transform.default(obj.css);
|
||||
|
||||
if (result) {
|
||||
// If transform returns a value, use that instead of the original css.
|
||||
|
||||
Reference in New Issue
Block a user