redho home | products | services

Programming Forums


Community for Java, PHP, Perl C, ASP and Python programmers

Ask your IT question here

manually analizing all parent tags without loop


Goto page 1, 2  Next
 
Post new topic   Reply to topic    Programming Forums -> JavaScript forum
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
Are you talking about the DOM or some sourcecode parser?
Reply with quote
 
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 - what do you mean open and closed?
Reply with quote
 
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
are you trying to parse their source code? that's hard work
Reply with quote
 
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
Post new topic   Reply to topic    Programming Forums -> JavaScript forum


Dubai Forums - Expat Help | Vegan Chat | Java Programming | Free 3D tutorials and 3d textures | Paris Forum | EU Forum
Free Dubai Classifieds | Free London Classifieds | Jobs in London

High Quality, Custom 3d animation and Web Design solutions Royal Quality Web Hosting Services Vegetarian and Animal Rights news

Powered by phpBB © 2001, 2005 phpBB Group