W3C home > Mailing lists > Public > public-webapi@w3.org > May 2006

Creating DOM Ranges when node is not in document

From: Olli Pettay <Olli.Pettay@helsinki.fi>
Date: Tue, 16 May 2006 16:57:00 +0300
Message-ID: <4469DA2C.1060800@helsinki.fi>
To: "Web APIs WG (public)" <public-webapi@w3.org>, www-dom@w3.org


I wonder if there will be any DOM 2 Ranges errata, which would
clarify some problems in that specification.

For example what should happen in this case
javascript:var r = document.createRange(); 
r.setStart(document.createElement("foo"), 0);

Some implementations allow creating a range even if the
boundary node isn't in the document, some implementations
thrown an exception.

"The boundary-points of a Range _must_ have a common ancestor container 
which is either a Document, DocumentFragment or Attr node. That is, the 
content of a Range must be entirely within the subtree rooted by a 
single Document, DocumentFragment or Attr Node."

But Range.setStart Exceptions
INVALID_NODE_TYPE_ERR: Raised if refNode or an ancestor of refNode is an
                        Entity, Notation, or DocumentType node.

INDEX_SIZE_ERR:        Raised if offset is negative or greater than the 

                        number of child units in refNode. Child units are
                        16-bit units if refNode is a type of
                        CharacterData node (e.g., a Text
                        or Comment node) or a ProcessingInstruction node.
                        Child units are Nodes in all other cases.

INVALID_STATE_ERR:     Raised if detach() has already been invoked on
                        this object.


Received on Tuesday, 16 May 2006 13:57:29 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:21 UTC