[Pkg-javascript-commits] [backbone] 08/12: Update to Zepto 0.2
Jonas Smedegaard
js at moszumanska.debian.org
Sat May 3 16:59:40 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.3.3
in repository backbone.
commit de44d9ec349904e867104b5e39e939e0ef4740bc
Author: Sam Stephenson <sam at 37signals.com>
Date: Wed Dec 1 11:02:08 2010 -0600
Update to Zepto 0.2
---
test/test-zepto.html | 2 +-
test/vendor/{zepto.js => zepto-0.2.js} | 28 ++++++++++++++--------------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/test/test-zepto.html b/test/test-zepto.html
index c9f5487..44ce2a2 100644
--- a/test/test-zepto.html
+++ b/test/test-zepto.html
@@ -4,7 +4,7 @@
<title>Backbone Test Suite</title>
<link rel="stylesheet" href="vendor/qunit.css" type="text/css" media="screen" />
<script type="text/javascript" src="vendor/json2.js"></script>
- <script type="text/javascript" src="vendor/zepto.js"></script>
+ <script type="text/javascript" src="vendor/zepto-0.2.js"></script>
<script type="text/javascript" src="vendor/qunit.js"></script>
<script type="text/javascript" src="vendor/jslitmus.js"></script>
<script type="text/javascript" src="vendor/underscore-1.1.0.js"></script>
diff --git a/test/vendor/zepto.js b/test/vendor/zepto-0.2.js
similarity index 97%
rename from test/vendor/zepto.js
rename to test/vendor/zepto-0.2.js
index 59de84a..306342b 100644
--- a/test/vendor/zepto.js
+++ b/test/vendor/zepto-0.2.js
@@ -22,7 +22,7 @@ var Zepto = (function() {
camelize = function(str){ return str.replace(/-+(.)?/g, function(match, chr){ return chr ? chr.toUpperCase() : '' }) }
$.fn = {
- ready: function(callback){
+ ready: function(callback){
d.addEventListener('DOMContentLoaded', callback, false); return this;
},
compact: function(){ this.dom=compact(this.dom); return this },
@@ -34,7 +34,7 @@ var Zepto = (function() {
filter: function(selector){
return $(this.dom.filter(function(el){ return $$(el.parentNode, selector).indexOf(el)>=0; }));
},
- is: function(selector){
+ is: function(selector){
return this.dom.length>0 && $(this.dom[0]).filter(selector).dom.length>0;
},
first: function(callback){ this.dom=compact([this.dom[0]]); return this },
@@ -52,8 +52,8 @@ var Zepto = (function() {
prev: function(){ return $(this.pluck('previousElementSibling')) },
next: function(){ return $(this.pluck('nextElementSibling')) },
html: function(html){
- return html === un ?
- (this.dom.length>0 ? this.dom[0].innerHTML : null) :
+ return html === un ?
+ (this.dom.length>0 ? this.dom[0].innerHTML : null) :
this.each(function(el){ el.innerHTML = html });
},
text: function(text){
@@ -62,7 +62,7 @@ var Zepto = (function() {
this.each(function(el){ el.innerText = text });
},
attr: function(name,value){
- return (typeof name == 'string' && value === un) ?
+ return (typeof name == 'string' && value === un) ?
(this.dom.length>0 ? this.dom[0].getAttribute(name) || undefined : null) :
this.each(function(el){
if (typeof name == 'object') for(k in name) el.setAttribute(k, name[k])
@@ -92,7 +92,7 @@ var Zepto = (function() {
return this.each(function(el){ el.className = el.className.replace(classRE(name), ' ').trim() });
}
};
-
+
['width','height'].forEach(function(m){ $.fn[m] = function(){ return this.offset()[m] }});
for(k in ADJ_OPS)
@@ -184,11 +184,11 @@ var Zepto = (function() {
})(Zepto);
(function($){
var touch={}, touchTimeout;
-
+
function parentIfText(node){
return 'tagName' in node ? node : node.parentNode;
}
-
+
$(document).ready(function(){
$(document.body).bind('touchstart', function(e){
var now = Date.now(), delta = now-(touch.last || now);
@@ -197,8 +197,8 @@ var Zepto = (function() {
touch.x1 = e.touches[0].pageX;
if (delta > 0 && delta <= 250) touch.isDoubleTap = true;
touch.last = now;
- }).bind('touchmove', function(e){
- touch.x2 = e.touches[0].pageX
+ }).bind('touchmove', function(e){
+ touch.x2 = e.touches[0].pageX
}).bind('touchend', function(e){
if (touch.isDoubleTap) {
$(touch.target).trigger('doubleTap');
@@ -215,7 +215,7 @@ var Zepto = (function() {
}
}).bind('touchcancel', function(){ touch={} });
});
-
+
['swipe', 'doubleTap', 'tap'].forEach(function(m){
$.fn[m] = function(callback){ return this.bind(m, callback) }
});
@@ -245,7 +245,7 @@ var Zepto = (function() {
$.getJSON = function(url, success){
$.get(url, function(json){ success(JSON.parse(json)) });
};
-
+
$.fn.load = function(url, success){
var self = this, parts = url.split(/\s/), selector;
if(!this.dom.length) return this;
@@ -261,7 +261,7 @@ var Zepto = (function() {
})(Zepto);
(function($){
var cache = [], timeout;
-
+
$.fn.remove = function(){
return this.each(function(el){
if(el.tagName=='IMG'){
@@ -272,5 +272,5 @@ var Zepto = (function() {
}
el.parentNode.removeChild(el);
});
- }
+ }
})(Zepto);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git
More information about the Pkg-javascript-commits
mailing list