MCPcopy
hub / github.com/CodeboxIDE/codebox / linkLoad

Function linkLoad

core/cb.addons/require-tools/css/css.js:93–115  ·  view source on GitHub ↗
(url, callback)

Source from the content-addressed store, hash-verified

91
92 // <link> load method
93 var linkLoad = function(url, callback) {
94 var link = document.createElement('link');
95 link.type = 'text/css';
96 link.rel = 'stylesheet';
97 if (useOnload)
98 link.onload = function() {
99 link.onload = function() {};
100 // for style dimensions queries, a short delay can still be necessary
101 setTimeout(callback, 7);
102 }
103 else
104 var loadInterval = setInterval(function() {
105 for (var i = 0; i < document.styleSheets.length; i++) {
106 var sheet = document.styleSheets[i];
107 if (sheet.href == link.href) {
108 clearInterval(loadInterval);
109 return callback();
110 }
111 }
112 }, 10);
113 link.href = url;
114 head.appendChild(link);
115 }
116
117 cssAPI.normalize = function(name, normalize) {
118 if (name.substr(name.length - 4, 4) == '.css')

Callers

nothing calls this directly

Calls 1

callbackFunction · 0.50

Tested by

no test coverage detected