W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2010

DOM Range setStart and setEnd exceptions

From: Andrew Oakley <andrew@ado.is-a-geek.net>
Date: Thu, 13 May 2010 11:33:11 +0100
Message-ID: <4BEBD567.1010702@ado.is-a-geek.net>
To: "www-dom@w3.org" <www-dom@w3.org>
The setEndAfter, setEndBefore, setStartAfter and setStartBefore methods
on the Range interface (defined in the DOM2 Traversal and Range
specification) can raise INVALID_NODE_TYPE_ERR if the root container of
refNode is not an Attr, Document or DocumentFragment node.  The
specification states that "the content of a Range must be entirely
within the subtree rooted by a single Document, DocumentFragment or Attr
Node", so these exceptions make sense.

The setStart and setEnd methods don't seem to throw an exception if this
happens.  Opera does throw an exception here, but other browsers do not.
 Should an exception be thrown?

I think an exception should be thrown to preserve the invariants given
in the spec.

Andrew Oakley
Received on Thursday, 13 May 2010 10:26:52 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:16 UTC