Closed

Javascript Function using DOM Range

I need a Javascript function to be written. Given a div with some html content and a double-click event from a user, the function needs to return the following:

* the word that was double-clicked upon

* the start offset of the word from the beginning of the div (meaning the number of characters of text between the beginning of the div and the beginning of the word).

* the top, left, and height of the selected word, in pixels.

Note that these requirements are trickier than they might sound at first. For example, if the div contains the html "create a <i>super</i>conductor for the experiment" and the user double-clicks on the word "superconductor", then the word will span across multiple nodes. The function must work equally well on Mozilla and IE6/7. Note that in Mozilla, there is no easy way to obtain the offsetTop and offsetLeft of a Range. If you resort to inserting an element to determine these, your code must also remove the element, leaving all document nodes to form the same exact graph they initially had.

You must fulfill the requirements exactly. If there is some edge case that your code does not cover, then it is not really a solution. I would suggest that you not accept the task unless you are *really* familiar with the DOM implementations in FF and IE. The code must also be well-designed, meaning (for example) it can't be sloppy and method bodies must be under 100 lines.

Skills: Javascript

See more: top graph, number function, graph using, graph top, graph nodes, graph edge, function number, first graph, edge graph, rangeoffsetleft javascript, function range javascript, javascript divcontains function, remove node domrange, dom range, javascript range function, dom range find, dom word clicked upon, range startoffset ie6, using dom range, content meaning, span, resort, mozilla, implementations, function

About the Employer:
( 1 review ) Chicago, United States

Project ID: #199105

4 freelancers are bidding on average $205 for this job

BDIIT

PLS see the PMB...

$170 USD in 10 days
(2 Reviews)
0.0
webxpert3

plz chekc pmb

$300 USD in 4 days
(0 Reviews)
0.0
dev816

Dear poster, I can help you. Please see my private message. Thanks.

$150 USD in 3 days
(0 Reviews)
0.0
shecourage

Dear sir,we are interested in your project and we have just gone through your requirements carefully, we certainly can help to fullfill your goals.We are a high-tech conpany with abundant experience and excellent progr More

$200 USD in 8 days
(0 Reviews)
0.0