Bind/unbind "on" event for oldIE
Showing
1 changed file
with
4 additions
and
2 deletions
... | @@ -153,17 +153,19 @@ class Rivets.View | ... | @@ -153,17 +153,19 @@ 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. |
168 | event = "on" + event | ||
167 | el.detachEvent event, fn | 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. | ... | ... |
-
Please register or sign in to post a comment