Bind/unbind "on" event for oldIE
Showing
1 changed file
with
5 additions
and
3 deletions
... | @@ -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) -> | ... | ... |
-
Please register or sign in to post a comment