copy from http://code.taobao.org/p/taobaocode/src/