You can't do $('*').filter('[nodeType=3]') because text nodes aren't
included when finding.
This is only valid when using .contents() but that only gathers the
childNodes, so you still need to recurse.

In conclusion, jQuery doesn't save you much work, you'll probably have
as many lines of code as a non-jQuery approach, and using jQuery will
surely hit on perfomance.

--
Ariel Flesler
http://flesler.blogspot.com

On 8 mayo, 03:39, darren <[EMAIL PROTECTED]> wrote:
> hey joe, it looks like testing node types may help with your problem.
> Google node types and you'll find that DOM text nodes are type 3,
> element nodes are type 1 etc etc. You could do something using the
> selector expression [nodeType=3] to determine if the current node you
> have selected is a text node.
>
> On May 7, 4:22 pm, Ariel Flesler <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hey, made a 10 min class to do this. It doesn't use jQuery at all, so
> > it will work as fast as possible.
> > You only need to specify the translating function.
>
> > Made a blog post to detail its use.
>
> >http://flesler.blogspot.com/2008/05/textnode-translator-for-javascrip...
>
> > I never used Google translator, but it probably requires AJAX, so pay
> > attention to the 'sync' part.
>
> > Cheers
>
> > --
> > Ariel Fleslerhttp://flesler.blogspot.com
>
> > On 7 mayo, 16:22, Joe <[EMAIL PROTECTED]> wrote:
>
> > > Balazs,
>
> > > Thanks, but I tried your plugin and it did not work.  There is no demo
> > > for say clicking a button and converting the page; the bookmarklet is
> > > cool, but doesn't really help when I can't get the plugin to work.  I
> > > emailed you so hopefully I'll hear back...
>
> > > I did actually re-create your plugin, but didn't author it or add any
> > > bells and whistles, just translating an entire page and/or element...
>
> > > Cheers.
>
> > > Joe
>
> > >www.subprint.com
>
> > > On May 7, 1:39 pm, Balazs Endresz <[EMAIL PROTECTED]> wrote:
>
> > > > Hi! I replied in the previous thread but it hasn't appeared in Google
> > > > groups, just 
> > > > here:http://www.nabble.com/Selector-Madness!--How-to-Select-all-the-Text-o...
> > > > So there is a translate plugin that works this way:
>
> > > >http://code.google.com/p/jquery-translate/
>
> > > > On May 5, 9:32 pm, Joe <[EMAIL PROTECTED]> wrote:
>
> > > > > Last week I had a question on how to traverse the DOM and find all 
> > > > > elements that had some text (p, a, li, h1, etc.) so I could manipulate
> > > > > it with Google's translation API.  Well with some help from the
> > > > > community I was able to accomplish this feat.
>
> > > > >http://groups.google.com/group/jquery-en/browse_thread/thread/c63da32...
>
> > > > > However, I have a bigger problem.  Now, when I grab 
> > > > > theallproperelements:
>
> > > > > $a = $(' #container > * ').contents();
>
> > > > > And parse thru them tofindwhich ones have text, it does just that
> > > > > BUT if an unordered list is within a div and that UL has text it will
> > > > > show up not only with the UL, but within the DIV as well.
>
> > > > > $a.each(function()
> > > > > { ... translate stuff here ..});
>
> > > > > So in iteration one, wefindthe DIV, and then locate any andALLtext
> > > > > in the DIV.  Quite a bit for the header navigation.
>
> > > > > Example Result for Div:
> > > > > HOME BUSINESS CONTACT ABOUT
>
> > > > > Then the next iteration is the UL, and it finds its text, which is
> > > > > basically the same as the DIV's text result.
>
> > > > > Example Result for UL:
> > > > > HOME BUSINESS CONTACT ABOUT
>
> > > > > Then the next iteration is the LI element, which has the proper text
> > > > > but,
>
> > > > > The next iteration is the A element which is finally the text I
> > > > > actually want to translate.
>
> > > > > Example Result for LI and A:
> > > > > HOME
>
> > > > > So myquestionis how can Itraversedown and grab thelastchild on
> > > > > that particular "branch" of theDOM.  Surely there's a way to check if
> > > > > current node has or does not have a child, but how with jQuery?
>
> > > > > Thanks!
>
> > > > > BTW, Ariel Fleisler's recommendation from the previous post appears to
> > > > > be the best approach, but my pure Javascript mixing with jQuery skills
> > > > > are not quite up to snuff to hash that out...- Ocultar texto de la 
> > > > > cita -
>
> > > - Mostrar texto de la cita -- Ocultar texto de la cita -
>
> - Mostrar texto de la cita -

Reply via email to