Merge pull request #46 from Harrison/master
Fix IE8 & FF3.6 event issues, fix IE8 string split issue
Showing
1 changed file
with
12 additions
and
9 deletions
... | @@ -72,7 +72,7 @@ class Rivets.Binding | ... | @@ -72,7 +72,7 @@ class Rivets.Binding |
72 | @model[@keypath] | 72 | @model[@keypath] |
73 | else | 73 | else |
74 | Rivets.config.adapter.read @model, @keypath | 74 | Rivets.config.adapter.read @model, @keypath |
75 | 75 | ||
76 | Rivets.config.adapter.subscribe @model, keypath, callback | 76 | Rivets.config.adapter.subscribe @model, keypath, callback |
77 | 77 | ||
78 | if @type in @bidirectionals | 78 | if @type in @bidirectionals |
... | @@ -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,18 +154,20 @@ class Rivets.View | ... | @@ -153,18 +154,20 @@ 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. |
167 | el.detachEvent event, fn | 169 | event = "on" + event |
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. |
170 | getInputValue = (el) -> | 173 | getInputValue = (el) -> |
... | @@ -242,4 +245,4 @@ rivets = | ... | @@ -242,4 +245,4 @@ rivets = |
242 | if module? | 245 | if module? |
243 | module.exports = rivets | 246 | module.exports = rivets |
244 | else | 247 | else |
245 | @rivets = rivets | 248 | @rivets = rivets |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment