diff --git a/bower.json b/bower.json index baba68d6..99c04608 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "aurelia-binding", - "version": "0.11.1", + "version": "0.11.2", "description": "A modern databinding library for JavaScript and HTML.", "license": "MIT", "keywords": [ diff --git a/dist/amd/aurelia-binding.js b/dist/amd/aurelia-binding.js index 3b311b47..1ead6937 100644 --- a/dist/amd/aurelia-binding.js +++ b/dist/amd/aurelia-binding.js @@ -819,7 +819,7 @@ define(['exports', 'core-js', 'aurelia-pal', 'aurelia-task-queue', 'aurelia-meta array['splice'] = function () { var methodCallResult = arrayProto['splice'].apply(array, arguments); var index = arguments[0]; - if (index >= array.length) { + if (index >= array.length && array.length > 0) { index = array.length - 1; } else if (-index >= array.length) { index = 0; diff --git a/dist/aurelia-binding.js b/dist/aurelia-binding.js index 75b7c51e..fef338f1 100644 --- a/dist/aurelia-binding.js +++ b/dist/aurelia-binding.js @@ -875,7 +875,7 @@ class ModifyArrayObserver extends ModifyCollectionObserver { array['splice'] = function() { var methodCallResult = arrayProto['splice'].apply(array, arguments); var index = arguments[0]; - if (index >= array.length) { + if (index >= array.length && array.length > 0) { index = array.length - 1; } else if (-index >= array.length) { index = 0; diff --git a/dist/commonjs/aurelia-binding.js b/dist/commonjs/aurelia-binding.js index 771c9faa..db925219 100644 --- a/dist/commonjs/aurelia-binding.js +++ b/dist/commonjs/aurelia-binding.js @@ -826,7 +826,7 @@ var ModifyArrayObserver = (function (_ModifyCollectionObserver2) { array['splice'] = function () { var methodCallResult = arrayProto['splice'].apply(array, arguments); var index = arguments[0]; - if (index >= array.length) { + if (index >= array.length && array.length > 0) { index = array.length - 1; } else if (-index >= array.length) { index = 0; diff --git a/dist/es6/aurelia-binding.js b/dist/es6/aurelia-binding.js index 75b7c51e..fef338f1 100644 --- a/dist/es6/aurelia-binding.js +++ b/dist/es6/aurelia-binding.js @@ -875,7 +875,7 @@ class ModifyArrayObserver extends ModifyCollectionObserver { array['splice'] = function() { var methodCallResult = arrayProto['splice'].apply(array, arguments); var index = arguments[0]; - if (index >= array.length) { + if (index >= array.length && array.length > 0) { index = array.length - 1; } else if (-index >= array.length) { index = 0; diff --git a/dist/system/aurelia-binding.js b/dist/system/aurelia-binding.js index 5b62683e..bd1e8d1d 100644 --- a/dist/system/aurelia-binding.js +++ b/dist/system/aurelia-binding.js @@ -1052,7 +1052,7 @@ System.register(['core-js', 'aurelia-pal', 'aurelia-task-queue', 'aurelia-metada array['splice'] = function () { var methodCallResult = arrayProto['splice'].apply(array, arguments); var index = arguments[0]; - if (index >= array.length) { + if (index >= array.length && array.length > 0) { index = array.length - 1; } else if (-index >= array.length) { index = 0; diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index cd7c6503..56978e4b 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,11 @@ +### 0.11.2 (2015-11-12) + + +#### Bug Fixes + +* **ArrayObserver:** fix error when removing last array item ([5c8be37b](http://github.com/aurelia/binding/commit/5c8be37b7d73d432586a51ff4e213ce89aa215c2)) + + ### 0.11.1 (2015-11-11) diff --git a/package.json b/package.json index 86e9ffa6..4fde0169 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-binding", - "version": "0.11.1", + "version": "0.11.2", "description": "A modern databinding library for JavaScript and HTML.", "keywords": [ "aurelia",