|
90 | 90 |
|
91 | 91 | _bindingRegex: /([^{[]*)({{|\[\[)([^}\]]*)(?:]]|}})/g, |
92 | 92 |
|
| 93 | + // TODO(kschaaf): We could modify this to allow an escape mechanism by |
| 94 | + // looking for the escape sequence in each of the matches and converting |
| 95 | + // the part back to a literal type, and then bailing if only literals |
| 96 | + // were found |
93 | 97 | _parseBindings: function(text) { |
94 | 98 | var re = this._bindingRegex; |
95 | 99 | var parts = []; |
|
114 | 118 | var negate = false; |
115 | 119 | if (value[0] == '!') { |
116 | 120 | negate = true; |
117 | | - value = value.substring(1); |
| 121 | + value = value.substring(1).trim(); |
118 | 122 | } |
119 | 123 | var customEvent, notifyEvent, colon; |
120 | 124 | if (mode == '{' && (colon = value.indexOf('::')) > 0) { |
|
277 | 281 | }, |
278 | 282 |
|
279 | 283 | // construct annotation data from a generic attribute, or undefined |
280 | | - _parseNodeAttributeAnnotation: function(node, n, v) { |
281 | | - var parts = this._parseBindings(v); |
| 284 | + _parseNodeAttributeAnnotation: function(node, name, value) { |
| 285 | + var parts = this._parseBindings(value); |
282 | 286 | if (parts) { |
283 | 287 | // Attribute or property |
284 | | - var name = n; |
| 288 | + var origName = name; |
285 | 289 | var kind = 'property'; |
286 | | - if (n[n.length-1] == '$') { |
287 | | - name = n.slice(0, -1); |
| 290 | + if (name[name.length-1] == '$') { |
| 291 | + name = name.slice(0, -1); |
288 | 292 | kind = 'attribute'; |
289 | 293 | } |
290 | 294 | // Clear attribute before removing, since IE won't allow removing |
291 | 295 | // `value` attribute if it previously had a value (can't |
292 | 296 | // unconditionally set '' before removing since attributes with `$` |
293 | 297 | // can't be set using setAttribute) |
294 | | - if (node.localName == 'input' && n == 'value') { |
295 | | - node.setAttribute(n, ''); |
| 298 | + if (node.localName == 'input' && name == 'value') { |
| 299 | + node.setAttribute(origName, ''); |
296 | 300 | } |
297 | 301 | // Remove annotation |
298 | | - node.removeAttribute(n); |
| 302 | + node.removeAttribute(origName); |
299 | 303 | // Case hackery: attributes are lower-case, but bind targets |
300 | 304 | // (properties) are case sensitive. Gambit is to map dash-case to |
301 | 305 | // camel-case: `foo-bar` becomes `fooBar`. |
|
0 commit comments