| View previous topic :: View next topic |
| Author |
Message |
froomzer Enthusiastic Coder
Joined: 23 May 2006 Posts: 148
|
Hello everyone! i need a little suggestion. I have a task to build so called "path" for the current cursor selection. is the only way - by making a loop over all tags using parentElement property?
So the task is to find the list of all OPENED tags until current cursor position
Is there any known tricks not to make a loop on all parent tags and manually analyze them?
Reply with quote
|
| |
|
|
autos06 Enthusiastic Coder
Joined: 13 May 2006 Posts: 123 Location: New York
| |
froomzer Enthusiastic Coder
Joined: 23 May 2006 Posts: 148
|
Exactly!
I am making wysiwyg editor and want to create different context menus for different tags
Reply with quote
|
| |
|
|
autos06 Enthusiastic Coder
Joined: 13 May 2006 Posts: 123 Location: New York
|
froomzer - render their code into a hidden div and use DOM methods (parentNode, etc)
Reply with quote
|
| |
|
|
froomzer Enthusiastic Coder
Joined: 23 May 2006 Posts: 148
|
autos06 so the only way is to make a loop through all parent tags using parentNode property and manually detect which tags are opened and closed, right?
Reply with quote
|
| |
|
|
autos06 Enthusiastic Coder
Joined: 13 May 2006 Posts: 123 Location: New York
| |
froomzer Enthusiastic Coder
Joined: 23 May 2006 Posts: 148
|
autos06 I need a list of all opened tags since body till current cursor position
Reply with quote
|
| |
|
|
autos06 Enthusiastic Coder
Joined: 13 May 2006 Posts: 123 Location: New York
| |
froomzer Enthusiastic Coder
Joined: 23 May 2006 Posts: 148
|
Like if there is something like <table><tr><td><strong>lallala</strong> here will be the cursor... - So I want the script which will return me table->tr->td
And ignore strong tag (which is closed)
I did that kind of parsing using php already.. so algorythm is already in my head.. i just wonder maybe there are some helpful tricks in javascript for this...
Reply with quote
|
| |
|
|
autos06 Enthusiastic Coder
Joined: 13 May 2006 Posts: 123 Location: New York
|
froomzer - yeah, you're kind of reinventing the wheel, so i think you're going to have to do a lot of string parsing
Reply with quote
|
| |
|
|
| Page 1 of 2 |
Goto page 1, 2 Next |
|