app/assets/javascripts/pwn-fx.js.coffee in pwnstyles_rails-0.1.18 vs app/assets/javascripts/pwn-fx.js.coffee in pwnstyles_rails-0.1.19
- old
+ new
@@ -138,11 +138,11 @@
else
xhr.send null
# Called when an XHR request issued by PwnFx.xhr works out.
_xhr_onload: ->
- if @status < 200 || @status >= 300
+ if (@status < 200 || @status >= 300) && (@status != 304)
throw new Error(
"XHR result ignored due to HTTP #{@status}: #{@statusText}")
@pwnfxOnData @responseText
# Singleton instance.
@@ -471,6 +471,14 @@
# Export the PwnFx instance.
window.PwnFx = PwnFx
# Wire up the entire DOM after the document is loaded.
-window.addEventListener 'load', -> PwnFx.wire(document)
+if document.readyState == 'loading'
+ loaded = false
+ document.addEventListener 'readystatechange', ->
+ return if loaded
+ if document.readyState != 'loading'
+ PwnFx.wire(document)
+ loaded = true
+else
+ PwnFx.wire document