W3C home > Mailing lists > Public > public-webapi@w3.org > April 2008

Some DOM Element interfaces for DOM Ranges

From: David Bloom <futurama@gmail.com>
Date: Fri, 11 Apr 2008 09:27:09 -0500
Message-ID: <d60db9c40804110727r66f4bcb6g7eb89b85a93395fa@mail.gmail.com>
To: public-webapi@w3.org

DOM Ranges are really tough to work with. It takes a lot more code
than it should to do simple things, such as getting all of the
elements contained in the range. This is particularly problematic for
makers of designMode/contentEditable rich text editors, which usually
have "Bold"/"Italic"/"Underline" buttons that have to reflect the
state of the current selection. They have to do a lot of convoluted
DOM stuff to find the elements in the range to figure out if they're
bold or not (queryCommandState tends to lie :-P).

I think it would be useful to have some interfaces from DOM Elements
available on DOM Ranges for accessing the contents of the range. For
example, childNodes, getElementsByTagName, and
querySelector/querySelectorAll would work as if they were run against
the common ancestor container of the range, with all results not in
the range removed. This would let developers use interfaces they are
probably quite familiar with when using ranges.

-- 
David Bloom
Received on Friday, 11 April 2008 14:41:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 11 April 2008 14:41:30 GMT