Permalink
Browse files

improve Ember.js compatibility

references #462
  • Loading branch information...
1 parent ade7931 commit 60c7919f2b2b6df134992fe5e2b418076b48bc31 @mislav mislav committed Apr 8, 2012
Showing with 8 additions and 3 deletions.
  1. +2 −3 src/data.js
  2. +6 −0 src/zepto.js
View
@@ -6,8 +6,7 @@
;(function($) {
var data = {}, dataAttr = $.fn.data, camelize = $.zepto.camelize,
- uuid = $.uuid = +new Date(),
- exp = $.expando = 'Zepto' + uuid
+ exp = $.expando = 'Zepto' + (+new Date())
// Get value from node:
// 1. first try key as given,
@@ -28,7 +27,7 @@
// Store value under camelized key on node
function setData(node, name, value) {
- var id = node[exp] || (node[exp] = ++uuid),
+ var id = node[exp] || (node[exp] = ++$.uuid),
store = data[id] || (data[id] = attributeData(node))
if (name !== undefined) store[camelize(name)] = value
return store
View
@@ -211,6 +211,11 @@ var Zepto = (function() {
return emptyArray.indexOf.call(array, elem, i)
}
+ $.trim = function(str) { return str.trim() }
+
+ // plugin compatibility
+ $.uuid = 0
+
$.map = function(elements, callback){
var value, values = [], i, key
if (likeArray(elements))
@@ -267,6 +272,7 @@ var Zepto = (function() {
get: function(idx){
return idx === undefined ? slice.call(this) : this[idx]
},
+ toArray: function(){ return this.get() },
size: function(){
return this.length
},

0 comments on commit 60c7919

Please sign in to comment.