Creating DOM Ranges when node is not in document

Hi,

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.

http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/ranges.html#Level-2-Range-Position
"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.


br,

-Olli

Received on Tuesday, 16 May 2006 14:00:40 UTC