From cf28cb7a0f744dc563aa1467a9d9a297a52f1fcc Mon Sep 17 00:00:00 2001 From: RubyLouvre Date: Mon, 24 Nov 2014 14:35:20 +0800 Subject: [PATCH] =?UTF-8?q?fix=20ms-duplex2.0=E4=B8=8E=E6=97=A7=E6=9C=89?= =?UTF-8?q?=E7=9A=84msData=E4=B9=8B=E9=97=B4=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- avalon.js | 13 +++-- avalon.min.js | 118 ++++++++++++++++++++-------------------- avalon.modern.js | 16 ++++-- avalon.modern.min.js | 106 ++++++++++++++++++------------------ examples/avalon.shim.js | 5 +- 5 files changed, 134 insertions(+), 124 deletions(-) diff --git a/avalon.js b/avalon.js index 44ee2875f..7dc2c1dde 100644 --- a/avalon.js +++ b/avalon.js @@ -1813,7 +1813,7 @@ avalon.each(eventNodes, function(i, node) { avalon.each(elements, function(j, element) { var ok = special === "down" ? element.contains(node) : //向下捕获 - node.contains(element) //向上冒泡 + node.contains(element) //向上冒泡 if (ok) { node._avalon = v //符合条件的加一个标识 @@ -2178,7 +2178,7 @@ var param = match[2] || "" var value = attr.value var name = attr.name - msData[name.replace(/(\-[$\w]+)/g,"")] = value + msData[name] = value if (events[type]) { param = type type = "on" @@ -2219,8 +2219,8 @@ } } bindings.sort(bindingSorter) - if (msData["ms-checked"] && msData["ms-duplex"]) { - log("warning!一个元素上不能同时定义ms-checked与ms-duplex") + if (msData["ms-attr-checked"] && msData["ms-duplex"]) { + log("warning!一个元素上不能同时定义ms-attr-checked与ms-duplex") } var firstBinding = bindings[0] || {} @@ -3146,6 +3146,9 @@ if (elem.type === "radio" && data.param === "") { data.param = "checked" } + if (elem.msData) { + elem.msData["ms-duplex"] = data.value + } data.param.replace(/\w+/g, function(name) { if (/^(checkbox|radio)$/.test(elem.type) && /^(radio|checked)$/.test(name)) { if (name === "radio") @@ -4350,7 +4353,7 @@ } var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/, NUMBER_STRING = /^\d+$/ - var riso8601= /^(\d{4})-?(\d+)-?(\d+)(?:T(\d+)(?::?(\d+)(?::?(\d+)(?:\.(\d+))?)?)?(Z|([+-])(\d+):?(\d+))?)?$/ + var riso8601 = /^(\d{4})-?(\d+)-?(\d+)(?:T(\d+)(?::?(\d+)(?::?(\d+)(?:\.(\d+))?)?)?(Z|([+-])(\d+):?(\d+))?)?$/ // 1 2 3 4 5 6 7 8 9 10 11 function jsonStringToDate(string) { diff --git a/avalon.min.js b/avalon.min.js index a6a747c9a..4a3315154 100644 --- a/avalon.min.js +++ b/avalon.min.js @@ -1,42 +1,42 @@ -(function(p){function y(){}function v(){r.console&&avalon.config.debug&&Function.apply.call(console.log,console,arguments)}function M(b,c){"string"===typeof b&&(b=b.match(z)||[]);for(var d={},e=void 0!==c?c:1,f=0,g=b.length;fb?Math.max(c+b,0):Math.min(b,c)}function Wb(b,c, -d){if(V(c)||c&&c.nodeType||-1!==d.indexOf(b)||-1!==ta.indexOf(b))return!1;c=d.$special;return b&&"$"===b.charAt(0)&&!c[b]?!1:!0}function N(b,c,d){if(Array.isArray(b)){var e=b.concat();b.length=0;c=Xb(b);c.pushArray(e);return c}if("number"===typeof b.nodeType||b.$id&&b.$model&&b.$events)return b;Array.isArray(b.$skipArray)||(b.$skipArray=[]);b.$skipArray.$special=c||{};var f={};d=d||{};var g={},h={},k=[];for(e in b)(function(c,e){d[c]=e;if(Wb(c,e,b.$skipArray)){var l,t=avalon.type(e);g[c]=[];if("object"=== -t&&V(e.get)&&2>=Object.keys(e).length){var H=e.set,F=e.get;l=function(b){var e=f.$events,g=d[c];if(arguments.length){if(ja)return;if(V(H)){var h=e[c];e[c]=[];H.call(f,b);e[c]=h}}else avalon.openComputedCollect&&ka(e[c]);b=d[c]=F.call(f);if(!la(g,b)){if(ma&&(h=W[f.$id])&&h[c])h[c].$val=b;va(e[c]);f.$events&&R.$fire.call(f,c,b,g)}return b};k.push(function(){Y[A]={evaluator:l,element:J,type:"computed::"+c,handler:y,args:[]};l();ka(g[c]);delete Y[A]})}else wa.test(t)?(l=function(b){var e=l.child,h=d[c]; -if(arguments.length)!ja&&!la(h,b)&&(e=l.child=Yb(f,c,b,t),b=d[c]=e.$model,(e=xa[e.$id])&&e(),f.$events&&R.$fire.call(f,c,b,h));else return ka(g[c]),e},(l.child=N(e,0,d[c])).$events[G]=g[c]):l=function(b){var e=d[c];if(arguments.length){if(!la(e,b)){d[c]=b;if(ma){var h=W[f.$id];h&&h[c]&&(h[c].$val=b)}va(g[c]);f.$events&&R.$fire.call(f,c,b,e)}}else return ka(g[c]),e};h[c]=l}})(e,b[e]);ta.forEach(function(c){delete b[c];delete d[c]});var f=na(f,Zb(h),b),l;for(l in b)h[l]||(f[l]=b[l]);f.$id=ha();f.$model= -d;f.$events=g;for(e in R)c=R[e],w||(c=c.bind(f)),f[e]=c;f.hasOwnProperty=function(b){return b in f.$model};k.forEach(function(b){b()});return f}function Yb(b,c,d,e){var f=b[c];if("array"===e){if(!Array.isArray(d)||f===d)return f;f.clear();f.pushArray(d.concat());return f}var g=b.$events[c];W[f.$id]&&(ma--,delete W[f.$id]);var h=N(d);h.$events[G]=g;xa[h.$id]=function(b){for(;b=g.shift();)(function(b){b.type&&avalon.nextTick(function(){b.rollback&&b.rollback();C[b.type](b,b.vmodels)})})(b);delete xa[h.$id]}; +(function(p){function y(){}function v(){r.console&&avalon.config.debug&&Function.apply.call(console.log,console,arguments)}function M(b,c){"string"===typeof b&&(b=b.match(z)||[]);for(var d={},e=void 0!==c?c:1,f=0,g=b.length;fb?Math.max(c+b,0):Math.min(b,c)}function Wb(b,c, +d){if(V(c)||c&&c.nodeType||-1!==d.indexOf(b)||-1!==sa.indexOf(b))return!1;c=d.$special;return b&&"$"===b.charAt(0)&&!c[b]?!1:!0}function N(b,c,d){if(Array.isArray(b)){var e=b.concat();b.length=0;c=Xb(b);c.pushArray(e);return c}if("number"===typeof b.nodeType||b.$id&&b.$model&&b.$events)return b;Array.isArray(b.$skipArray)||(b.$skipArray=[]);b.$skipArray.$special=c||{};var f={};d=d||{};var g={},h={},l=[];for(e in b)(function(c,e){d[c]=e;if(Wb(c,e,b.$skipArray)){var k,t=avalon.type(e);g[c]=[];if("object"=== +t&&V(e.get)&&2>=Object.keys(e).length){var H=e.set,F=e.get;k=function(b){var e=f.$events,g=d[c];if(arguments.length){if(ja)return;if(V(H)){var h=e[c];e[c]=[];H.call(f,b);e[c]=h}}else avalon.openComputedCollect&&ka(e[c]);b=d[c]=F.call(f);if(!la(g,b)){if(ma&&(h=W[f.$id])&&h[c])h[c].$val=b;ua(e[c]);f.$events&&R.$fire.call(f,c,b,g)}return b};l.push(function(){Y[A]={evaluator:k,element:J,type:"computed::"+c,handler:y,args:[]};k();ka(g[c]);delete Y[A]})}else va.test(t)?(k=function(b){var e=k.child,h=d[c]; +if(arguments.length)!ja&&!la(h,b)&&(e=k.child=Yb(f,c,b,t),b=d[c]=e.$model,(e=wa[e.$id])&&e(),f.$events&&R.$fire.call(f,c,b,h));else return ka(g[c]),e},(k.child=N(e,0,d[c])).$events[G]=g[c]):k=function(b){var e=d[c];if(arguments.length){if(!la(e,b)){d[c]=b;if(ma){var h=W[f.$id];h&&h[c]&&(h[c].$val=b)}ua(g[c]);f.$events&&R.$fire.call(f,c,b,e)}}else return ka(g[c]),e};h[c]=k}})(e,b[e]);sa.forEach(function(c){delete b[c];delete d[c]});var f=na(f,Zb(h),b),k;for(k in b)h[k]||(f[k]=b[k]);f.$id=ha();f.$model= +d;f.$events=g;for(e in R)c=R[e],w||(c=c.bind(f)),f[e]=c;f.hasOwnProperty=function(b){return b in f.$model};l.forEach(function(b){b()});return f}function Yb(b,c,d,e){var f=b[c];if("array"===e){if(!Array.isArray(d)||f===d)return f;f.clear();f.pushArray(d.concat());return f}var g=b.$events[c];W[f.$id]&&(ma--,delete W[f.$id]);var h=N(d);h.$events[G]=g;wa[h.$id]=function(b){for(;b=g.shift();)(function(b){b.type&&avalon.nextTick(function(){b.rollback&&b.rollback();C[b.type](b,b.vmodels)})})(b);delete wa[h.$id]}; return h}function Z(b,c,d){b="for(var "+b+"i=0,n = this.length; i < n; i++){"+c.replace("_","((i in this) && fn.call(scope,this[i],i,this))")+"}"+d;return Function("fn,scope",b)}function Za(b,c){try{for(;c=c.parentNode;)if(c===b)return!0;return!1}catch(d){return!1}}function $a(){return(new XMLSerializer).serializeToString(this)}function u(b){for(var c in b)if(O.call(b,c)){var d=b[c];if("function"===typeof u.plugins[c])u.plugins[c](d);else"object"===typeof u[c]?avalon.mix(u[c],d):u[c]=d}return this} function ab(b){return b.replace(/([a-z\d])([A-Z]+)/g,"$1-$2").toLowerCase()}function oa(b){return 0>b.indexOf("-")&&0>b.indexOf("_")?b:b.replace(/[-_][^-_]/g,function(b){return b.charAt(1).toUpperCase()})}function bb(b){if(!("classList"in b)){b.classList={node:b};for(var c in cb)b.classList[c.slice(1)]=cb[c]}return b.classList}function db(b){try{b="true"===b?!0:"false"===b?!1:"null"===b?null:+b+""===b?+b:$b.test(b)?avalon.parseJSON(b):b}catch(c){}return b}function eb(b,c){if(0>=b.offsetWidth){if(ac.test(x["@:get"](b, -"display"))){var d={node:b},e;for(e in fb)d[e]=b.style[e],b.style[e]=fb[e];c.push(d)}(d=b.parentNode)&&1===d.nodeType&&eb(d,c)}}function gb(b){var c=b.nodeName;return c.toLowerCase()===c&&b.scopeName&&""===b.outerText}function bc(b){"url(#default#VML)"!==b.currentStyle.behavior&&(b.style.behavior="url(#default#VML)",b.style.display="inline-block",b.style.zoom=1)}function ya(b){Y[A]=b;avalon.openComputedCollect=!0;var c=b.evaluator;if(c)try{var d=cc.test(b.type)?b:c.apply(0,b.args);b.handler(d,b.element, +"display"))){var d={node:b},e;for(e in fb)d[e]=b.style[e],b.style[e]=fb[e];c.push(d)}(d=b.parentNode)&&1===d.nodeType&&eb(d,c)}}function gb(b){var c=b.nodeName;return c.toLowerCase()===c&&b.scopeName&&""===b.outerText}function bc(b){"url(#default#VML)"!==b.currentStyle.behavior&&(b.style.behavior="url(#default#VML)",b.style.display="inline-block",b.style.zoom=1)}function xa(b){Y[A]=b;avalon.openComputedCollect=!0;var c=b.evaluator;if(c)try{var d=cc.test(b.type)?b:c.apply(0,b.args);b.handler(d,b.element, b)}catch(e){v("warning:exception throwed in [registerSubscriber] "+e),delete b.evaluator,c=b.element,3===c.nodeType&&(d=c.parentNode,u.commentInterpolate?d.replaceChild(p.createComment(b.value),c):c.data=P+b.value+Q)}avalon.openComputedCollect=!1;delete Y[A]}function ka(b){var c=Y[A];b&&(c&&avalon.Array.ensure(b,c)&&c.element)&&hb(c,b)}function hb(b,c){b.$uuid=b.$uuid||ha();c.$uuid=c.$uuid||ha();var d={data:b,list:c,toString:function(){return b.$uuid+" "+c.$uuid}};S[d]||(S[d]=1,S.push(d))}function ib(){for(var b= -za,c=za+dc;b"))&&ob(b,c)}}function Ca(b,c){b.length&&c.cb(b.length);for(var d=0,e;e=b[d++];)e.vmodels=c,C[e.type](e,c),e.evaluator&&(e.element&&1===e.element.nodeType)&&e.element.removeAttribute(e.name);b.length=0}function rb(b,c){0b&&delete c[d.shift()];return c[e]=f}var d=[];return c}function xb(b,c,d){var e=d.type,f=d.filters?d.filters.join(""):"",g=c.map(function(b){return String(b.$id).replace(oc,"$1")})+b+e+f,h=pc(b).concat(),k=[],l=[],m=[],n="";c=wb(c);d.vars=[];for(var q=0,n=c.length;qb&&delete c[d.shift()];return c[e]=f}var d=[];return c}function xb(b,c,d){var e=d.type,f=d.filters?d.filters.join(""):"",g=c.map(function(b){return String(b.$id).replace(oc,"$1")})+b+e+f,h=pc(b).concat(),l=[],k=[],m=[],n="";c=wb(c);d.vars=[];for(var q=0,n=c.length;q>0)-(d.clientLeft>>0),c.pageY=b.clientY+(d.scrollTop>>0)-(d.clientTop>>0),c.wheelDeltaY=c.wheelDelta,c.wheelDeltaX=0);c.timeStamp=new Date-0;c.originalEvent=b;c.preventDefault=function(){b.returnValue=!1};c.stopPropagation=function(){b.cancelBubble=!0};return c}function Xb(b){var c=[];c.$id=ha();c.$model=b;c.$events={};c.$events[G]=[];c._=N({length:b.length});c._.$watch("length", function(b,d){c.$fire("length",b,d)});for(var d in R)c[d]=R[d];avalon.mix(c,Ab);return c}function Bb(b,c,d,e){var f=avalon.parseHTML(b.template),g=avalon.slice(f.childNodes);c.appendChild(f);d.$outer=b.$outer;b=b.vmodels;d=[d].concat(b);d.cb=b.cb;e.push({nodes:g,vmodels:d})}function Ha(b,c){var d=b.endRepeat,e=[],f=b.element.nextSibling;if(f!==d){do if(f!==d)e.push(f);else break;while(f=f.nextSibling)}return e[b.group*c]||d}function Cb(b,c,d){c*=d||1;d=[b];for(var e=1,f=I;eu.maxRepeatSize&& -da.pop()}b.length=0}function T(){p.body&&(D?(s["ready!"].state=2,D.checkDeps()):Fb.forEach(function(b){b(avalon)}),T=y)}function Gb(){try{B.doScroll("left"),T()}catch(b){setTimeout(Gb)}}var A=new Date-0,G="$"+A,r=Function("return this")(),Ac=r.require,Bc=r.define,ja=!1,z=/[^, ]+/g,Hb=/\[native code\]/,wa=/^(?:object|array)$/,Ib=/^\[object SVG\w*Element\]$/,Vb=/^\[object (?:Window|DOMWindow|global)\]$/,Ia=Object.prototype,O=Ia.hasOwnProperty,ia=Ia.toString,L=Array.prototype,$=L.slice,Y={},w=r.dispatchEvent, +da.length;eu.maxRepeatSize&& +da.pop()}b.length=0}function T(){p.body&&(D?(s["ready!"].state=2,D.checkDeps()):Fb.forEach(function(b){b(avalon)}),T=y)}function Gb(){try{B.doScroll("left"),T()}catch(b){setTimeout(Gb)}}var A=new Date-0,G="$"+A,r=Function("return this")(),Ac=r.require,Bc=r.define,ja=!1,z=/[^, ]+/g,Hb=/\[native code\]/,va=/^(?:object|array)$/,Ib=/^\[object SVG\w*Element\]$/,Vb=/^\[object (?:Window|DOMWindow|global)\]$/,Ia=Object.prototype,O=Ia.hasOwnProperty,ia=Ia.toString,L=Array.prototype,$=L.slice,Y={},w=r.dispatchEvent, B=p.documentElement,J=p.getElementsByTagName("head")[0],I=p.createDocumentFragment(),ea=p.createElement("div"),Jb={};"Boolean Number String Function Array Date RegExp Object Error".replace(z,function(b){Jb["[object "+b+"]"]=b.toLowerCase()});avalon=function(b){return new avalon.init(b)};avalon.init=function(b){this[0]=this.element=b};avalon.fn=avalon.prototype=avalon.init.prototype;avalon.type=function(b){return null==b?String(b):"object"===typeof b||"function"===typeof b?Jb[ia.call(b)]||"object": typeof b};var V="object"===typeof alert?function(b){try{return/^\s*\bfunction\b/.test(b+"")}catch(c){return!1}}:function(b){return"[object Function]"==ia.call(b)};avalon.isFunction=V;avalon.isWindow=function(b){return!b?!1:b==b.document&&b.document!=b};Ya(r)&&(avalon.isWindow=Ya);for(var Cc in avalon({}))break;var Dc="0"!==Cc;avalon.isPlainObject=function(b,c){if(!b||"object"!==avalon.type(b)||b.nodeType||avalon.isWindow(b))return!1;try{if(b.constructor&&!O.call(b,"constructor")&&!O.call(b.constructor.prototype, -"isPrototypeOf"))return!1}catch(d){return!1}if(Dc)for(c in b)return O.call(b,c);for(c in b);return void 0===c||O.call(b,c)};Hb.test(Object.getPrototypeOf)&&(avalon.isPlainObject=function(b){return!!b&&"object"===typeof b&&Object.getPrototypeOf(b)===Ia});avalon.mix=avalon.fn.mix=function(){var b,c,d,e,f,g=arguments[0]||{},h=1,k=arguments.length,l=!1;"boolean"===typeof g&&(l=g,g=arguments[1]||{},h++);"object"!==typeof g&&"function"!==avalon.type(g)&&(g={});h===k&&(g=this,h--);for(;h 0 Then","\t\t["+b+'] = [__proxy__]([__data__],"'+b+'")',"\tEnd If","\tOn Error Goto 0","\tEnd Property");f.push("End Class");b=f.join("\r\n"); b=r.findOrDefineVBClass(e,b);b===e&&r.parseVB(["Function "+e+"Factory(a, b)","\tDim o","\tSet o = (New "+e+")(a, b)","\tSet "+e+"Factory = o","End Function"].join("\r\n"));return r[b+"Factory"](c,Ec)}}if(!"\u53f8\u5f92\u6b63\u7f8e".trim){var Fc=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;String.prototype.trim=function(){return this.replace(Fc,"")}}var Gc=!{toString:null}.propertyIsEnumerable("toString"),Hc=function(){}.propertyIsEnumerable("prototype"),Kb="toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "), Ic=Kb.length;Object.keys||(Object.keys=function(b){var c=[],d=Hc&&"function"===typeof b;if("string"===typeof b||b&&b.callee)for(d=0;d @@ -55,72 +55,72 @@ this[0]||{},f=e.window&&e.document?e:9===e.nodeType?e.defaultView||e.parentWindo for(var e=0,f=Ob.length;e=d?"alpha(opacity="+100*d+")":"";c=b.filter||"";b.zoom=1;b.filter=(Pb.test(c)?c.replace(Pb,d):c+" "+d).trim();b.filter||b.removeAttribute("filter")};x["opacity:get"]=function(b){b=b.filters.alpha||b.filters["DXImageTransform.Microsoft.Alpha"];return(b&&b.enabled?b.opacity:100)/100+""}}"top,left".replace(z,function(b){x[b+":get"]=function(c){var d=x["@:get"](c,b);return/px$/.test(d)?d:avalon(c).position()[b]+"px"}});var fb={position:"absolute",visibility:"hidden",display:"block"}, -ac=/^(none|table(?!-c[ea]).+)/;"Width,Height".replace(z,function(b){var c=b.toLowerCase(),d="client"+b,e="scroll"+b,f="offset"+b;x[c+":get"]=function(c,d,e){var l=-4;"number"===typeof e&&(l=e);d="Width"===b?["Left","Right"]:["Top","Bottom"];e=c[f];if(2===l)return e+avalon.css(c,"margin"+d[0],!0)+avalon.css(c,"margin"+d[1],!0);0>l&&(e=e-avalon.css(c,"border"+d[0]+"Width",!0)-avalon.css(c,"border"+d[1]+"Width",!0));-4===l&&(e=e-avalon.css(c,"padding"+d[0],!0)-avalon.css(c,"padding"+d[1],!0));return e}; -x[c+"&get"]=function(b){var d=[];eb(b,d);for(var e=x[c+":get"](b),f=0,m;m=d[f++];){b=m.node;for(var n in m)"string"===typeof m[n]&&(b.style[n]=m[n])}return e};avalon.fn[c]=function(g){var h=this[0];if(0===arguments.length){if(h.setTimeout)return h["inner"+b]||h.document.documentElement[d];if(9===h.nodeType){var k=h.documentElement;return Math.max(h.body[e],k[e],h.body[f],k[f],k[d])}return x[c+"&get"](h)}return this.css(c,g)};avalon.fn["inner"+b]=function(){return x[c+":get"](this[0],void 0,-2)};avalon.fn["outer"+ +ac=/^(none|table(?!-c[ea]).+)/;"Width,Height".replace(z,function(b){var c=b.toLowerCase(),d="client"+b,e="scroll"+b,f="offset"+b;x[c+":get"]=function(c,d,e){var k=-4;"number"===typeof e&&(k=e);d="Width"===b?["Left","Right"]:["Top","Bottom"];e=c[f];if(2===k)return e+avalon.css(c,"margin"+d[0],!0)+avalon.css(c,"margin"+d[1],!0);0>k&&(e=e-avalon.css(c,"border"+d[0]+"Width",!0)-avalon.css(c,"border"+d[1]+"Width",!0));-4===k&&(e=e-avalon.css(c,"padding"+d[0],!0)-avalon.css(c,"padding"+d[1],!0));return e}; +x[c+"&get"]=function(b){var d=[];eb(b,d);for(var e=x[c+":get"](b),f=0,m;m=d[f++];){b=m.node;for(var n in m)"string"===typeof m[n]&&(b.style[n]=m[n])}return e};avalon.fn[c]=function(g){var h=this[0];if(0===arguments.length){if(h.setTimeout)return h["inner"+b]||h.document.documentElement[d];if(9===h.nodeType){var l=h.documentElement;return Math.max(h.body[e],l[e],h.body[f],l[f],l[d])}return x[c+"&get"](h)}return this.css(c,g)};avalon.fn["inner"+b]=function(){return x[c+":get"](this[0],void 0,-2)};avalon.fn["outer"+ b]=function(b){return x[c+":get"](this[0],void 0,!0===b?2:0)}});avalon.fn.offset=function(){var b=this[0],c={left:0,top:0};if(!b||!b.tagName||!b.ownerDocument)return c;var d=b.ownerDocument,e=d.body,f=d.documentElement,d=d.defaultView||d.parentWindow;if(!avalon.contains(f,b))return c;b.getBoundingClientRect&&(c=b.getBoundingClientRect());var b=f.clientTop||e.clientTop,g=f.clientLeft||e.clientLeft,h=Math.max(d.pageYOffset||0,f.scrollTop,e.scrollTop),e=Math.max(d.pageXOffset||0,f.scrollLeft,e.scrollLeft); -return{top:c.top+h-b,left:c.left+e-g}};var Qc=/^]+))?)*\s+value[\s=]/i,La={"option:get":r.VBArray?function(b){return Qc.test(b.outerHTML)?b.value:b.text.trim()}:function(b){return b.value},"select:get":function(b,c){for(var d,e=b.options,f=b.selectedIndex,g=La["option:get"],h="select-one"===b.type||0>f,k=h?null:[],l=h?f+1:e.length,m=0>f?l:h?f:0;m]+))?)*\s+value[\s=]/i,La={"option:get":r.VBArray?function(b){return Qc.test(b.outerHTML)?b.value:b.text.trim()}:function(b){return b.value},"select:get":function(b,c){for(var d,e=b.options,f=b.selectedIndex,g=La["option:get"],h="select-one"===b.type||0>f,l=h?null:[],k=h?f+1:e.length,m=0>f?k:h?f:0;m"],param:[1,""],col:[2,"","
"],legend:[1,"
"],option:[1,"\u4e0d\u80fd\u5bf9\u5e94\u4e00\u4e2a\u6570\u7ec4");d= -Array.isArray(d)?d.map(String):d+"";d+""!==b.oldValue&&(e.val(d),b.oldValue=d+"")};d.bound("change",function(){if(!1!==e.data("duplex-observe")){var f=e.val(),f=Array.isArray(f)?f.map(function(b){return d.pipe(b,d,"get")}):d.pipe(f,d,"get");f+""!==b.oldValue&&c(f);d.changed.call(b,f,d)}});qa(b,function(){ya(d);d.changed.call(b,c(),d)},NaN)};X.TEXTAREA=X.INPUT;var ga=avalon.eventHooks;"onmouseenter"in B||avalon.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(b,c){ga[b]={type:c,deel:function(c, +Array.isArray(d)?d.map(String):d+"";d+""!==b.oldValue&&(e.val(d),b.oldValue=d+"")};d.bound("change",function(){if(!1!==e.data("duplex-observe")){var f=e.val(),f=Array.isArray(f)?f.map(function(b){return d.pipe(b,d,"get")}):d.pipe(f,d,"get");f+""!==b.oldValue&&c(f);d.changed.call(b,f,d)}});qa(b,function(){xa(d);d.changed.call(b,c(),d)},NaN)};X.TEXTAREA=X.INPUT;var ga=avalon.eventHooks;"onmouseenter"in B||avalon.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(b,c){ga[b]={type:c,deel:function(c, e){return function(f){var g=f.relatedTarget;if(!g||g!==c&&!(c.compareDocumentPosition(g)&16))return delete f.type,f.type=b,e.call(c,f)}}}});avalon.each({AnimationEvent:"animationend",WebKitAnimationEvent:"webkitAnimationEnd"},function(b,c){r[b]&&!ga.animationend&&(ga.animationend={type:c})});"oninput"in p.createElement("input")||(ga.input={type:"propertychange",deel:function(b,c){return function(d){if("value"===d.propertyName)return d.type="input",c.call(b,d)}}});if(void 0===p.onmousewheel){var Ub= -void 0!==p.onwheel?"wheel":"DOMMouseScroll",id="wheel"===Ub?"deltaY":"detail";ga.mousewheel={type:Ub,deel:function(b,c){return function(d){d.wheelDeltaY=d.wheelDelta=0]*>([\S\s]*?)<\/script\s*>/gim,kd=/\s+(on[^=\s]+)(?:=("[^"]*"|'[^']*'|[^\s>]+))?/g,ld=/<\w+\b(?:(["'])[^"]*?(\1)|[^>])*>/ig,md={a:/\b(href)\=("javascript[^"]*"|'javascript[^']*')/ig,img:/\b(src)\=("javascript[^"]*"|'javascript[^']*')/ig,form:/\b(action)\=("javascript[^"]*"|'javascript[^']*')/ig}, +g;f++){var h=c[f];if(!la(h,d[f])){var e=!0,h=d.indexOf(h,f),l=this._splice(h,1)[0],k=d.splice(h,1)[0];this._splice(f,0,l);d.splice(f,0,k);this._fire("move",h,f)}}e&&this._fire("index",0);return this}});var zc=M("$index,$first,$last"),da=[],jd=/]*>([\S\s]*?)<\/script\s*>/gim,kd=/\s+(on[^=\s]+)(?:=("[^"]*"|'[^']*'|[^\s>]+))?/g,ld=/<\w+\b(?:(["'])[^"]*?(\1)|[^>])*>/ig,md={a:/\b(href)\=("javascript[^"]*"|'javascript[^']*')/ig,img:/\b(src)\=("javascript[^"]*"|'javascript[^']*')/ig,form:/\b(action)\=("javascript[^"]*"|'javascript[^']*')/ig}, nd=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,od=/([^\#-~| |!])/g,Xa=avalon.filters={uppercase:function(b){return b.toUpperCase()},lowercase:function(b){return b.toLowerCase()},truncate:function(b,c,d){c=c||30;d=void 0===d?"...":d;return b.length>c?b.slice(0,c-d.length)+d:String(b)},camelize:oa,sanitize:function(b){return b.replace(jd,"").replace(ld,function(b,d){var e=b.toLowerCase().match(/<(\w+)\s/);e&&(e=md[e[1]])&&(b=b.replace(e,function(b,c,d){b=d.charAt(0);return c+"="+b+"javascript:void(0)"+b}));return b.replace(kd, " ").replace(/\s+/g," ")})},escape:function(b){return String(b).replace(/&/g,"&").replace(nd,function(b){var d=b.charCodeAt(0);b=b.charCodeAt(1);return"&#"+(1024*(d-55296)+(b-56320)+65536)+";"}).replace(od,function(b){return"&#"+b.charCodeAt(0)+";"}).replace(//g,">")},currency:function(b,c){return(c||"\uffe5")+avalon.filters.number(b)},number:function(b,c,d,e){b=(b+"").replace(/[^0-9+\-Ee.]/g,"");b=!isFinite(+b)?0:+b;c=!isFinite(+c)?0:Math.abs(c);e=e||",";d=d||".";var f= "",f=function(b,c){var d=Math.pow(10,c);return""+Math.round(b*d)/d},f=(c?f(b,c):""+Math.round(b)).split(".");3b&&(e="-",b=-b);for(b=""+b;b.length-e)g+=e;0===g&&-12===e&&(g=12);return b(g, -d,f)}}function d(b,c){return function(d,e){var f=d["get"+b](),g=(c?"SHORT"+b:b).toUpperCase();return e[g][f]}}function e(b){var c;if(c=b.match(k)){b=new Date(0);var d=0,e=0,f=c[8]?b.setUTCFullYear:b.setFullYear,g=c[8]?b.setUTCHours:b.setHours;c[9]&&(d=parseInt(c[9]+c[10],10),e=parseInt(c[9]+c[11],10));f.call(b,parseInt(c[1],10),parseInt(c[2],10)-1,parseInt(c[3],10));d=parseInt(c[4]||0,10)-d;e=parseInt(c[5]||0,10)-e;f=parseInt(c[6]||0,10);c=Math.round(1E3*parseFloat("0."+(c[7]||0)));g.call(b,d,e,f, +d,f)}}function d(b,c){return function(d,e){var f=d["get"+b](),g=(c?"SHORT"+b:b).toUpperCase();return e[g][f]}}function e(b){var c;if(c=b.match(l)){b=new Date(0);var d=0,e=0,f=c[8]?b.setUTCFullYear:b.setFullYear,g=c[8]?b.setUTCHours:b.setHours;c[9]&&(d=parseInt(c[9]+c[10],10),e=parseInt(c[9]+c[11],10));f.call(b,parseInt(c[1],10),parseInt(c[2],10)-1,parseInt(c[3],10));d=parseInt(c[4]||0,10)-d;e=parseInt(c[5]||0,10)-e;f=parseInt(c[6]||0,10);c=Math.round(1E3*parseFloat("0."+(c[7]||0)));g.call(b,d,e,f, c)}return b}var f={yyyy:c("FullYear",4),yy:c("FullYear",2,0,!0),y:c("FullYear",1),MMMM:d("Month"),MMM:d("Month",!0),MM:c("Month",2,1),M:c("Month",1,1),dd:c("Date",2),d:c("Date",1),HH:c("Hours",2),H:c("Hours",1),hh:c("Hours",2,-12),h:c("Hours",1,-12),mm:c("Minutes",2),m:c("Minutes",1),ss:c("Seconds",2),s:c("Seconds",1),sss:c("Milliseconds",3),EEEE:d("Day"),EEE:d("Day",!0),a:function(b,c){return 12>b.getHours()?c.AMPMS[0]:c.AMPMS[1]},Z:function(c){c=-1*c.getTimezoneOffset();return c=(0<=c?"+":"")+(b(Math[0< -c?"floor":"ceil"](c/60),2)+b(Math.abs(c%60),2))}},g=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,h=/^\d+$/,k=/^(\d{4})-?(\d+)-?(\d+)(?:T(\d+)(?::?(\d+)(?::?(\d+)(?:\.(\d+))?)?)?(Z|([+-])(\d+):?(\d+))?)?$/,l=/^(\d+)\D(\d+)\D(\d+)/;Xa.date=function(b,c){var d=Xa.date.locate,k="",F=[],ua,m;c=c||"mediumDate";c=d[c]||c;"string"===typeof b&&(h.test(b)?b=parseInt(b,10):(b=b.trim().replace(l,function(b,c,d,e){return(4===e.length?[e,c,d]:[c,d,e]).join("-")}),b=e(b)),b=new Date(b)); -"number"===typeof b&&(b=new Date(b));if("date"===avalon.type(b)){for(;c;)(m=g.exec(c))?(F=F.concat(m.slice(1)),c=F.pop()):(F.push(c),c=null);F.forEach(function(c){ua=f[c];k+=ua?ua(b,d):c.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return k}};var m={AMPMS:{"0":"\u4e0a\u5348",1:"\u4e0b\u5348"},DAY:{"0":"\u661f\u671f\u65e5",1:"\u661f\u671f\u4e00",2:"\u661f\u671f\u4e8c",3:"\u661f\u671f\u4e09",4:"\u661f\u671f\u56db",5:"\u661f\u671f\u4e94",6:"\u661f\u671f\u516d"},MONTH:{"0":"1\u6708",1:"2\u6708",2:"3\u6708", +c?"floor":"ceil"](c/60),2)+b(Math.abs(c%60),2))}},g=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,h=/^\d+$/,l=/^(\d{4})-?(\d+)-?(\d+)(?:T(\d+)(?::?(\d+)(?::?(\d+)(?:\.(\d+))?)?)?(Z|([+-])(\d+):?(\d+))?)?$/,k=/^(\d+)\D(\d+)\D(\d+)/;Xa.date=function(b,c){var d=Xa.date.locate,l="",F=[],ta,m;c=c||"mediumDate";c=d[c]||c;"string"===typeof b&&(h.test(b)?b=parseInt(b,10):(b=b.trim().replace(k,function(b,c,d,e){return(4===e.length?[e,c,d]:[c,d,e]).join("-")}),b=e(b)),b=new Date(b)); +"number"===typeof b&&(b=new Date(b));if("date"===avalon.type(b)){for(;c;)(m=g.exec(c))?(F=F.concat(m.slice(1)),c=F.pop()):(F.push(c),c=null);F.forEach(function(c){ta=f[c];l+=ta?ta(b,d):c.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return l}};var m={AMPMS:{"0":"\u4e0a\u5348",1:"\u4e0b\u5348"},DAY:{"0":"\u661f\u671f\u65e5",1:"\u661f\u671f\u4e00",2:"\u661f\u671f\u4e8c",3:"\u661f\u671f\u4e09",4:"\u661f\u671f\u56db",5:"\u661f\u671f\u4e94",6:"\u661f\u671f\u516d"},MONTH:{"0":"1\u6708",1:"2\u6708",2:"3\u6708", 3:"4\u6708",4:"5\u6708",5:"6\u6708",6:"7\u6708",7:"8\u6708",8:"9\u6708",9:"10\u6708",10:"11\u6708",11:"12\u6708"},SHORTDAY:{"0":"\u5468\u65e5",1:"\u5468\u4e00",2:"\u5468\u4e8c",3:"\u5468\u4e09",4:"\u5468\u56db",5:"\u5468\u4e94",6:"\u5468\u516d"},fullDate:"y\u5e74M\u6708d\u65e5EEEE",longDate:"y\u5e74M\u6708d\u65e5",medium:"yyyy-M-d ah:mm:ss",mediumDate:"yyyy-M-d",mediumTime:"ah:mm:ss","short":"yy-M-d ah:mm",shortDate:"yy-M-d",shortTime:"ah:mm"};m.SHORTMONTH=m.MONTH;Xa.date.locate=m};var s=avalon.modules= {"ready!":{exports:avalon},avalon:{exports:avalon,state:2}};new function(){function b(b){return(b||"").replace(/[?#].*/,"")}function c(b){var c;try{a.b.c()}catch(d){c=d.stack,!c&&r.opera&&(c=(String(d).match(/of linked script \S+/g)||[]).join(" "))}if(c)return c=c.split(/[@ ]/g).pop(),c="("===c[0]?c.slice(1,-1):c.replace(/\s/,""),c.replace(/(:\d+)?:\d+$/i,"");c=(b?p:J).getElementsByTagName("script");for(var e=c.length,f;f=c[--e];)if((b||f.className===G)&&"interactive"===f.readyState)return f.className= -f.src}function d(b,c){for(var e in b)if("\u53f8\u5f92\u6b63\u7f8e"===b[e]&&2!==s[e].state&&(e===c||d(s[e].deps,c)))return!0}function e(){var b=l.length,c;a:for(;c=l[--b];){c=s[c];var d=c.deps,f;for(f in d)if(O.call(d,f)&&2!==s[f].state)continue a;2!==c.state&&(l.splice(b,1),k(c.id,c.args,c.factory),e())}}function f(c,d,e){var f=b(c.src);c.onload=c.onreadystatechange=c.onerror=null;if(d||e&&!s[f].state)setTimeout(function(){J.removeChild(c);c=null}),v("debug: \u52a0\u8f7d "+f+" \u5931\u8d25"+d+" "+ +f.src}function d(b,c){for(var e in b)if("\u53f8\u5f92\u6b63\u7f8e"===b[e]&&2!==s[e].state&&(e===c||d(s[e].deps,c)))return!0}function e(){var b=k.length,c;a:for(;c=k[--b];){c=s[c];var d=c.deps,f;for(f in d)if(O.call(d,f)&&2!==s[f].state)continue a;2!==c.state&&(k.splice(b,1),l(c.id,c.args,c.factory),e())}}function f(c,d,e){var f=b(c.src);c.onload=c.onreadystatechange=c.onerror=null;if(d||e&&!s[f].state)setTimeout(function(){J.removeChild(c);c=null}),v("debug: \u52a0\u8f7d "+f+" \u5931\u8d25"+d+" "+ !s[f].state);else return!0}function g(c,d,e,f){if("ready!"===c||s[c]&&2===s[c].state)return c;var g;c=c.replace(/^\w+!/,function(b){g=b.slice(0,-1);return""});g=g||"js";g=U[g]||y;"object"===typeof u.shim[c]&&(f=u.shim[c]);u.paths[c]&&(c=u.paths[c]);if(/^(\w+)(\d)?:.*/.test(c))e=c;else{d=d.substr(0,d.lastIndexOf("/"));var h=c.charAt(0);if("."!==h&&"/"!==h)e=n+c;else if("./"===c.slice(0,2))e=d+c.slice(1);else if(".."===c.slice(0,2))for(e=d+"/"+c;t.test(e);)e=e.replace(t,"");else"/"===h?e=c:avalon.error("\u4e0d\u7b26\u5408\u6a21\u5757\u6807\u8bc6\u89c4\u5219: "+ -c)}c=b(e);(d=g.ext)&&c.slice(0-d.length)!==d&&(e+=d);u.nocache&&(e+=(-1===e.indexOf("?")?"?":"&")+(new Date-0));return g(e,f)}function h(b,c,d){var e=p.createElement("script");e.className=G;e[w?"onload":"onreadystatechange"]=function(){if(w||/loaded|complete/i.test(e.readyState)){var g=m.pop();g&&g.delay(c);d&&d();f(e,!1,!w)&&v("debug: \u5df2\u6210\u529f\u52a0\u8f7d "+b)}};e.onerror=function(){f(e,!0)};e.src=b;J.insertBefore(e,J.firstChild);v("debug: \u6b63\u51c6\u5907\u52a0\u8f7d "+b)}function k(b, -c,d){for(var e=0,f=[],g;g=c[e++];)f.push(s[g].exports);c=Object(s[b]);d=d.apply(r,f);c.state=2;void 0!==d&&(s[b].exports=d);return d}var l=[],m=[],n;U.js=function(c,d){var e=b(c);s[e]||(s[e]={id:e,exports:{}},d?D(d.deps||"",function(){h(c,e,function(){s[e].state=2;d.exports&&(s[e].exports="function"===typeof d.exports?d.exports():r[d.exports]);D.checkDeps()})}):h(c,e));return e};U.css=function(b){var c=b.replace(/(#.+|\W)/g,"");if(!p.getElementById(c)){var d=p.createElement("link");d.rel="stylesheet"; +c)}c=b(e);(d=g.ext)&&c.slice(0-d.length)!==d&&(e+=d);u.nocache&&(e+=(-1===e.indexOf("?")?"?":"&")+(new Date-0));return g(e,f)}function h(b,c,d){var e=p.createElement("script");e.className=G;e[w?"onload":"onreadystatechange"]=function(){if(w||/loaded|complete/i.test(e.readyState)){var g=m.pop();g&&g.delay(c);d&&d();f(e,!1,!w)&&v("debug: \u5df2\u6210\u529f\u52a0\u8f7d "+b)}};e.onerror=function(){f(e,!0)};e.src=b;J.insertBefore(e,J.firstChild);v("debug: \u6b63\u51c6\u5907\u52a0\u8f7d "+b)}function l(b, +c,d){for(var e=0,f=[],g;g=c[e++];)f.push(s[g].exports);c=Object(s[b]);d=d.apply(r,f);c.state=2;void 0!==d&&(s[b].exports=d);return d}var k=[],m=[],n;U.js=function(c,d){var e=b(c);s[e]||(s[e]={id:e,exports:{}},d?D(d.deps||"",function(){h(c,e,function(){s[e].state=2;d.exports&&(s[e].exports="function"===typeof d.exports?d.exports():r[d.exports]);D.checkDeps()})}):h(c,e));return e};U.css=function(b){var c=b.replace(/(#.+|\W)/g,"");if(!p.getElementById(c)){var d=p.createElement("link");d.rel="stylesheet"; d.href=b;d.id=c;J.insertBefore(d,J.firstChild)}};U.css.ext=".css";U.js.ext=".js";U.text=function(b){var c=Sa(),d=b.replace(/[?#].*/,"");s[d]={};c.onreadystatechange=function(){if(4===c.readyState){var e=c.status;399e?avalon.error(b+" \u5bf9\u5e94\u8d44\u6e90\u4e0d\u5b58\u5728\u6216\u6ca1\u6709\u5f00\u542f CORS"):(s[d].state=2,s[d].exports=c.responseText,D.checkDeps())}};c.open("GET",b,!0);"withCredentials"in c&&(c.withCredentials=!0);c.setRequestHeader("X-Requested-With","XMLHttpRequest"); -c.send();return d};var q=c(!0);q||(q=avalon.slice(p.scripts).pop().src);q=b(q);n=u.base=q.slice(0,q.lastIndexOf("/")+1);var t=/\/\w+\/\.\./;D=avalon.require=function(b,c,d){var f={},h=[],m=0,p=0,q=d||"callback"+setTimeout("1");d=d||n;String(b).replace(z,function(b){if(b=g(b,d))m++,s[b]&&2===s[b].state&&p++,f[b]||(h.push(b),f[b]="\u53f8\u5f92\u6b63\u7f8e")});s[q]={id:q,factory:c,deps:f,args:h,state:1};m===p?k(q,h,c):l.unshift(q);e()};D.define=function(e,f,g){var h=$.call(arguments);if("string"===typeof e)var k= +c.send();return d};var q=c(!0);q||(q=avalon.slice(p.scripts).pop().src);q=b(q);n=u.base=q.slice(0,q.lastIndexOf("/")+1);var t=/\/\w+\/\.\./;D=avalon.require=function(b,c,d){var f={},h=[],m=0,p=0,q=d||"callback"+setTimeout("1");d=d||n;String(b).replace(z,function(b){if(b=g(b,d))m++,s[b]&&2===s[b].state&&p++,f[b]||(h.push(b),f[b]="\u53f8\u5f92\u6b63\u7f8e")});s[q]={id:q,factory:c,deps:f,args:h,state:1};m===p?l(q,h,c):k.unshift(q);e()};D.define=function(e,f,g){var h=$.call(arguments);if("string"===typeof e)var k= h.shift();"function"===typeof h[0]&&h.unshift([]);var l=s[k]&&1<=s[k].state?k:b(c());!s[l]&&k&&(s[l]={id:l,factory:g,state:1});g=h[1];g.id=k;g.delay=function(b){h.push(b);var c=!0;try{c=d(s[b].deps,b)}catch(e){}c&&avalon.error(b+"\u6a21\u5757\u4e0e\u4e4b\u524d\u7684\u6a21\u5757\u5b58\u5728\u5faa\u73af\u4f9d\u8d56\uff0c\u8bf7\u4e0d\u8981\u76f4\u63a5\u7528script\u6807\u7b7e\u5f15\u5165"+b+"\u6a21\u5757");delete g.delay;D.apply(null,h)};l?g.delay(l,h):m.push(g)};D.define.amd=s;D.config=u;D.checkDeps= e};var Fb=[];"complete"===p.readyState?setTimeout(T):w?p.addEventListener("DOMContentLoaded",T):(p.attachEvent("onreadystatechange",function(){"complete"===p.readyState&&T()}),B.doScroll&&Gb());avalon.bind(r,"load",T);avalon.ready=function(b){D?D("ready!",b):T===y?b(avalon):Fb.push(b)};avalon.config({loader:!0});avalon.ready(function(){avalon.scan(p.body)})})(document); diff --git a/avalon.modern.js b/avalon.modern.js index a0bf712a1..f2110daa2 100644 --- a/avalon.modern.js +++ b/avalon.modern.js @@ -325,7 +325,7 @@ var svg = DOC.createElementNS(svgns, "svg") svg.innerHTML = '' if (!rsvg.test(svg.firstChild)) {// #409 - + function enumerateNode(node, targetNode) { if (node && node.childNodes) { var nodes = node.childNodes @@ -1621,7 +1621,7 @@ var param = match[2] || "" var value = attr.value var name = attr.name - msData[name.replace(/(\-[$\w]+)/g,"")] = value + msData[name] = value if (events[type]) { param = type type = "on" @@ -1661,8 +1661,8 @@ } } } - if (msData["ms-checked"] && msData["ms-duplex"]) { - log("warning!一个元素上不能同时定义ms-checked与ms-duplex") + if (msData["ms-attr-checked"] && msData["ms-duplex"]) { + log("warning!一个元素上不能同时定义ms-attr-checked与ms-duplex") } bindings.sort(function(a, b) { return a.priority - b.priority @@ -2457,9 +2457,13 @@ if (elem.type === "radio" && data.param === "") { data.param = "checked" } + if (elem.msData) { + elem.msData["ms-duplex"] = data.value + } data.param.replace(/\w+/g, function(name) { if (/^(checkbox|radio)$/.test(elem.type) && /^(radio|checked)$/.test(name)) { - log("ms-duplex-radio已经更名为ms-duplex-checked") + if (name === "radio") + log("ms-duplex-radio已经更名为ms-duplex-checked") name = "checked" data.isChecked = true } @@ -3551,7 +3555,7 @@ } var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/, NUMBER_STRING = /^\d+$/ - var riso8601= /^(\d{4})-?(\d+)-?(\d+)(?:T(\d+)(?::?(\d+)(?::?(\d+)(?:\.(\d+))?)?)?(Z|([+-])(\d+):?(\d+))?)?$/ + var riso8601 = /^(\d{4})-?(\d+)-?(\d+)(?:T(\d+)(?::?(\d+)(?::?(\d+)(?:\.(\d+))?)?)?(Z|([+-])(\d+):?(\d+))?)?$/ // 1 2 3 4 5 6 7 8 9 10 11 function jsonStringToDate(string) { diff --git a/avalon.modern.min.js b/avalon.modern.min.js index c1ac79ad7..2e01fea9d 100644 --- a/avalon.modern.min.js +++ b/avalon.modern.min.js @@ -1,38 +1,38 @@ (function(p){function v(){}function u(){avalon.config.debug&&console.log.apply(console,arguments)}function J(b,c){"string"===typeof b&&(b=b.match(w)||[]);for(var d={},e=void 0!==c?c:1,f=0,g=b.length;f=Object.keys(e).length){var P=e.set,E=e.get;n=function(b){var e=f.$events,g=d[c]; -if(arguments.length){if(da)return;if(S(P)){var h=e[c];e[c]=[];P.call(f,b);e[c]=h}}else avalon.openComputedCollect&&ea(e[c]);b=d[c]=E.call(f);if(!fa(g,b)){if(ga&&(h=T[f.$id])&&h[c])h[c].$val=b;oa(e[c]);f.$events&&Q.$fire.call(f,c,b,g)}return b};k.push(function(){W[B]={evaluator:n,element:G,type:"computed::"+c,handler:v,args:[]};n();ea(g[c]);delete W[B]})}else La.test(l)?(n=function(b){var e=n.child,h=d[c];if(arguments.length)!da&&!fa(h,b)&&(e=n.child=xb(f,c,b,l),b=d[c]=e.$model,(e=pa[e.$id])&&e(), -f.$events&&Q.$fire.call(f,c,b,h));else return ea(g[c]),e},(n.child=K(e,0,d[c])).$events[F]=g[c]):n=function(b){var e=d[c];if(arguments.length){if(!fa(e,b)){d[c]=b;if(ga){var h=T[f.$id];h&&h[c]&&(h[c].$val=b)}oa(g[c]);f.$events&&Q.$fire.call(f,c,b,e)}}else return ea(g[c]),e};h[c]=n}})(e,b[e]);Ka.forEach(function(c){delete b[c];delete d[c]});Object.defineProperties(f,yb(h));for(var l in b)h[l]||(f[l]=b[l]);f.$id=ca();f.$model=d;f.$events=g;for(e in Q)f[e]=Q[e];Object.defineProperty(f,"hasOwnProperty", -{value:function(b){return b in f.$model},writable:!1,enumerable:!1,configurable:!0});k.forEach(function(b){b()});return f}function yb(b){var c={},d;for(d in b)c[d]={get:b[d],set:b[d],enumerable:!0,configurable:!0};return c}function xb(b,c,d,e){var f=b[c];if("array"===e){if(!Array.isArray(d)||f===d)return f;f.clear();f.pushArray(d.concat());return f}var g=b.$events[c];T[f.$id]&&(ga--,delete T[f.$id]);var h=K(d);h.$events[F]=g;pa[h.$id]=function(b){for(;b=g.shift();)(function(b){b.type&&avalon.nextTick(function(){b.rollback&& -b.rollback();y[b.type](b,b.vmodels)})})(b);delete pa[h.$id]};return h}function s(b){for(var c in b)if(Ma.call(b,c)){var d=b[c];if("function"===typeof s.plugins[c])s.plugins[c](d);else"object"===typeof s[c]?avalon.mix(s[c],d):s[c]=d}return this}function Na(b){return b.replace(/([a-z\d])([A-Z]+)/g,"$1-$2").toLowerCase()}function ha(b){return 0>b.indexOf("-")&&0>b.indexOf("_")?b:b.replace(/[-_][^-_]/g,function(b){return b.charAt(1).toUpperCase()})}function ia(b){try{b="true"===b?!0:"false"===b?!1:"null"=== -b?null:+b+""===b?+b:zb.test(b)?JSON.parse(b):b}catch(c){}return b}function Oa(b,c){if(0>=b.offsetWidth){var d=getComputedStyle(b,null);if(Ab.test(d.display)){var e={node:b},f;for(f in Pa)e[f]=d[f],b.style[f]=Pa[f];c.push(e)}(d=b.parentNode)&&1===d.nodeType&&Oa(d,c)}}function qa(b){W[B]=b;avalon.openComputedCollect=!0;var c=b.evaluator;if(c)try{var d=Bb.test(b.type)?b:c.apply(0,b.args);b.handler(d,b.element,b)}catch(e){u("warning:exception throwed in [registerSubscriber] "+e),delete b.evaluator,c= -b.element,3===c.nodeType&&(d=c.parentNode,s.commentInterpolate?d.replaceChild(p.createComment(b.value),c):c.data=L+b.value+M)}avalon.openComputedCollect=!1;delete W[B]}function ea(b){var c=W[B];b&&(c&&avalon.Array.ensure(b,c)&&c.element)&&Qa(c,b)}function Qa(b,c){b.$uuid=b.$uuid||ca();c.$uuid=c.$uuid||ca();var d={data:b,list:c,toString:function(){return b.$uuid+" "+c.$uuid}};R[d]||(R[d]=1,R.push(d))}function Ra(){for(var b=ra,c=ra+Cb;bb.indexOf("-")&&0>b.indexOf("_")?b:b.replace(/[-_][^-_]/g,function(b){return b.charAt(1).toUpperCase()})}function ia(b){try{b="true"===b?!0:"false"===b?!1:"null"=== +b?null:+b+""===b?+b:zb.test(b)?JSON.parse(b):b}catch(c){}return b}function Oa(b,c){if(0>=b.offsetWidth){var d=getComputedStyle(b,null);if(Ab.test(d.display)){var e={node:b},f;for(f in Pa)e[f]=d[f],b.style[f]=Pa[f];c.push(e)}(d=b.parentNode)&&1===d.nodeType&&Oa(d,c)}}function pa(b){W[B]=b;avalon.openComputedCollect=!0;var c=b.evaluator;if(c)try{var d=Bb.test(b.type)?b:c.apply(0,b.args);b.handler(d,b.element,b)}catch(e){u("warning:exception throwed in [registerSubscriber] "+e),delete b.evaluator,c= +b.element,3===c.nodeType&&(d=c.parentNode,s.commentInterpolate?d.replaceChild(p.createComment(b.value),c):c.data=L+b.value+M)}avalon.openComputedCollect=!1;delete W[B]}function ea(b){var c=W[B];b&&(c&&avalon.Array.ensure(b,c)&&c.element)&&Qa(c,b)}function Qa(b,c){b.$uuid=b.$uuid||ca();c.$uuid=c.$uuid||ca();var d={data:b,list:c,toString:function(){return b.$uuid+" "+c.$uuid}};R[d]||(R[d]=1,R.push(d))}function Ra(){for(var b=qa,c=qa+Cb;bb&&delete c[d.shift()];return c[e]=f}var d=[];return c}function eb(b,c,d){var e=d.type,f="duplex"===e,g=d.filters?d.filters.join(""): -"",h=c.map(function(b){return b.$id.replace(Lb,"$1")})+b+e+g,k=Mb(b).concat(),l=[],m=[],q=[],n="";d.vars=[];c=cb(c);for(var t=0,n=c.length;ts.maxRepeatSize&&$.pop()}b.length=0}function aa(){A?(r["ready!"].state=2,A.checkDeps()):lb.forEach(function(b){b(avalon)});aa=v}var B=Date.now(),F="$"+B,x=Function("return this")(),Wb=x.require,Xb=x.define,da=!1,w=/[^, ]+/g,La=/^(?:object|array)$/,mb=/^\[object SVG\w*Element\]$/,Yb=/^\[object (Window|DOMWindow|global)\]$/, -Aa=Object.prototype,Ma=Aa.hasOwnProperty,Ba=Aa.toString,N=Array.prototype,ja=N.slice,W={},G=p.head,D=p.documentElement,H=p.createDocumentFragment(),ma=p.createElement("div"),nb={};"Boolean Number String Function Array Date RegExp Object Error".replace(w,function(b){nb["[object "+b+"]"]=b.toLowerCase()});x.avalon=function(b){return new avalon.init(b)};avalon.init=function(b){this[0]=this.element=b};avalon.fn=avalon.prototype=avalon.init.prototype;avalon.isFunction=S;avalon.type=function(b){return null== -b?String(b):"object"===typeof b||"function"===typeof b?nb[Ba.call(b)]||"object":typeof b};avalon.isWindow=function(b){return Yb.test(Ba.call(b))};avalon.isPlainObject=function(b){return!!b&&"object"===typeof b&&Object.getPrototypeOf(b)===Aa};avalon.mix=avalon.fn.mix=function(){var b,c,d,e,f,g=arguments[0]||{},h=1,k=arguments.length,l=!1;"boolean"===typeof g&&(l=g,g=arguments[1]||{},h++);"object"!==typeof g&&"function"!==avalon.type(g)&&(g={});h===k&&(g=this,h--);for(;hb&&delete c[d.shift()];return c[e]=f}var d=[];return c}function eb(b,c,d){var e=d.type,f="duplex"=== +e,g=d.filters?d.filters.join(""):"",h=c.map(function(b){return b.$id.replace(Lb,"$1")})+b+e+g,k=Mb(b).concat(),l=[],m=[],q=[],n="";d.vars=[];c=cb(c);for(var t=0,n=c.length;ts.maxRepeatSize&&$.pop()}b.length=0}function aa(){A?(r["ready!"].state=2,A.checkDeps()):lb.forEach(function(b){b(avalon)});aa=v}var B=Date.now(),F="$"+B,x=Function("return this")(),Wb=x.require,Xb=x.define,da=!1,w=/[^, ]+/g,La=/^(?:object|array)$/,mb=/^\[object SVG\w*Element\]$/,Yb=/^\[object (Window|DOMWindow|global)\]$/, +za=Object.prototype,Ma=za.hasOwnProperty,Aa=za.toString,N=Array.prototype,ja=N.slice,W={},G=p.head,D=p.documentElement,H=p.createDocumentFragment(),la=p.createElement("div"),nb={};"Boolean Number String Function Array Date RegExp Object Error".replace(w,function(b){nb["[object "+b+"]"]=b.toLowerCase()});x.avalon=function(b){return new avalon.init(b)};avalon.init=function(b){this[0]=this.element=b};avalon.fn=avalon.prototype=avalon.init.prototype;avalon.isFunction=S;avalon.type=function(b){return null== +b?String(b):"object"===typeof b||"function"===typeof b?nb[Aa.call(b)]||"object":typeof b};avalon.isWindow=function(b){return Yb.test(Aa.call(b))};avalon.isPlainObject=function(b){return!!b&&"object"===typeof b&&Object.getPrototypeOf(b)===za};avalon.mix=avalon.fn.mix=function(){var b,c,d,e,f,g=arguments[0]||{},h=1,k=arguments.length,l=!1;"boolean"===typeof g&&(l=g,g=arguments[1]||{},h++);"object"!==typeof g&&"function"!==avalon.type(g)&&(g={});h===k&&(g=this,h--);for(;h';if(!mb.test(ob.firstChild)){var Ca=function(b,c){if(b&&b.childNodes)for(var d=b.childNodes,e=0,f;f=d[e++];)if(f.tagName){var g=p.createElementNS("http://www.w3.org/2000/svg",f.tagName.toLowerCase());N.forEach.call(f.attributes,function(b){g.setAttribute(b.name, -b.value)});Ca(f,g);c.appendChild(g)}};Object.defineProperties(SVGElement.prototype,{outerHTML:{enumerable:!0,configurable:!0,get:function(){return(new XMLSerializer).serializeToString(this)},set:function(b){var c=this.tagName.toLowerCase(),d=this.parentNode;b=avalon.parseHTML(b);"svg"===c?d.insertBefore(b,this):(c=p.createDocumentFragment(),Ca(b,c),d.insertBefore(c,this));d.removeChild(this)}},innerHTML:{enumerable:!0,configurable:!0,get:function(){var b=RegExp("$","i");return this.outerHTML.replace(RegExp("<"+ -this.nodeName+'\\b(?:(["\'])[^"]*?(\\1)|[^>])*>',"i"),"").replace(b,"")},set:function(b){avalon.clearHTML&&(avalon.clearHTML(this),b=avalon.parseHTML(b),Ca(b,this))}}})}}var la=avalon.vmodels={};avalon.define=function(b,c){var d=b.$id||b;d||u("warning: \u5fc5\u987b\u6307\u5b9a$id");la[d]&&u("warning: "+d+" \u5df2\u7ecf\u5b58\u5728\u4e8eavalon.vmodels\u4e2d");if("object"===typeof b)var e=K(b);else e={$watch:v},c(e),e=K(e),da=!0,c(e),da=!1;e.$id=d;return la[d]=e};var Ka="$id,$watch,$unwatch,$fire,$events,$model,$skipArray".match(w), -fa=Object.is||function(b,c){return 0===b&&0===c?1/b===1/c:b!==b?c!==c:b===c},T={},ga=0,pa={},L,M,X,pb,bb,qb=/[-.*+?^${}()|[\]\/\\]/g,A=v,O={loader:function(b){x.define=b?A.define:Xb;x.require=b?A:Wb},interpolate:function(b){L=b[0];M=b[1];L===M?avalon.error("openTag!==closeTag",SyntaxError):"\x3c!--,--\x3e"===b+""?s.commentInterpolate=!0:(b=L+"test"+M,ma.innerHTML=b,ma.innerHTML!==b&&0<=ma.innerHTML.indexOf("<")&&avalon.error("\u6b64\u5b9a\u754c\u7b26\u4e0d\u5408\u6cd5",SyntaxError),ma.innerHTML= +16)});avalon.contains=function(b,c){try{for(;c=c.parentNode;)if(c===b)return!0;return!1}catch(d){return!1}};if(x.SVGElement){var ob=p.createElementNS("http://www.w3.org/2000/svg","svg");ob.innerHTML='';if(!mb.test(ob.firstChild)){var Ba=function(b,c){if(b&&b.childNodes)for(var d=b.childNodes,e=0,f;f=d[e++];)if(f.tagName){var g=p.createElementNS("http://www.w3.org/2000/svg",f.tagName.toLowerCase());N.forEach.call(f.attributes,function(b){g.setAttribute(b.name, +b.value)});Ba(f,g);c.appendChild(g)}};Object.defineProperties(SVGElement.prototype,{outerHTML:{enumerable:!0,configurable:!0,get:function(){return(new XMLSerializer).serializeToString(this)},set:function(b){var c=this.tagName.toLowerCase(),d=this.parentNode;b=avalon.parseHTML(b);"svg"===c?d.insertBefore(b,this):(c=p.createDocumentFragment(),Ba(b,c),d.insertBefore(c,this));d.removeChild(this)}},innerHTML:{enumerable:!0,configurable:!0,get:function(){var b=RegExp("$","i");return this.outerHTML.replace(RegExp("<"+ +this.nodeName+'\\b(?:(["\'])[^"]*?(\\1)|[^>])*>',"i"),"").replace(b,"")},set:function(b){avalon.clearHTML&&(avalon.clearHTML(this),b=avalon.parseHTML(b),Ba(b,this))}}})}}var Ca=avalon.vmodels={};avalon.define=function(b,c){var d=b.$id||b;d||u("warning: \u5fc5\u987b\u6307\u5b9a$id");Ca[d]&&u("warning: "+d+" \u5df2\u7ecf\u5b58\u5728\u4e8eavalon.vmodels\u4e2d");if("object"===typeof b)var e=K(b);else e={$watch:v},c(e),e=K(e),da=!0,c(e),da=!1;e.$id=d;return Ca[d]=e};var Ka="$id,$watch,$unwatch,$fire,$events,$model,$skipArray".match(w), +fa=Object.is||function(b,c){return 0===b&&0===c?1/b===1/c:b!==b?c!==c:b===c},T={},ga=0,oa={},L,M,X,pb,bb,qb=/[-.*+?^${}()|[\]\/\\]/g,A=v,O={loader:function(b){x.define=b?A.define:Xb;x.require=b?A:Wb},interpolate:function(b){L=b[0];M=b[1];L===M?avalon.error("openTag!==closeTag",SyntaxError):"\x3c!--,--\x3e"===b+""?s.commentInterpolate=!0:(b=L+"test"+M,la.innerHTML=b,la.innerHTML!==b&&0<=la.innerHTML.indexOf("<")&&avalon.error("\u6b64\u5b9a\u754c\u7b26\u4e0d\u5408\u6cd5",SyntaxError),la.innerHTML= "");b=(L+"").replace(qb,"\\$&");var c=(M+"").replace(qb,"\\$&");X=RegExp(b+"(.*?)"+c);pb=RegExp(b+"(.*?)"+c,"g");bb=RegExp(b+".*?"+c+"|\\sms-")}};s.debug=!0;s.plugins=O;s.plugins.interpolate(["{{","}}"]);s.paths={};s.shim={};s.maxRepeatSize=100;avalon.config=s;"add,remove".replace(w,function(b){avalon.fn[b+"Class"]=function(c){var d=this[0];c&&("string"===typeof c&&d&&1===d.nodeType)&&c.replace(/\S+/g,function(c){d.classList[b](c)});return this}});avalon.fn.mix({hasClass:function(b){var c=this[0]|| {};return 1===c.nodeType&&c.classList.contains(b)},toggleClass:function(b,c){for(var d,e=0,f=b.split(/\s+/),g="boolean"===typeof c;d=f[e++];)this[(g?c:!this.hasClass(d))?"addClass":"removeClass"](d);return this},attr:function(b,c){return 2===arguments.length?(this[0].setAttribute(b,c),this):this[0].getAttribute(b)},data:function(b,c){b="data-"+Na(b||"");switch(arguments.length){case 2:return this.attr(b,c),this;case 1:var d=this.attr(b);return ia(d);case 0:var e={};N.forEach.call(this[0].attributes, function(c){c&&(b=c.name,b.indexOf("data-")||(b=ha(b.slice(5)),e[b]=ia(c.value)))});return e}},removeData:function(b){b="data-"+Na(b);this[0].removeAttribute(b);return this},css:function(b,c){if(avalon.isPlainObject(b))for(var d in b)avalon.css(this,d,b[d]);else var e=avalon.css(this,b,c);return void 0!==e?e:this},position:function(){var b,c,d=this[0],e={top:0,left:0};if(d)return"fixed"===this.css("position")?c=d.getBoundingClientRect():(b=this.offsetParent(),c=this.offset(),"HTML"!==b[0].tagName&& @@ -49,38 +49,38 @@ function(b){C[b]=C.g});var $b=/<([\w:]+)/,ac=/<(?!area|br|col|embed|hr|img|input cc.cloneNode(!1);N.forEach.call(f.attributes,function(b){g.setAttribute(b.name,b.value)});g.text=f.text;f.parentNode.replaceChild(g,f)}for(;b=c.firstChild;)d.appendChild(b);return d};avalon.innerHTML=function(b,c){var d=this.parseHTML(c);this.clearHTML(b).appendChild(d)};avalon.clearHTML=function(b){for(b.textContent="";b.firstChild;)b.removeChild(b.firstChild);return b};var Q={$watch:function(b,c){if("function"===typeof c){var d=this.$events[b];d?d.push(c):this.$events[b]=[c]}else this.$events=this.$watch.backup; return this},$unwatch:function(b,c){var d=arguments.length;if(0===d)this.$watch.backup=this.$events,this.$events={};else if(1===d)this.$events[b]=[];else for(var d=this.$events[b]||[],e=d.length;0>~--e;)if(d[e]===c)return d.splice(e,1);return this},$fire:function(b){var c;/^(\w+)!(\S+)$/.test(b)&&(c=RegExp.$1,b=RegExp.$2);var d=this.$events,e=ja.call(arguments,1),f=[b].concat(e);if("all"===c)for(var g in avalon.vmodels)e=avalon.vmodels[g],e!==this&&e.$fire.apply(e,f);else if("up"===c||"down"===c){if(d= d.expr&&p.querySelector(d.expr)){for(g in avalon.vmodels)if(e=avalon.vmodels[g],e!==this&&e.$events.expr){var h=p.querySelector(e.$events.expr);if(h&&("down"===c?d.contains(h):h.contains(d)))h._avalon=e}g=p.getElementsByTagName("*");var k=[];Array.prototype.forEach.call(g,function(b){b._avalon&&(k.push(b._avalon),b._avalon="",b.removeAttribute("_avalon"))});"up"===c&&k.reverse();for(g=0;(c=k[g++])&&!1!==c.$fire.apply(c,f););}}else{f=d[b]||[];c=d.$all||[];for(g=0;d=f[g++];)S(d)&&d.apply(this,e);for(g= -0;d=c[g++];)S(d)&&d.apply(this,arguments)}}},Bb=/^(duplex|on)$/,R=[],ra=0,Cb=200,Sa=Date.now(),Ta,Ea={};avalon.scanCallback=function(b,c){c=c||"$all";(Ea[c]||(Ea[c]=[])).push(b)};avalon.scan=function(b,c,d){b=b||D;var e=Ea[d||"$all"]||[];c=c?[].concat(c):[];var f=0,g=!1,h,k=!1;c.cb=function(b){f+=b;k=!0;setTimeout(function(){if(0>=f&&!g)for(g=!0;h=e.shift();)h()})};Ua(b,c);if(!k)for(;h=e.shift();)h()};var Gb=J("AREA,BASE,BASEFONT,BR,COL,COMMAND,EMBED,HR,IMG,INPUT,LINK,META,PARAM,SOURCE,TRACK,WBR,NOSCRIPT,NOSCRIPT,SCRIPT,STYLE,TEXTAREA"), +0;d=c[g++];)S(d)&&d.apply(this,arguments)}}},Bb=/^(duplex|on)$/,R=[],qa=0,Cb=200,Sa=Date.now(),Ta,Ea={};avalon.scanCallback=function(b,c){c=c||"$all";(Ea[c]||(Ea[c]=[])).push(b)};avalon.scan=function(b,c,d){b=b||D;var e=Ea[d||"$all"]||[];c=c?[].concat(c):[];var f=0,g=!1,h,k=!1;c.cb=function(b){f+=b;k=!0;setTimeout(function(){if(0>=f&&!g)for(g=!0;h=e.shift();)h()})};Ua(b,c);if(!k)for(;h=e.shift();)h()};var Gb=J("AREA,BASE,BASEFONT,BR,COL,COMMAND,EMBED,HR,IMG,INPUT,LINK,META,PARAM,SOURCE,TRACK,WBR,NOSCRIPT,NOSCRIPT,SCRIPT,STYLE,TEXTAREA"), Db=/ms-(\w+)-?(.*)/,ab={"if":10,repeat:90,data:100,widget:110,each:1400,"with":1500,duplex:2E3,on:3E3},Eb=J("animationend,blur,change,input,click,dblclick,focus,keydown,keypress,keyup,mousedown,mouseenter,mouseleave,mousemove,mouseout,mouseover,mouseup,scan,scroll,submit"),Fb=J("value,title,alt,checked,selected,disabled,readonly,enabled"),Ib=/\|\s*(\w+)\s*(\([^)]*\))?/g,Hb=/\|\|/g,Jb=/U2hvcnRDaXJjdWl0/g,dc=/\/\*[\w\W]*?\*\/|\/\/[^\n]*\n|\/\/[^\n]*$|"(?:[^"\\]|\\[\w\W])*"|'(?:[^'\\]|\\[\w\W])*'|[\s\t\n]*\.[\s\t\n]*[$\w\.]+/g, ec=/[^\w$]+/g,fc=RegExp(""+("\\b"+"break,case,catch,continue,debugger,default,delete,do,else,false,finally,for,function,if,in,instanceof,new,null,return,switch,this,throw,true,try,typeof,var,void,while,with,abstract,boolean,byte,char,class,const,double,enum,export,extends,final,float,goto,implements,import,int,interface,long,native,package,private,protected,public,short,static,super,synchronized,throws,transient,volatile,arguments,let,yield,undefined".replace(/,/g,"\\b|\\b")+"\\b"),"g"),gc=/\b\d[^,]*/g, -hc=/^,+|,+$/g,Fa=db(512),Mb=function(b){var c=","+b.trim();if(Fa[c])return Fa[c];b=b.replace(dc,"").replace(ec,",").replace(fc,"").replace(gc,"").replace(hc,"").split(/^$|,+/);return Fa(c,cb(b))},wa=db(128),Nb=/\w\[.*\]|\w\.\w/,Lb=/(\$proxy\$[a-z]+)\d+$/;avalon.parseExprProxy=I;G.insertAdjacentHTML("afterBegin",'');var sa=G.firstChild,ba=function(b,c,d){if(b=b.getAttribute(c)){c=0;for(var e;e=d[c++];)if(e.hasOwnProperty(b)&& -"function"===typeof e[b])return e[b]}},Ga=avalon.templateCache={},Ha={};"autofocus,autoplay,async,checked,controls,declare,disabled,defer,defaultChecked,defaultSelectedcontentEditable,isMap,loop,multiple,noHref,noResize,noShade,open,readOnly,selected".replace(w,function(b){Ha[b.toLowerCase()]=b});var xa=avalon.bindingExecutors={attr:function(b,c,d){var e=d.type,f=d.param;if("css"===e)avalon(c).css(f,b);else if("attr"===e){if(Ha[f]&&(e=Ha[f],"boolean"===typeof c[e]))return c[e]=!!b;if(!1===b||null=== -b||void 0===b)return c.removeAttribute(f);(mb.test(c)?0:f in c.cloneNode(!1))?c[f]=b:c.setAttribute(f,b)}else if("include"===e&&b){var g=d.vmodels,h=d.includeRendered,k=d.includeLoaded,l=d.includeReplaced?c.parentNode:c,m=function(b){k&&(b=k.apply(l,[b].concat(g)));for(h&&ka(l,function(){h.call(l)},NaN);;){var c=d.startInclude.nextSibling;if(c&&c!==d.endInclude)l.removeChild(c);else break}b=avalon.parseHTML(b);c=avalon.slice(b.childNodes);l.insertBefore(b,d.endInclude);ta(c,g);g.cb(-1)};if("src"=== +hc=/^,+|,+$/g,Fa=db(512),Mb=function(b){var c=","+b.trim();if(Fa[c])return Fa[c];b=b.replace(dc,"").replace(ec,",").replace(fc,"").replace(gc,"").replace(hc,"").split(/^$|,+/);return Fa(c,cb(b))},va=db(128),Nb=/\w\[.*\]|\w\.\w/,Lb=/(\$proxy\$[a-z]+)\d+$/;avalon.parseExprProxy=I;G.insertAdjacentHTML("afterBegin",'');var ra=G.firstChild,ba=function(b,c,d){if(b=b.getAttribute(c)){c=0;for(var e;e=d[c++];)if(e.hasOwnProperty(b)&& +"function"===typeof e[b])return e[b]}},Ga=avalon.templateCache={},Ha={};"autofocus,autoplay,async,checked,controls,declare,disabled,defer,defaultChecked,defaultSelectedcontentEditable,isMap,loop,multiple,noHref,noResize,noShade,open,readOnly,selected".replace(w,function(b){Ha[b.toLowerCase()]=b});var wa=avalon.bindingExecutors={attr:function(b,c,d){var e=d.type,f=d.param;if("css"===e)avalon(c).css(f,b);else if("attr"===e){if(Ha[f]&&(e=Ha[f],"boolean"===typeof c[e]))return c[e]=!!b;if(!1===b||null=== +b||void 0===b)return c.removeAttribute(f);(mb.test(c)?0:f in c.cloneNode(!1))?c[f]=b:c.setAttribute(f,b)}else if("include"===e&&b){var g=d.vmodels,h=d.includeRendered,k=d.includeLoaded,l=d.includeReplaced?c.parentNode:c,m=function(b){k&&(b=k.apply(l,[b].concat(g)));for(h&&ka(l,function(){h.call(l)},NaN);;){var c=d.startInclude.nextSibling;if(c&&c!==d.endInclude)l.removeChild(c);else break}b=avalon.parseHTML(b);c=avalon.slice(b.childNodes);l.insertBefore(b,d.endInclude);sa(c,g);g.cb(-1)};if("src"=== d.param)if(Ga[b])avalon.nextTick(function(){m(Ga[b])});else{var q=new x.XMLHttpRequest;q.onload=function(){var c=q.status;if(200<=c&&300>c||304===c)m(Ga[b]=q.responseText)};q.open("GET",b,!0);q.withCredentials=!0;q.setRequestHeader("X-Requested-With","XMLHttpRequest");q.send(null)}else{var n=b&&1==b.nodeType?b:p.getElementById(b);avalon.nextTick(function(){m(n.value||n.innerText||n.innerHTML)})}}else c[e]=b,x.chrome&&"EMBED"===c.tagName&&(f=c.parentNode,e=document.createComment("ms-src"),f.replaceChild(e, c),f.replaceChild(c,e))},"class":function(b,c,d){var e=avalon(c),f=d.type;if("class"===f&&d.oldStyle)e.toggleClass(d.oldStyle,!!b);else switch(d.toggleClass=d._evaluator?!!d._evaluator.apply(c,d._args):!0,d.newClass=d.immobileClass||b,d.oldClass&&d.newClass!==d.oldClass&&e.removeClass(d.oldClass),d.oldClass=d.newClass,f){case "class":e.toggleClass(d.newClass,d.toggleClass);break;case "hover":case "active":if(!d.hasBindEvent){b="mouseenter";var g="mouseleave";"active"===f&&(c.tabIndex=c.tabIndex|| --1,b="mousedown",g="mouseup",e.bind("mouseleave",function(){d.toggleClass&&e.removeClass(d.newClass)}));e.bind(b,function(){d.toggleClass&&e.addClass(d.newClass)});e.bind(g,function(){d.toggleClass&&e.removeClass(d.newClass)});d.hasBindEvent=!0}}},data:function(b,c,d){d="data-"+d.param;b&&"object"===typeof b?c[d]=b:c.setAttribute(d,String(b))},repeat:function(b,c,d){if(b){var e=this.element.parentNode,f=this.proxies,g=H.cloneNode(!1);if("del"===b||"move"===b)var h=za(this,c);var k=this.group;switch(b){case "add":for(var l= -d,m=this.$repeat.length-1,k=[],h=0,q=l.length;h\u4e0a\u8981\u6c42\u5bf9\u5e94\u4e00\u4e2a\u6570\u7ec4"):b.multiple&&u("ms-duplex\u5728