If what you are looking for is some selector magic to tell you if an element
has a certain text in it, you can use Slick's definePseudo:
http://jsfiddle.net/ariehg/ZUWnh/
note that this will only mask the awful performance issues concerning
iterating over elements like that, so try to make the selectors themselves
as efficient as possible (div.mydiv:contains-text instead of
*:contains-text)

On Mon, Mar 28, 2011 at 2:18 PM, Steve Onnis <[email protected]> wrote:

> It would be better if i could somehow use something like a textNode or
> something as i need to locate the text string and find out what its parent
> element is
>
> -----Original Message-----
> From: Fli7e [mailto:[email protected]]
> Sent: Monday, 28 March 2011 11:02 PM
> To: MooTools Users
> Subject: [Moo] Re: replaceing a text string
>
> maybe this is what you are looking for ...
>
>        document.body.getElements('div').each( function(elm){
>                elm.set(
>                        'html',
> elm.get('html').replace(/(searchterm)/g,"<span>$1</span>")
>                );
>        });
>
> On 28 Mrz., 13:34, "Steve Onnis" <[email protected]> wrote:
> > can anyone suggest an easy way to replace some text on a page, well
> actually
> > i want to wrap text strings on a page with a span tag
> >
> > so for example
> >
> > <div>this is some text</div>
> >
> > Would become
> >
> > <div>this is <span>some</span> text</div>
>
>


-- 
Arieh Glazer
אריה גלזר
052-5348-561
http://www.arieh.co.il
http://www.link-wd.co.il

Reply via email to