Skip to content
Browse files

fix #91

  • Loading branch information...
1 parent 74cb493 commit d1b646e14889cfcd84f1da57fb31cf2904d4f02e @yiminghe yiminghe committed Feb 7, 2012
Showing with 31 additions and 15 deletions.
  1. +10 −3 CHANGELOG.md
  2. +1 −1 README.md
  3. +4 −4 build/seed-min.js
  4. +5 −5 build/seed.js
  5. +10 −2 src/ajax/src/base.js
  6. +1 −0 src/ajax/tests/test.html
View
13 CHANGELOG.md
@@ -16,18 +16,26 @@ History:
### v1.2.0 -> v1.3.0
- [*] 调整源码目录结构
- - [!] 移除 core 模块,不要 use("core"),require("core"),只用你要用的
+ - [!] 移除 core 模块,不要 use("core")/require("core"),只用你要用的
- [!] 去除 KISSY.XX 命名空间绑定,使用前先 use,从参数中取得模块使用
+ - [+] 增加 S.Defer/Promise ,支持 Promise 规范
+
+ - [*] KISSY.ready 并行调用,互相不干扰
- [+] Event 模块:on/detach 支持事件分组
- [+] Event 模块:fireHandler api 增加
- [+] Event.on 支持 data 绑定
+ - [x] Event.delegate 重构,fix #76
+
+ - [+] io 调用返回 Promise 类型,可以进行链式操作
- [*] anim 支持 backgroundPosition
- [x] dom 支持 css("backgroundPosition") in ie
- [!] DOM.query 支持字符串/节点数组/单个节点,不要是KISSY或原生的NodeList
+ - [x] fix #88,去除多余的 tbody
+ - [x] NodeList.prototype.slice 支持单个负数参数:fix #85
- [+] DD.Constrain 方便进行拖放范围限制
- [+] DD groups 支持拖放分组
@@ -37,10 +45,9 @@ History:
- [+] popup 增加 toggle(左莫),mouseDelay(乔花) 配置
- [+] Menu.SubMenu menu 配置支持函数,用于延迟子菜单的生成
- - [*] submenuitem 支持 click 事件
+ - [*] SubMenu 支持 click 事件
- [+] datalazyload 增加 removeElements 与 destroy 接口
-
- [+] datalazyload 改进, 缓冲检测 scroll 和 resize, 并只加载显示在当前屏幕中的懒加载元素
### Happy 2nd Anniversary (2011/10/26)
View
2 README.md
@@ -43,5 +43,5 @@ Questions?
- Bug:<http://github.com/kissyteam/kissy/issues>
- 邮件:<kissyteam@gmail.com>
- Twitter: <http://twitter.com/#!/kissyteam>
- * Blog: <http://kissyui.com/blog/>
+ - Google Group: <http://groups.google.com/group/kissy-ui>
View
8 build/seed-min.js
@@ -1,10 +1,10 @@
/*
Copyright 2012, KISSY UI Library v1.30dev
MIT Licensed
-build time: Feb 6 19:34
+build time: Feb 7 11:53
*/
(function(b,r){var q=this,p={mix:function(d,f,c,i,j){if(!f||!d)return d;if(c===r)c=true;var n,t,u;if(i&&(u=i.length))for(n=0;n<u;n++){t=i[n];t in f&&k(t,d,f,c,j)}else for(t in f)k(t,d,f,c,j);return d}},k=function(d,f,c,i,j){if(i||!(d in f)){var n=f[d],t=c[d];if(n!==t)if(j&&t&&(b.isArray(t)||b.isPlainObject(t))){c=n&&(b.isArray(n)||b.isPlainObject(n))?n:b.isArray(t)?[]:{};f[d]=b.mix(c,t,i,r,true)}else if(t!==r)f[d]=c[d]}},h=q&&q[b]||{},e=0;q=h.__HOST||(h.__HOST=q||{});b=q[b]=p.mix(h,p);b.mix(b,{configs:b.configs||
-{},__APP_MEMBERS:["namespace"],__APP_INIT_METHODS:["__init"],version:"1.30dev",buildTime:"20120206193443",merge:function(){var d={},f,c=arguments.length;for(f=0;f<c;f++)b.mix(d,arguments[f]);return d},augment:function(d){var f=b.makeArray(arguments),c=f.length-2,i=1;d=f[0];ov=f[c];wl=f[c+1];if(!b.isArray(wl)){ov=wl;wl=r;c++}if(!b.isBoolean(ov)){ov=r;c++}for(;i<c;i++)b.mix(d.prototype,f[i].prototype||f[i],ov,wl);return d},extend:function(d,f,c,i){if(!f||!d)return d;var j=Object.create?function(u,x){return Object.create(u,
+{},__APP_MEMBERS:["namespace"],__APP_INIT_METHODS:["__init"],version:"1.30dev",buildTime:"20120207115305",merge:function(){var d={},f,c=arguments.length;for(f=0;f<c;f++)b.mix(d,arguments[f]);return d},augment:function(d){var f=b.makeArray(arguments),c=f.length-2,i=1;d=f[0];ov=f[c];wl=f[c+1];if(!b.isArray(wl)){ov=wl;wl=r;c++}if(!b.isBoolean(ov)){ov=r;c++}for(;i<c;i++)b.mix(d.prototype,f[i].prototype||f[i],ov,wl);return d},extend:function(d,f,c,i){if(!f||!d)return d;var j=Object.create?function(u,x){return Object.create(u,
{constructor:{value:x}})}:function(u,x){function A(){}A.prototype=u;var y=new A;y.constructor=x;return y},n=f.prototype,t;t=j(n,d);d.prototype=b.mix(t,d.prototype);d.superclass=j(n,f);c&&b.mix(t,c);i&&b.mix(d,i);return d},__init:function(){this.Config=this.Config||{};this.Env=this.Env||{};this.Config.debug=""},namespace:function(){var d=b.makeArray(arguments),f=d.length,c=null,i,j,n,t=d[f-1]===true&&f--;for(i=0;i<f;i++){n=(""+d[i]).split(".");c=t?q:this;for(j=q[n[0]]===c?1:0;j<n.length;++j)c=
c[n[j]]=c[n[j]]||{}}return c},app:function(d,f){var c=b.isString(d),i=c?q[d]||{}:d,j=0,n=b.__APP_INIT_METHODS.length;for(b.mix(i,this,true,b.__APP_MEMBERS);j<n;j++)b[b.__APP_INIT_METHODS[j]].call(i);b.mix(i,b.isFunction(f)?f():f);c&&(q[d]=i);return i},config:function(d){var f,c,i,j;for(j in d)if(d.hasOwnProperty(j))if((f=this.configs)&&(c=f[j]))i=c(d[j]);return i},log:function(d,f,c){if(b.Config.debug){if(c)d=c+": "+d;if(q.console!==r&&console.log)console[f&&console[f]?f:"log"](d)}},error:function(d){if(b.Config.debug)throw d;
},guid:function(d){return(d||"")+e++}});b.__init();return b})("KISSY",undefined);
@@ -23,8 +23,8 @@ s.prototype=new o;return s},now:Date.now||function(){return+new Date},fromUnicod
"&";l=l||"=";var m={};a=a.split(g);for(var o,s,v=0,B=a.length;v<B;++v){g=a[v].split(l);o=G(g[0]);try{s=G(g[1]||z)}catch(N){s=g[1]||z}if(b.endsWith(o,"[]"))o=o.substring(0,o.length-2);if(n.call(m,o))if(b.isArray(m[o]))m[o].push(s);else m[o]=[m[o],s];else m[o]=s}return m},later:function(a,g,l,m,o){g=g||0;var s=a,v=b.makeArray(o),B;if(b.isString(a))s=m[a];a=function(){s.apply(m,v)};B=l?setInterval(a,g):setTimeout(a,g);return{id:B,interval:l,cancel:function(){this.interval?clearInterval(B):clearTimeout(B)}}},
startsWith:function(a,g){return a.lastIndexOf(g,0)===0},endsWith:function(a,g){var l=a.length-g.length;return l>=0&&a.indexOf(g,l)==l},throttle:function(a,g,l){g=g||150;if(g===-1)return function(){a.apply(l||this,arguments)};var m=b.now();return function(){var o=b.now();if(o-m>g){m=o;a.apply(l||this,arguments)}}},buffer:function(a,g,l){function m(){m.stop();o=b.later(a,g,c,l||this,arguments)}g=g||150;if(g===-1)return function(){a.apply(l||this,arguments)};var o=null;m.stop=function(){if(o){o.cancel();
o=0}};return m}});b.mix(b,{isBoolean:k,isNumber:k,isString:k,isFunction:k,isArray:k,isDate:k,isRegExp:k,isObject:k});b.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,g){M["[object "+a+"]"]=g=a.toLowerCase();b["is"+a]=function(l){return b.type(l)==g}})})(KISSY,undefined);
-(function(b,r){function q(j){setTimeout(j,0)}function p(){if(!(this instanceof p))return new p;this.promise=new h}function k(j){return j&&j instanceof h}function h(j){this._value=j;if(!arguments.length)this._pendings=[]}function e(j){if(j instanceof e)return j;h.apply(this,arguments);return r}function d(j){if(j instanceof h)return j;return new h(j)}function f(j,n,t){function u(w){try{return n?n(w):w}catch(C){return new e(C)}}function x(w){try{return t?t(w):new e(w)}catch(C){return new e(C)}}var A=
-new p,y=0;q(function(){d(j)._when(function(w){if(!y){y=1;A.resolve(d(w)._when(u,x))}},function(w){if(!y){y=1;A.resolve(x(w))}})});return A.promise}function c(j){return!i(j)&&k(j)&&j._pendings===r&&(!k(j._value)||c(j._value))}function i(j){return k(j)&&j._pendings===r&&j._value instanceof e}p.prototype={constructor:p,resolve:function(j){var n=this.promise,t;if(!(t=n._pendings))return r;n._value=j;t=[].concat(t);n._pendings=r;for(var u=0;u<t.length;u++)(function(x){q(function(){n._when(x[0],x[1])})})(t[u]);
+(function(b,r){function q(j){setTimeout(j,0)}function p(j){if(!(this instanceof p))return new p(j);this.promise=j||new h}function k(j){return j&&j instanceof h}function h(j){this._value=j;if(!arguments.length)this._pendings=[]}function e(j){if(j instanceof e)return j;h.apply(this,arguments);return r}function d(j){if(j instanceof h)return j;return new h(j)}function f(j,n,t){function u(w){try{return n?n(w):w}catch(C){return new e(C)}}function x(w){try{return t?t(w):new e(w)}catch(C){return new e(C)}}
+var A=new p,y=0;q(function(){d(j)._when(function(w){if(!y){y=1;A.resolve(d(w)._when(u,x))}},function(w){if(!y){y=1;A.resolve(x(w))}})});return A.promise}function c(j){return!i(j)&&k(j)&&j._pendings===r&&(!k(j._value)||c(j._value))}function i(j){return k(j)&&j._pendings===r&&j._value instanceof e}p.prototype={constructor:p,resolve:function(j){var n=this.promise,t;if(!(t=n._pendings))return r;n._value=j;t=[].concat(t);n._pendings=r;for(var u=0;u<t.length;u++)(function(x){q(function(){n._when(x[0],x[1])})})(t[u]);
return j},reject:function(j){return this.resolve(new e(j))}};h.prototype={constructor:h,_when:function(j,n){var t=this._value,u=this._pendings;if(u)u.push([j,n]);else if(k(t))q(function(){t._when(j,n)});else return j&&j(t);return r},then:function(j,n){return f(this,j,n)},fail:function(j){return f(this,0,j)},fin:function(j){return f(this,function(n){return j(n,true)},function(n){return j(n,false)})},isPromise:function(){return k(this)},isResolved:function(){return c(this)},isRejected:function(){return i(this)}};
b.extend(e,h,{_when:function(j,n){return n?n(this._value):new e(this._value)}});b.Defer=p;b.Promise=h;b.mix(h,{isPromise:k,isResolved:c,isRejected:i,all:function(j){return f([].concat(j),function(n){var t=n.length;if(!t)return n;for(var u=p(),x=0;x<n.length;x++)(function(A,y){f(A,function(w){n[y]=w;--t===0&&u.resolve(n)},function(w){u.reject(w)})})(n[x],x);return u.promise})}})})(KISSY);(function(b){if(typeof require==="undefined"){b.__loader={};b.__loaderUtils={};b.__loaderData={}}})(KISSY);
(function(b,r){typeof require==="undefined"&&b.mix(r,{INIT:0,LOADING:1,LOADED:2,ERROR:3,ATTACHED:4})})(KISSY,KISSY.__loaderData);
View
10 build/seed.js
@@ -1,7 +1,7 @@
/*
Copyright 2012, KISSY UI Library v1.30dev
MIT Licensed
-build time: Feb 6 19:34
+build time: Feb 7 11:53
*/
/*
* @fileOverview a seed where KISSY grows up from , KISS Yeah !
@@ -110,7 +110,7 @@ build time: Feb 6 19:34
* The build time of the library
* @type {String}
*/
- buildTime:'20120206193443',
+ buildTime:'20120207115305',
/**
* Returns a new object containing all of the properties of
@@ -1431,10 +1431,10 @@ build time: Feb 6 19:34
* @description Defer constructor
* @memberOf KISSY
*/
- function Defer() {
+ function Defer(promise) {
var self = this;
if (!(self instanceof Defer)) {
- return new Defer();
+ return new Defer(promise);
}
// http://en.wikipedia.org/wiki/Object-capability_model
// principal of least authority
@@ -1444,7 +1444,7 @@ build time: Feb 6 19:34
* @memberOf KISSY.Defer#
* @name promise
*/
- self.promise = new Promise();
+ self.promise = promise || new Promise();
}
Defer.prototype =
View
12 src/ajax/src/base.js
@@ -95,8 +95,12 @@ KISSY.add("ajax/base", function (S, JSON, Event, XhrObject, undefined) {
defaultConfig.converters.html = defaultConfig.converters.text;
function setUpConfig(c) {
- // deep mix
+ // deep mix,exclude context!
+ var context = c.context;
+ delete c.context;
c = S.mix(S.clone(defaultConfig), c || {}, undefined, undefined, true);
+ c.context = context;
+
if (!S.isBoolean(c.crossDomain)) {
var parts = rurl.exec(c.url.toLowerCase());
c.crossDomain = !!( parts &&
@@ -223,7 +227,7 @@ KISSY.add("ajax/base", function (S, JSON, Event, XhrObject, undefined) {
fire(handleStr, xhrObject);
};
}
-
+
xhrObject.then(genHandler("success"), genHandler("error"));
xhrObject.fin(genHandler("complete"));
@@ -290,6 +294,10 @@ KISSY.add("ajax/base", function (S, JSON, Event, XhrObject, undefined) {
});
/**
+ * 2012-2-07 yiminghe@gmail.com:
+ *
+ * 返回 Promise 类型对象,可以链式操作啦!
+ *
* 借鉴 jquery,优化减少闭包使用
*
* TODO:
View
1 src/ajax/tests/test.html
@@ -32,6 +32,7 @@
<script src="ajax-spec.js"></script>
<script src="1.2-spec.js"></script>
<script src="xdr-spec.js"></script>
+<script src="promise/io-promise-spec.js"></script>
</head>
<body>
<h1>KISSY.Ajax Test Cases</h1>

0 comments on commit d1b646e

Please sign in to comment.
Something went wrong with that request. Please try again.