diff --git a/src/directives/class.hover.active.js b/src/directives/class.hover.active.js index 1b54aa8..05259f1 100644 --- a/src/directives/class.hover.active.js +++ b/src/directives/class.hover.active.js @@ -2,10 +2,9 @@ //http://www.cnblogs.com/rubylouvre/archive/2012/12/17/2818540.html import { Anot, directives, getLongID as markID } from '../seed/core' -function classNames() { +function classNames(...args) { var classes = [] - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i] + for (let arg of args) { var argType = typeof arg if (argType === 'string' || argType === 'number' || arg === true) { classes.push(arg) diff --git a/src/directives/css.js b/src/directives/css.js index a6f28b9..5eac88d 100644 --- a/src/directives/css.js +++ b/src/directives/css.js @@ -8,11 +8,11 @@ var cssDir = Anot.directive('css', { //转换成对象 var b = {} newVal.forEach(function(el) { - el && Anot.shadowCopy(b, el) + el && Object.assign(b, el) }) newVal = b if (!arrayWarn[this.type]) { - Anot.warn('ms-' + this.type + '指令的值不建议使用数组形式了!') + console.warn('ms-' + this.type + '指令的值不建议使用数组形式了!') arrayWarn[this.type] = 1 } } diff --git a/src/directives/duplex/updateDataActions.js b/src/directives/duplex/updateDataActions.js index fa1507c..2093eb7 100644 --- a/src/directives/duplex/updateDataActions.js +++ b/src/directives/duplex/updateDataActions.js @@ -36,7 +36,7 @@ export var updateDataActions = { var field = this var array = field.value if (!Array.isArray(array)) { - Anot.warn('ms-duplex应用于checkbox上要对应一个数组') + console.warn('ms-duplex应用于checkbox上要对应一个数组') array = [array] } var method = field.dom.checked ? 'ensure' : 'remove' diff --git a/src/directives/for.js b/src/directives/for.js index c6176c9..0ef6082 100644 --- a/src/directives/for.js +++ b/src/directives/for.js @@ -19,7 +19,7 @@ Anot.directive('for', { str = str.replace(rforAs, function(a, b) { /* istanbul ignore if */ if (!rident.test(b) || rinvalid.test(b)) { - Anot.error( + console.error( 'alias ' + b + ' is invalid --- must be a valid JS identifier which is not a reserved name.' @@ -226,11 +226,7 @@ function updateItemVm(vm, top) { } function resetVM(vm, a, b) { - if (Anot.config.inProxyMode) { - vm.$accessors[a].value = NaN - } else { - vm.$accessors[a].set(NaN) - } + vm.$accessors[a].value = NaN } function updateList(instance) { diff --git a/src/directives/if.js b/src/directives/if.js index 8652f19..6c3dd01 100644 --- a/src/directives/if.js +++ b/src/directives/if.js @@ -55,6 +55,6 @@ function continueScan(instance, vdom) { instance.fragment, instance.vm )) - Anot.shadowCopy(vdom, innerRender.root) + Object.assign(vdom, innerRender.root) delete vdom.nodeValue } diff --git a/src/directives/on.js b/src/directives/on.js index 5140ddf..addc003 100644 --- a/src/directives/on.js +++ b/src/directives/on.js @@ -31,7 +31,7 @@ Anot.directive('on', { '\tvar __vmodel__ = this;', '\t' + filters, '\treturn ' + body, - '}catch(e){Anot.log(e, "in on dir")}' + '}catch(e){console.log(e, "in on dir")}' ].filter(function(el) { return /\S/.test(el) }) diff --git a/src/directives/rules.js b/src/directives/rules.js index 93fbb06..291b5f2 100644 --- a/src/directives/rules.js +++ b/src/directives/rules.js @@ -33,7 +33,7 @@ function isCorrectDate(value) { return false } //https://github.com/adform/validator.js/blob/master/validator.js -Anot.shadowCopy(Anot.validators, { +Object.assign(Anot.validators, { pattern: { message: '必须匹配{{pattern}}这样的格式', get: function(value, field, next) { diff --git a/src/directives/text.js b/src/directives/text.js index 9001f32..a994443 100644 --- a/src/directives/text.js +++ b/src/directives/text.js @@ -5,7 +5,7 @@ Anot.directive('text', { init: function() { var node = this.node if (node.isVoidTag) { - Anot.error('自闭合元素不能使用ms-text') + console.error('自闭合元素不能使用ms-text') } var child = { nodeName: '#text', nodeValue: this.getValue() } node.children.splice(0, node.children.length, child) diff --git a/src/directives/validate.js b/src/directives/validate.js index b83cddc..7ceb430 100644 --- a/src/directives/validate.js +++ b/src/directives/validate.js @@ -44,7 +44,7 @@ var valiDir = Anot.directive('validate', { var fn = (vmValidator.onManual = onManual.bind(vmValidator)) validator.onManual = fn } catch (e) { - Anot.warn( + console.warn( '要想使用onManual方法,必须在validate对象预定义一个空的onManual函数' ) } @@ -94,12 +94,7 @@ var valiDir = Anot.directive('validate', { var value = field.value var elem = field.dom /* istanbul ignore if */ - if (typeof Promise !== 'function') { - //Anot-promise不支持phantomjs - Anot.warn( - '浏览器不支持原生Promise,请下载并