Permalink
Browse files

Implement wrap/wrapAll

  • Loading branch information...
1 parent 332f558 commit e641fd5d928a514bef5f74f566b96c3be31b5357 @aglemann aglemann committed May 16, 2011
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/zepto.js
View
13 src/zepto.js
@@ -179,6 +179,19 @@ var Zepto = (function() {
prev.after(newContent);
});
},
+ wrap: function(newContent) {
+ return this.each(function() {
+ $(this).wrapAll(newContent);
+ });
+ },
+ wrapAll: function(newContent) {
+ if (this[0]) {
+ var wrap = $(newContent)[0].cloneNode();
+ $(this[0]).before(wrap);
+ $(wrap).append(this);
+ }
+ return this;
+ },
hide: function(){
return this.css("display", "none")
},

0 comments on commit e641fd5

Please sign in to comment.