@glitchr/transparent 1.0.37 → 1.0.38

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.37",
3
+ "version": "1.0.38",
4
4
  "description": "Transparent SPA Application",
5
5
  "main": "src/index.js",
6
6
  "access": "public",
@@ -1573,11 +1573,15 @@
1573
1573
  if(xhr)
1574
1574
  history.pushState({uuid: uuid, status:status, method: method, data: {}, href: responseURL}, '', responseURL);
1575
1575
 
1576
+ // Invalid html page returned
1577
+ if(!responseText.includes("<html>") || !responseText.includes("<body>") || !responseText.includes("<head>"))
1578
+ return Transparent.rescue(dom);
1579
+
1576
1580
  var dom = new DOMParser().parseFromString(responseText, "text/html");
1577
1581
  if(status != 200) // Blatant error received..
1578
1582
  return Transparent.rescue(dom);
1579
1583
 
1580
- // Page not recognized.. just go there.. no POST information transmitted..
1584
+ // Page not recognized.. just go fetch by yourself.. no POST information transmitted..
1581
1585
  if(!Transparent.isPage(dom))
1582
1586
  return window.location.href = url;
1583
1587
 
@@ -1744,8 +1748,14 @@
1744
1748
  }
1745
1749
  }
1746
1750
 
1747
- if(Settings.debug || preventDefault)
1751
+ if(Settings.debug || preventDefault) {
1752
+
1753
+ if(preventDefault) Transparent.html.addClass(Transparent.state.READY);
1754
+ if(preventDefault) Transparent.activeOut();
1755
+ if(preventDefault) dispatchEvent(new Event('load'));
1756
+
1748
1757
  return "Dude, are you sure you want to leave? Think of the kittens!";
1758
+ }
1749
1759
  }
1750
1760
 
1751
1761
  document.addEventListener('click', __main__, false);