How to find all the Nodes from the Selection
Today when working on a JavaScript function to get all the DOM nodes which are under selection, I was going through the compatibility tables at quirksmode.org and scratching my head and wondering why the W3C guys have made this basic job all that difficult. I must admit that playing with range is complex (specially how it can span over the multiple nodes and partially covered), but it’s definitely not as complex as mad by some of the available methods. Plus that there are many comparability differences between browsers
Tired of looking at the compatibility tables, I thought to give it another search try at Google and Voilla! I found the exact code I was looking for at code.google.com:
http://groups.google.com/group/comp.lang.javascript/msg/db76484c36bde1be
The purpose of this post is that give a big thanks and credit to Elgi for sharing this code, and for keeping this useful info handy.
Tags: DOM, JavaScript, Selection
This entry was posted
on Thursday, February 18th, 2010 at 11:16 am and is filed under JavaScript.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Feedback & Comments
No Responses