@glitchr/transparent 1.0.26 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glitchr/transparent",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
4
4
  "description": "Transparent SPA Application",
5
5
  "main": "src/index.js",
6
6
  "access": "public",
@@ -906,6 +906,7 @@
906
906
  var head = $(dom).find("head").html();
907
907
  var body = $(dom).find("body").html();
908
908
 
909
+ console.log(head, body);
909
910
  if(head == undefined || body == "undefined") {
910
911
 
911
912
  $(Settings.identifier).html("<div class='error'></div>");
@@ -1178,14 +1179,19 @@
1178
1179
  // Transfert attributes
1179
1180
  Transparent.transferAttributes(dom);
1180
1181
 
1181
- // Replace head.. (@TODO keep ordering, by adding after.. last node probed)
1182
+ // Replace head..
1182
1183
  var head = $(dom).find("head");
1183
1184
  $("head").children().each(function() {
1184
1185
 
1185
1186
  var el = this;
1186
1187
  var found = false;
1187
1188
 
1188
- head.children().each(function() { found |= this.isEqualNode(el); });
1189
+ head.children().each(function() {
1190
+
1191
+ found = this.isEqualNode(el);
1192
+ return !found;
1193
+ });
1194
+
1189
1195
  if(!found) this.remove();
1190
1196
  });
1191
1197
 
@@ -1202,30 +1208,6 @@
1202
1208
  }
1203
1209
  });
1204
1210
 
1205
- // Replace body end (@TODO keep ordering, by adding after.. last node probed)
1206
- var bodyScript = $(dom).find("body > script");
1207
- $("body").find("script").each(function() {
1208
-
1209
- var el = this;
1210
- var found = false;
1211
-
1212
- bodyScript.each(function() { found |= this.isEqualNode(el); });
1213
- if(!found) this.remove();
1214
- });
1215
-
1216
- bodyScript.each(function() {
1217
-
1218
- var el = this;
1219
- var found = false;
1220
-
1221
- $("body").find("script").each(function() { found |= this.isEqualNode(el); });
1222
- if(!found) {
1223
-
1224
- if(this.tagName != "SCRIPT" || Settings["global_code"] == true) $("body").append(this.cloneNode(true));
1225
- else $("body").append(this);
1226
- }
1227
- });
1228
-
1229
1211
  // Replace canvases..
1230
1212
  Transparent.replaceCanvases(dom);
1231
1213
 
@@ -1286,21 +1268,19 @@
1286
1268
  }
1287
1269
 
1288
1270
  $('head').append(function() {
1289
- $('body').append(function() {
1290
1271
 
1291
- $(Settings.identifier).append(function() {
1272
+ $(Settings.identifier).append(function() {
1292
1273
 
1293
- setTimeout(function() {
1274
+ setTimeout(function() {
1294
1275
 
1295
- // Callback if needed, or any other actions
1296
- callback();
1276
+ // Callback if needed, or any other actions
1277
+ callback();
1297
1278
 
1298
- // Trigger onload event
1299
- dispatchEvent(new Event('transparent:load'));
1300
- dispatchEvent(new Event('load'));
1279
+ // Trigger onload event
1280
+ dispatchEvent(new Event('transparent:load'));
1281
+ dispatchEvent(new Event('load'));
1301
1282
 
1302
- }.bind(this), 1);
1303
- });
1283
+ }.bind(this), 1);
1304
1284
  });
1305
1285
  });
1306
1286
  }