diff --git a/bower.json b/bower.json index 6e0c76c5..f69d62f9 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "aurelia-templating", - "version": "0.10.1", + "version": "0.10.2", "description": "An extensible HTML templating engine supporting databinding, custom elements, attached behaviors and more.", "keywords": [ "aurelia", diff --git a/dist/amd/bindable-property.js b/dist/amd/bindable-property.js index ac391c61..efeea590 100644 --- a/dist/amd/bindable-property.js +++ b/dist/amd/bindable-property.js @@ -36,6 +36,7 @@ define(['exports', 'core-js', './util', 'aurelia-binding'], function (exports, _ this.attribute = this.attribute || _util.hyphenate(this.name); this.defaultBindingMode = this.defaultBindingMode || _aureliaBinding.ONE_WAY; + this.changeHandler = this.changeHandler || null; this.owner = null; } @@ -52,7 +53,7 @@ define(['exports', 'core-js', './util', 'aurelia-binding'], function (exports, _ var name = this.name, handlerName; - if (this.changeHandler === undefined) { + if (this.changeHandler === null) { handlerName = name + 'Changed'; if (handlerName in target.prototype) { this.changeHandler = handlerName; @@ -81,7 +82,7 @@ define(['exports', 'core-js', './util', 'aurelia-binding'], function (exports, _ return; } - if (this.changeHandler !== undefined) { + if (this.changeHandler !== null) { selfSubscriber = function (newValue, oldValue) { return executionContext[_this.changeHandler](newValue, oldValue); }; @@ -114,7 +115,7 @@ define(['exports', 'core-js', './util', 'aurelia-binding'], function (exports, _ observer.call(); } else if (attribute) { boundProperties.push({ observer: observer, binding: attribute.createBinding(executionContext) }); - } else if (this.defaultValue) { + } else if (this.defaultValue !== undefined) { executionContext[this.name] = this.defaultValue; observer.call(); } diff --git a/dist/amd/html-behavior.js b/dist/amd/html-behavior.js index 013b6693..53b2c9e7 100644 --- a/dist/amd/html-behavior.js +++ b/dist/amd/html-behavior.js @@ -69,8 +69,9 @@ define(['exports', 'aurelia-metadata', 'aurelia-binding', 'aurelia-task-queue', }).registerWith(target, this); } - if (properties.length === 1) { - current = properties[0]; + current = properties[0]; + + if (properties.length === 1 && current.name === 'value') { current.isDynamic = current.hasOptions = this.hasDynamicOptions; current.defineOn(target, this); } else { diff --git a/dist/commonjs/bindable-property.js b/dist/commonjs/bindable-property.js index 9043c39a..cd0683b5 100644 --- a/dist/commonjs/bindable-property.js +++ b/dist/commonjs/bindable-property.js @@ -41,6 +41,7 @@ var BindableProperty = (function () { this.attribute = this.attribute || _hyphenate.hyphenate(this.name); this.defaultBindingMode = this.defaultBindingMode || _ONE_WAY$TWO_WAY$ONE_TIME.ONE_WAY; + this.changeHandler = this.changeHandler || null; this.owner = null; } @@ -57,7 +58,7 @@ var BindableProperty = (function () { var name = this.name, handlerName; - if (this.changeHandler === undefined) { + if (this.changeHandler === null) { handlerName = name + 'Changed'; if (handlerName in target.prototype) { this.changeHandler = handlerName; @@ -86,7 +87,7 @@ var BindableProperty = (function () { return; } - if (this.changeHandler !== undefined) { + if (this.changeHandler !== null) { selfSubscriber = function (newValue, oldValue) { return executionContext[_this.changeHandler](newValue, oldValue); }; @@ -119,7 +120,7 @@ var BindableProperty = (function () { observer.call(); } else if (attribute) { boundProperties.push({ observer: observer, binding: attribute.createBinding(executionContext) }); - } else if (this.defaultValue) { + } else if (this.defaultValue !== undefined) { executionContext[this.name] = this.defaultValue; observer.call(); } diff --git a/dist/commonjs/html-behavior.js b/dist/commonjs/html-behavior.js index 7d0ba23e..a4544e4b 100644 --- a/dist/commonjs/html-behavior.js +++ b/dist/commonjs/html-behavior.js @@ -86,8 +86,9 @@ var HtmlBehaviorResource = (function (_ResourceType) { }).registerWith(target, this); } - if (properties.length === 1) { - current = properties[0]; + current = properties[0]; + + if (properties.length === 1 && current.name === 'value') { current.isDynamic = current.hasOptions = this.hasDynamicOptions; current.defineOn(target, this); } else { diff --git a/dist/es6/bindable-property.js b/dist/es6/bindable-property.js index d7b5bd56..8e860a7b 100644 --- a/dist/es6/bindable-property.js +++ b/dist/es6/bindable-property.js @@ -23,6 +23,7 @@ export class BindableProperty { this.attribute = this.attribute || hyphenate(this.name); this.defaultBindingMode = this.defaultBindingMode || ONE_WAY; + this.changeHandler = this.changeHandler || null; this.owner = null; } @@ -36,7 +37,7 @@ export class BindableProperty { var name = this.name, handlerName; - if(this.changeHandler === undefined){ + if(this.changeHandler === null){ handlerName = name + 'Changed'; if(handlerName in target.prototype){ this.changeHandler = handlerName; @@ -62,7 +63,7 @@ export class BindableProperty { return; } - if(this.changeHandler !== undefined){ + if(this.changeHandler !== null){ selfSubscriber = (newValue, oldValue) => executionContext[this.changeHandler](newValue, oldValue); } @@ -92,7 +93,7 @@ export class BindableProperty { observer.call(); }else if(attribute){ boundProperties.push({observer:observer, binding:attribute.createBinding(executionContext)}); - }else if(this.defaultValue){ + }else if(this.defaultValue !== undefined){ executionContext[this.name] = this.defaultValue; observer.call(); } diff --git a/dist/es6/html-behavior.js b/dist/es6/html-behavior.js index 47edd3af..1eb5334c 100644 --- a/dist/es6/html-behavior.js +++ b/dist/es6/html-behavior.js @@ -70,8 +70,9 @@ export class HtmlBehaviorResource extends ResourceType { }).registerWith(target, this); } - if(properties.length === 1){ //default for custom attributes - current = properties[0]; + current = properties[0]; + + if(properties.length === 1 && current.name === 'value'){ //default for custom attributes current.isDynamic = current.hasOptions = this.hasDynamicOptions; current.defineOn(target, this); } else{ //custom attribute with options diff --git a/dist/system/bindable-property.js b/dist/system/bindable-property.js index 467fb125..32c6b195 100644 --- a/dist/system/bindable-property.js +++ b/dist/system/bindable-property.js @@ -41,6 +41,7 @@ System.register(['core-js', './util', 'aurelia-binding'], function (_export) { this.attribute = this.attribute || hyphenate(this.name); this.defaultBindingMode = this.defaultBindingMode || ONE_WAY; + this.changeHandler = this.changeHandler || null; this.owner = null; } @@ -57,7 +58,7 @@ System.register(['core-js', './util', 'aurelia-binding'], function (_export) { var name = this.name, handlerName; - if (this.changeHandler === undefined) { + if (this.changeHandler === null) { handlerName = name + 'Changed'; if (handlerName in target.prototype) { this.changeHandler = handlerName; @@ -86,7 +87,7 @@ System.register(['core-js', './util', 'aurelia-binding'], function (_export) { return; } - if (this.changeHandler !== undefined) { + if (this.changeHandler !== null) { selfSubscriber = function (newValue, oldValue) { return executionContext[_this.changeHandler](newValue, oldValue); }; @@ -119,7 +120,7 @@ System.register(['core-js', './util', 'aurelia-binding'], function (_export) { observer.call(); } else if (attribute) { boundProperties.push({ observer: observer, binding: attribute.createBinding(executionContext) }); - } else if (this.defaultValue) { + } else if (this.defaultValue !== undefined) { executionContext[this.name] = this.defaultValue; observer.call(); } diff --git a/dist/system/html-behavior.js b/dist/system/html-behavior.js index beeb6350..ec23a196 100644 --- a/dist/system/html-behavior.js +++ b/dist/system/html-behavior.js @@ -90,8 +90,9 @@ System.register(['aurelia-metadata', 'aurelia-binding', 'aurelia-task-queue', '. }).registerWith(target, this); } - if (properties.length === 1) { - current = properties[0]; + current = properties[0]; + + if (properties.length === 1 && current.name === 'value') { current.isDynamic = current.hasOptions = this.hasDynamicOptions; current.defineOn(target, this); } else { diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index a3990106..9f7e3ab1 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,15 @@ +### 0.10.2 (2015-04-11) + + +#### Bug Fixes + +* **bindable-property:** + * set default if not undefined ([98e479ad](http://github.com/aurelia/templating/commit/98e479ad621197db2335340cc7bea052e658bf76)) + * ensure changeHandler is always defined, but null by default ([6de4f87e](http://github.com/aurelia/templating/commit/6de4f87e5115819eaa1dc5ff2fab1febfd07ff8a)) +* **html-behavior:** custom attrs with one property that is not value should be options ([8486dc45](http://github.com/aurelia/templating/commit/8486dc45a0196ffffbf2c2b9663cab538cfaf22b)) +* **html-bheavior:** incorrect identification of options attributes ([ebef7461](http://github.com/aurelia/templating/commit/ebef746164c90feb1d9861f1a599eb4fb0925a25)) + + ### 0.10.1 (2015-04-09) diff --git a/package.json b/package.json index 29f50d26..52d1dbee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-templating", - "version": "0.10.1", + "version": "0.10.2", "description": "An extensible HTML templating engine supporting databinding, custom elements, attached behaviors and more.", "keywords": [ "aurelia",