Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove `fn.compact()` method

It's useless. There is no way a Zepto collection can contain
`null` or `undefined` in the first place.
  • Loading branch information...
commit dbe33a25fba48db8a87605eb3c7da6956adfcb44 1 parent 54a05bb
@mislav mislav authored
Showing with 2 additions and 14 deletions.
  1. +0 −3  README.rdoc
  2. +2 −3 src/zepto.js
  3. +0 −8 test/zepto.html
View
3  README.rdoc
@@ -89,9 +89,6 @@ Context and .find calls are equivalent:
return property for each element
e.g. pluck('innerHTML') returns an array of all innerHTML properties of all elements found
- compact():
- remove all null or undefined elements from list of elements found
-
anim(transform, opacity, duration):
use -webkit-transform/opacity and do an animation
View
5 src/zepto.js
@@ -31,12 +31,12 @@ var Zepto = (function() {
else {
var dom;
if (selector instanceof Z) dom = selector.dom;
- else if (selector instanceof Array) dom = selector;
+ else if (selector instanceof Array) dom = compact(selector);
else if (selector instanceof Element || selector === window) dom = [selector];
else if (fragmentRE.test(selector)) dom = fragment(selector);
else dom = $$(document, selector);
- return new Z(compact(dom), selector);
+ return new Z(dom, selector);
}
}
@@ -47,7 +47,6 @@ var Zepto = (function() {
ready: function(callback){
document.addEventListener('DOMContentLoaded', callback, false); return this;
},
- compact: function(){ this.dom = compact(this.dom); return this },
get: function(idx){ return idx === undefined ? this.dom : this.dom[idx] },
size: function(){ return this.length },
remove: function(){
View
8 test/zepto.html
@@ -260,14 +260,6 @@
t.assertLength(0, $('nonexistent').last());
},
- testCompact: function(t){
- var nodes = $('p');
- nodes.dom = [nodes.get(0), null, undefined, nodes.get(0)];
- nodes.compact();
- t.assertLength(2, nodes);
- t.assertEqual('PP', nodes.pluck('tagName').join(''));
- },
-
testPluck: function(t){
t.assertEqual('H1DIVDIV', $('h1,div.htmltest').pluck('tagName').join(''));
},
Please sign in to comment.
Something went wrong with that request. Please try again.