source: frontend/node_modules/style-loader/dist/runtime/insertBySelector.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1003 bytes
Line 
1"use strict";
2
3var memo = {};
4
5/* istanbul ignore next */
6function getTarget(target) {
7 if (typeof memo[target] === "undefined") {
8 var styleTarget = document.querySelector(target);
9
10 // Special case to return head of iframe instead of iframe itself
11 if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
12 try {
13 // This will throw an exception if access to iframe is blocked
14 // due to cross-origin restrictions
15 styleTarget = styleTarget.contentDocument.head;
16 } catch (e) {
17 // istanbul ignore next
18 styleTarget = null;
19 }
20 }
21 memo[target] = styleTarget;
22 }
23 return memo[target];
24}
25
26/* istanbul ignore next */
27function insertBySelector(insert, style) {
28 var target = getTarget(insert);
29 if (!target) {
30 throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
31 }
32 target.appendChild(style);
33}
34module.exports = insertBySelector;
Note: See TracBrowser for help on using the repository browser.