diff --git a/src/zepto.js b/src/zepto.js index 359b6644a..c2079f024 100644 --- a/src/zepto.js +++ b/src/zepto.js @@ -162,6 +162,14 @@ var Zepto = (function() { } }) }, + replaceWith: function(newContent) { + return this.each(function() { + var element = $(this), + prev = element.prev(); + element.remove(); + prev.after(newContent); + }); + }, hide: function(){ return this.css("display", "none") }, diff --git a/test/zepto.html b/test/zepto.html index 276ac1b4d..101f396b9 100644 --- a/test/zepto.html +++ b/test/zepto.html @@ -35,6 +35,11 @@

Zepto DOM unit tests

+
+
Hello
+
And
+
Goodbye
+
@@ -138,6 +143,8 @@

Zepto DOM unit tests

+ +
test