Actually when you evaluate a string in the jQuery object, you get an empty object in return: $("plainText1") becomes the empty object [].
On 2/20/07, Blair Mitchelmore <[EMAIL PROTECTED]> wrote:
Well seeing as it only affects the first and the last 'elements' you could try testing the first and last elements of the jQuery object manually. Then you might see why the first element isn't being recognized as an orphan node when it is and be able to compensate for that in the filtering function. -blair Abel Tamayo wrote: > Thanks, Blair. Your solution works 'perfectly'. Only problem is it > doesn't select orphan nodes at the beginning and end of the string, > i.e: in $("plain1 <p>formated1</p>plain2<p>formatted2</p>plain3") only > ["plain2"] is selected. > > Any idea how I can work around this? > > Abel. > > On 2/20/07, *Blair Mitchelmore* < [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > I'm not sure if this would work at all and I'm not sure of the syntax > for the function usage of filter but I think it'd work like this > (theoretically): > > $(whatevah).filter(function() { > return this.nodeType && this.nodeType == 3; // nodeType of 3 is a > Text node. > }); > > I have no idea if this works but it's the only thing I could think of. > Hope it helps. > > -blair > > Abel Tamayo wrote: > > Hi all, > > > > this time I need to know the way to select text that is not > inside a > > tag. That is, in $("orphan1 <span> in span </span> orphan2 <p> in p > > </p> orphan3") i would need to get a jQuery object like this : > > ["orphan1", "orphan2", "orphan3"]. > > > > I've been trying with functions like .filter(String) or > > .not("HTMLElement"), but none of them seem to work. > > > > Any ideas? Thanks in advance. > > > > Abel. > > > _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
_______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/