Skip to content

Commit 2872043

Browse files
committed
Migrate @kyse changes from #705
1 parent 989ee2b commit 2872043

File tree

6 files changed

+193
-158
lines changed

6 files changed

+193
-158
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
coverage
33
bower_components
4+
*.log

dist/schema-form.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -3063,17 +3063,11 @@ return /******/ (function(modules) { // webpackBootstrap
30633063
if (vals && vals !== old) {
30643064
var arr = getOrCreateModel();
30653065

3066-
// Apparently the fastest way to clear an array, readable too.
3067-
// http://jsperf.com/array-destroy/32
3068-
while (arr.length > 0) {
3069-
arr.pop();
3070-
}
30713066
form.titleMap.forEach(function (item, index) {
3072-
if (vals[index]) {
3073-
arr.push(item.value);
3074-
}
3067+
var arrIndex = arr.indexOf(item.value);
3068+
if (arrIndex === -1 && vals[index]) arr.push(item.value);
3069+
if (arrIndex !== -1 && !vals[index]) arr.splice(arrIndex, 1);
30753070
});
3076-
30773071
// Time to validate the rebuilt array.
30783072
// validateField method is exported by schema-validate
30793073
if (scope.validateField) {

0 commit comments

Comments
 (0)