D'oh! I guess I'll have to find a way using plain javascript instead of jQ.
Thanks for your help.

On 2/20/07, Blair Mitchelmore <[EMAIL PROTECTED]> wrote:

Well that behaviour makes sense because to jQuery it would look like a
css selector for a plainText1 element, but that doesn't explain why
leading and trailing text gets stripped... *reads code* aha, the jQuery
object, when it does it's little search for html tags (line 32 of svn
rev 1323) in the jQuery initialization argument, only saves what it
finds (inclusively) between the first and last html tags in the string.
    var m = /^[^<]*(<(.|\s)+>)[^>]*$/.exec(a);
It passes m[1] (the first matched sequence) to jQuery.clean rather than
the whole string. So unless that gets changed at the core, you're out of
luck for those leading and trailing text elements.

-blair

Abel Tamayo wrote:
> 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]
> <mailto:[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]>
>     > <mailto:[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.
>     >     >
>     <http://jquery.com/discuss/>
>
>


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to