Re: [jQuery] wrapinner with 1.1.1

2007-02-20 Thread Klaus Hartl
Sam Collett schrieb: > On 20/02/07, Oliver Boermans <[EMAIL PROTECTED]> wrote: >> Served? Served what? >> >> On 20/02/07, John Resig <[EMAIL PROTECTED]> wrote: >>> I just got served :-( > > Dave knows something about jQuery that John doesn't (or he forgot about) ;) > > It does show that there can

Re: [jQuery] wrapinner with 1.1.1

2007-02-20 Thread Sam Collett
On 20/02/07, Oliver Boermans <[EMAIL PROTECTED]> wrote: > Served? Served what? > > On 20/02/07, John Resig <[EMAIL PROTECTED]> wrote: > > I just got served :-( Dave knows something about jQuery that John doesn't (or he forgot about) ;) It does show that there can be several ways to do the same th

Re: [jQuery] wrapinner with 1.1.1

2007-02-20 Thread Oliver Boermans
Served? Served what? On 20/02/07, John Resig <[EMAIL PROTECTED]> wrote: > I just got served :-( ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/

Re: [jQuery] wrapinner with 1.1.1

2007-02-19 Thread Dave Methvin
Of John Resig Sent: Monday, February 19, 2007 10:50 AM To: jQuery Discussion. Subject: Re: [jQuery] wrapinner with 1.1.1 It seems like this would be a better solution: jQuery.fn.wrapInner = function(html){ return this.each(function(){ var wrap = $(html); while ( this.firstChild

Re: [jQuery] wrapinner with 1.1.1

2007-02-19 Thread John Resig
hildNodes).appendTo(this); > }); > }; > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On > Behalf Of John Resig > Sent: Monday, February 19, 2007 10:50 AM > To: jQuery Discussion. > Subject: Re: [jQuery] wrapinner with 1.1.1 > > It seems like

Re: [jQuery] wrapinner with 1.1.1

2007-02-19 Thread John Resig
I only did some basic testing, but this will do it: jQuery.fn.wrapInner = function(html){ return this.each(function(){ var wrap = $(html), lowest = wrap[0].firstChild; while ( lowest.firstChild ) lowest = lowest.firstChild; while ( this.firstChild ) lowest.appendChild(

Re: [jQuery] wrapinner with 1.1.1

2007-02-19 Thread Oliver Boermans
Tidy! Thanks John. While that is suits my particular purpose nicely, I'm curious, how would you to change it to insert the to-be-wrapped content into the _deepest_ point in the supplied HTML snippet. Like regular wrap. eg: Usage: $('p').wrapInner(''); To make this: Hello world! Into: Hello world

Re: [jQuery] wrapinner with 1.1.1

2007-02-19 Thread John Resig
It seems like this would be a better solution: jQuery.fn.wrapInner = function(html){ return this.each(function(){ var wrap = $(html); while ( this.firstChild ) wrap.append( this.firstChild ); wrap.appendTo( this ); }); }; no need for a filter, and you don't lose your eve

Re: [jQuery] wrapinner with 1.1.1

2007-02-19 Thread Christian Bach
Hi! Here is the new version. jQuery.fn.wrapInner = function(o) { return this.each(function(){ var jQ = jQuery(this); var c = jQ.html(); jQ.empty().append(o.el).filter(o.id).html(c); }); } $("p").wrapInner({el: 'http://jquery.com";>', id:

[jQuery] wrapinner with 1.1.1

2007-02-19 Thread Oliver Boermans
Hey all, I had some trouble today attempting to use the simple wrapinner plugin with jquery 1.1.1. http://motherrussia.polyester.se/jquery/wrapInner/ Some modification to the plugin code was required to make it do what I was looking for. // The additional argument is 's' (for selector) $.fn.wra