aboutsummaryrefslogtreecommitdiffstats
path: root/src/wrap.js
diff options
context:
space:
mode:
authorOleg Gaidarenko <markelog@gmail.com>2014-12-08 10:32:57 +0300
committerOleg Gaidarenko <markelog@gmail.com>2014-12-24 01:51:33 +0300
commit359b03cac74d7336676a6992f14b7ccab9b28659 (patch)
tree6aa6dc1ff10435e80c07a635625f34b2e60774ee /src/wrap.js
parent6f65f5faf2b5831414d4c93d271a59265b41a75b (diff)
downloadjquery-359b03cac74d7336676a6992f14b7ccab9b28659.tar.gz
jquery-359b03cac74d7336676a6992f14b7ccab9b28659.zip
Manipulation: make wrapAll funarg execute only once
Fixes gh-1843 Closes gh-1912
Diffstat (limited to 'src/wrap.js')
-rw-r--r--src/wrap.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/wrap.js b/src/wrap.js
index 4958251d2..ee02aca75 100644
--- a/src/wrap.js
+++ b/src/wrap.js
@@ -9,13 +9,10 @@ jQuery.fn.extend({
wrapAll: function( html ) {
var wrap;
- if ( jQuery.isFunction( html ) ) {
- return this.each(function( i ) {
- jQuery( this ).wrapAll( html.call(this, i) );
- });
- }
-
if ( this[ 0 ] ) {
+ if ( jQuery.isFunction( html ) ) {
+ html = html.call( this[ 0 ] );
+ }
// The elements to wrap the target around
wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );