- From: Randall Leeds <randall.leeds@gmail.com>
- Date: Wed, 27 Mar 2013 17:14:27 -0700
- To: Casey Jordan <casey.jordan@jorsek.com>
- Cc: Dennis Hamilton <dennis.hamilton@acm.org>, "public-change@w3.org" <public-change@w3.org>
On Mon, Mar 11, 2013 at 12:53 PM, Casey Jordan <casey.jordan@jorsek.com> wrote: > > Dennis you are correct in your assumptions about XPath, and while I think > Claudius is on the right track by using something like XPath, it would > probably make more sense to use a very constrained version of a "range" (IE > Two points in a document). > > Take for instance this document: > > <topic> > <title><b>Hello</b> everyone!</title> > > </topic> > > Given any tree structure we could represent a range in the with a pair of > locations (start, end) and offsets. The node would be indicated by a > position vector, and the offset by the caret placement in that node. > > Consider indicating that someone selected and deleted "Hello everyone!". The > range would be: > > (Start: [0.0.0.0, 0], End [0.0.1, 10]) > > > The x.x.x sequence indicates the nodes position in the document. IE: The > document element is at position 0. The title element is at position 0 with > respect to it's parent, and so on. > > So [0.0.0.0, 0] indicates that the start node is the "Hello" text node, and > the start position is at the beginning of the nodes character data (0). > > [0.0.1, 10] indicates that the end node is the " everyone!" text node, and > the end position is at the end of the nodes character data (10) > > This method is simple, throughout and could be easily standardized. It sounds to me like specifying a serialization for the startContainer and endContainer properties of a DOM Range object would be useful. I've recently done exactly this using XPath for the container and integer for the offset, but the container could have been a position vector as well. http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html
Received on Thursday, 28 March 2013 00:14:54 UTC