f3f69322 by Philip Harrison

Bind/unbind "on" event for oldIE

1 parent d6871d9c
...@@ -153,18 +153,20 @@ class Rivets.View ...@@ -153,18 +153,20 @@ class Rivets.View
153 bindEvent = (el, event, fn) -> 153 bindEvent = (el, event, fn) ->
154 # Check to see if addEventListener is available. 154 # Check to see if addEventListener is available.
155 if window.addEventListener 155 if window.addEventListener
156 el.addEventListener event, fn 156 el.addEventListener event, fn, false
157 else 157 else
158 # Assume we are in IE and use attachEvent. 158 # Assume we are in IE and use attachEvent.
159 event = "on" + event
159 el.attachEvent event, fn 160 el.attachEvent event, fn
160 161
161 unbindEvent = (el, event, fn) -> 162 unbindEvent = (el, event, fn) ->
162 # Check to see if addEventListener is available. 163 # Check to see if addEventListener is available.
163 if window.removeEventListener 164 if window.removeEventListener
164 el.removeEventListener event, fn 165 el.removeEventListener event, fn, false
165 else 166 else
166 # Assume we are in IE and use attachEvent. 167 # Assume we are in IE and use attachEvent.
167 el.detachEvent event, fn 168 event = "on" + event
169 el.detachEvent event, fn
168 170
169 # Returns the current input value for the specified element. 171 # Returns the current input value for the specified element.
170 getInputValue = (el) -> 172 getInputValue = (el) ->
......