aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/dom_utils.coffee8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee
index aab0a4df..3581bd3f 100644
--- a/lib/dom_utils.coffee
+++ b/lib/dom_utils.coffee
@@ -2,11 +2,13 @@ DomUtils =
#
# Runs :callback if the DOM has loaded, otherwise runs it on load
#
- documentReady: (func) ->
+ documentReady: (callback) ->
if document.readyState == "loading"
- window.addEventListener "DOMContentLoaded", func
+ window.addEventListener "DOMContentLoaded", handler = ->
+ window.removeEventListener "DOMContentLoaded", handler
+ callback()
else
- func()
+ callback()
createElement: (tagName) ->
element = document.createElement tagName