@glitchr/transparent 1.0.27 → 1.0.28

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.27",
3
+ "version": "1.0.28",
4
4
  "description": "Transparent SPA Application",
5
5
  "main": "src/index.js",
6
6
  "access": "public",
@@ -1208,6 +1208,16 @@
1208
1208
  }
1209
1209
  });
1210
1210
 
1211
+ var bodyScript = $(dom).find("body > script");
1212
+ bodyScript.each(function() {
1213
+
1214
+ var el = this;
1215
+ var found = false;
1216
+
1217
+ $("body").children().each(function() { found |= this.isEqualNode(el); });
1218
+ if(!found) $("body").append(this);
1219
+ });
1220
+
1211
1221
  // Replace canvases..
1212
1222
  Transparent.replaceCanvases(dom);
1213
1223
 
@@ -1235,7 +1245,8 @@
1235
1245
  oldPage.remove();
1236
1246
 
1237
1247
  if(Settings["global_code"] == true) Transparent.evalScript($(page)[0]);
1238
- dispatchEvent(new Event('DOMContentLoaded'));
1248
+ document.dispatchEvent(new Event('DOMContentLoaded'));
1249
+ window.dispatchEvent(new Event('DOMContentLoaded'));
1239
1250
 
1240
1251
  Transparent.addLayout();
1241
1252
 
@@ -1407,7 +1418,7 @@
1407
1418
 
1408
1419
  var form = target != undefined && target.tagName == "FORM" ? target : undefined;
1409
1420
  if (form) {
1410
- data = $(form).serialize();
1421
+ data = new FormEvent(form);
1411
1422
  $(form).find(':submit').attr('disabled', 'disabled');
1412
1423
  }
1413
1424
 
@@ -1530,7 +1541,7 @@
1530
1541
  // From here the page is valid..
1531
1542
  // so the new page is added to history..
1532
1543
  if(xhr)
1533
- history.pushState({uuid: uuid, status:status, method: method, data: data, href: responseURL}, '', responseURL);
1544
+ history.pushState({uuid: uuid, status:status, method: method, data: {}, href: responseURL}, '', responseURL);
1534
1545
 
1535
1546
  var dom = new DOMParser().parseFromString(responseText, "text/html");
1536
1547
  if(status != 200) // Blatant error received..
@@ -1610,7 +1621,9 @@
1610
1621
  url: url.href,
1611
1622
  type: type,
1612
1623
  data: data,
1613
- dataType: 'html',
1624
+ cache: false,
1625
+ contentType: false,
1626
+ processData: false,
1614
1627
  headers: Settings["headers"] || {},
1615
1628
  xhr: function () { return xhr; },
1616
1629
  success: function (html, status, request) { return handleResponse(uuid, request.status, type, data, xhr, request); },