source: trip-planner-front/node_modules/style-loader/dist/runtime/insertBySelector.js@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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