Skip to content

Commit a300862

Browse files
committed
Fixes from review.
1 parent b1c1b35 commit a300862

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

‎src/lib/annotations/annotations.html‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@
9090

9191
_bindingRegex: /([^{[]*)({{|\[\[)([^}\]]*)(?:]]|}})/g,
9292

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
9397
_parseBindings: function(text) {
9498
var re = this._bindingRegex;
9599
var parts = [];
@@ -114,7 +118,7 @@
114118
var negate = false;
115119
if (value[0] == '!') {
116120
negate = true;
117-
value = value.substring(1);
121+
value = value.substring(1).trim();
118122
}
119123
var customEvent, notifyEvent, colon;
120124
if (mode == '{' && (colon = value.indexOf('::')) > 0) {
@@ -277,25 +281,25 @@
277281
},
278282

279283
// 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);
282286
if (parts) {
283287
// Attribute or property
284-
var name = n;
288+
var origName = name;
285289
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);
288292
kind = 'attribute';
289293
}
290294
// Clear attribute before removing, since IE won't allow removing
291295
// `value` attribute if it previously had a value (can't
292296
// unconditionally set '' before removing since attributes with `$`
293297
// 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, '');
296300
}
297301
// Remove annotation
298-
node.removeAttribute(n);
302+
node.removeAttribute(origName);
299303
// Case hackery: attributes are lower-case, but bind targets
300304
// (properties) are case sensitive. Gambit is to map dash-case to
301305
// camel-case: `foo-bar` becomes `fooBar`.

‎src/lib/bind/effects.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
_shouldAddListener: function(effect) {
1616
return effect.name &&
1717
effect.kind != 'attribute' &&
18+
effect.kind != 'text' &&
1819
!effect.isCompound &&
1920
effect.parts[0].mode === '{' &&
2021
!effect.parts[0].negate;

0 commit comments

Comments
 (0)