[jQuery] Re: DOM friendly link creation

2007-05-17 Thread Gordon
Thanks for the tips, but I'm working as part of a larger design team and am constrained with regards to making server-side changes, as for the inline link generation, that is what was requested and so it's what I must deliver (I will be building in a cookie check though so the option to turn it of

[jQuery] Re: DOM friendly link creation

2007-05-16 Thread RobG
On May 17, 1:49 am, Gordon <[EMAIL PROTECTED]> wrote: > After a day's coding, I have come up with this. It's closer to what I > need but the final link creation phase isn't there ye.t (also each > link will have attributes that point to a different URL, different > event handlers, etc, so don't

[jQuery] Re: DOM friendly link creation

2007-05-16 Thread Gordon
After a day's coding, I have come up with this. It's closer to what I need but the final link creation phase isn't there ye.t (also each link will have attributes that point to a different URL, different event handlers, etc, so don't think they're only going to have a jargonbuser class and nothin

[jQuery] Re: DOM friendly link creation

2007-05-16 Thread RobG
On May 13, 10:28 am, Gordon <[EMAIL PROTECTED]> wrote: > I had previously written a javascript that scans a div inside a HTML > document for keywords and then wraps those words in hyperlinks, as > part of adynamic help system. This worked by modifying the innerHTML > of the div in question. Th

[jQuery] Re: DOM friendly link creation

2007-05-16 Thread Scott Sauyet
Gordon wrote: Now elements such as divs can contain more child nodes, or plain text, or a combination of both. What I need to know is how to get at the text of a div with a mixture of text nodes and other HTML elements. Doing $(element).text returns all the text in the child elements as well, w

[jQuery] Re: DOM friendly link creation

2007-05-16 Thread Gordon
Okay, I'm doing a few experiments just now. I found that doing $('#targetDiv > *').each will get me all the immediate children of the target div, and that I can get the type of node with $('#targetDiv > *').each (function () {alert ('Element: ' + this.id + ' (' + this.className + ') Type: ' +

[jQuery] Re: DOM friendly link creation

2007-05-16 Thread Gordon
Sorry, guess I should have been clearer from the start. I really do want a proper fix, something that's truely cross browser and doesn't rely on regex and hacks. But the thing is I'm developing this stuff commercially and I have deadlines to meet. In which case a sticky plaster solution to get

[jQuery] Re: DOM friendly link creation

2007-05-15 Thread Wizzud
Actually I thought I grasped the problem fairly well. The bit I might have misunderstood was the relative importance of the "Failing that ..." part, as I thought you wanted to solve the problem rather than sidestep it. Ah well ... -- View this message in context: http://www.nabble.com/DOM-frie

[jQuery] Re: DOM friendly link creation

2007-05-15 Thread Gordon
On May 13, 10:21 am, Wizzud <[EMAIL PROTECTED]> wrote: > Sounds to me like you should be considering rewriting your wrapping code to > traverse the dom tree below the target div, rather than treating the whole > inner html as a single element. This would solve your problem of not > wrapping things

[jQuery] Re: DOM friendly link creation

2007-05-13 Thread Wizzud
Sounds to me like you should be considering rewriting your wrapping code to traverse the dom tree below the target div, rather than treating the whole inner html as a single element. This would solve your problem of not wrapping things like form elements, etc, and would mean that you were actuall

[jQuery] Re: DOM friendly link creation

2007-05-13 Thread Gordon
If it's any help then here is some pseudocode for the main loop of the link wrapper. targetDiv = '#div_id'; var regexPrefix = '('; var regexPostfix = ')(Regex to exclude text inside hyperlinks, form fields, etc. goes here)'; var RegexObj = new Regexp (); var workingHtml = $(targetDiv).html ();