Procházet zdrojové kódy

fix array augmentation methods

Evan You před 12 roky
rodič
revize
953fd1adb4
1 změnil soubory, kde provedl 4 přidání a 5 odebrání
  1. 4 5
      src/binding.js

+ 4 - 5
src/binding.js

@@ -70,13 +70,12 @@ function typeOf (obj) {
 var aproto = Array.prototype,
 var aproto = Array.prototype,
     arrayMutators = ['push','pop','shift','unshift','splice','sort','reverse'],
     arrayMutators = ['push','pop','shift','unshift','splice','sort','reverse'],
     arrayAugmentations = {
     arrayAugmentations = {
-        remove: function (scope) {
-            this.splice(scope.$index, 1)
+        remove: function (index) {
+            if (typeof index !== 'number') index = index.$index
+            this.splice(index, 1)
         },
         },
         replace: function (index, data) {
         replace: function (index, data) {
-            if (typeof index !== 'number') {
-                index = index.$index
-            }
+            if (typeof index !== 'number') index = index.$index
             this.splice(index, 1, data)
             this.splice(index, 1, data)
         }
         }
     }
     }