5938aeaa by Michael Richards

Merge pull request #46 from Harrison/master

Fix IE8 & FF3.6 event issues, fix IE8 string split issue
2 parents d6871d9c 4f0e6416
...@@ -122,11 +122,12 @@ class Rivets.View ...@@ -122,11 +122,12 @@ class Rivets.View
122 type = attribute.name.replace bindingRegExp, '' 122 type = attribute.name.replace bindingRegExp, ''
123 pipes = (pipe.trim() for pipe in attribute.value.split '|') 123 pipes = (pipe.trim() for pipe in attribute.value.split '|')
124 context = (ctx.trim() for ctx in pipes.shift().split '>') 124 context = (ctx.trim() for ctx in pipes.shift().split '>')
125 path = context.shift().split /(\.|:)/ 125 path = context.shift()
126 splitPath = path.split /\.|:/
126 options.formatters = pipes 127 options.formatters = pipes
127 model = @models[path.shift()] 128 model = @models[splitPath.shift()]
128 options.bypass = path.shift() is ':' 129 options.bypass = path.indexOf(":") != -1
129 keypath = path.join() 130 keypath = splitPath.join()
130 131
131 if dependencies = context.shift() 132 if dependencies = context.shift()
132 options.dependencies = dependencies.split /\s+/ 133 options.dependencies = dependencies.split /\s+/
...@@ -153,17 +154,19 @@ class Rivets.View ...@@ -153,17 +154,19 @@ class Rivets.View
153 bindEvent = (el, event, fn) -> 154 bindEvent = (el, event, fn) ->
154 # Check to see if addEventListener is available. 155 # Check to see if addEventListener is available.
155 if window.addEventListener 156 if window.addEventListener
156 el.addEventListener event, fn 157 el.addEventListener event, fn, false
157 else 158 else
158 # Assume we are in IE and use attachEvent. 159 # Assume we are in IE and use attachEvent.
160 event = "on" + event
159 el.attachEvent event, fn 161 el.attachEvent event, fn
160 162
161 unbindEvent = (el, event, fn) -> 163 unbindEvent = (el, event, fn) ->
162 # Check to see if addEventListener is available. 164 # Check to see if addEventListener is available.
163 if window.removeEventListener 165 if window.removeEventListener
164 el.removeEventListener event, fn 166 el.removeEventListener event, fn, false
165 else 167 else
166 # Assume we are in IE and use attachEvent. 168 # Assume we are in IE and use attachEvent.
169 event = "on" + event
167 el.detachEvent event, fn 170 el.detachEvent event, fn
168 171
169 # Returns the current input value for the specified element. 172 # Returns the current input value for the specified element.
......