Re: Query on DOM range methods

On Fri, Feb 7, 2014 at 7:37 AM, bhanukrushna rout
<bhanu_nitrkl12@yahoo.co.in> wrote:
> Yes, this is one of the 2 queries I wanted an answer i.e the expected
> behaviour when element node is a root container. But, I don't see this
> behaviour called out anywhere in any version of the specs.

If it's not explicitly forbidden, it should work. Ranges on
disconnected trees of elements seem fine. Why should they not work?


> The other query I had, are the constraints for range methods  specified in
> DOM2 still valid along with new behaviour specified in DOM4.
>
> For ex:
> setStartBefore in DOM2 :
>     Sets the start position to be before a node
>     Parameters
>         refNode of type Node
>         Range starts before refNode
>
>     Exceptions
>         RangeException
>             INVALID_NODE_TYPE_ERR: Raised if the root container of refNode
> is not an Attr, Document, or DocumentFragment node or if refNode is a
> Document, DocumentFragment, Attr, Entity, or Notation node.

Well, Attr, Entity, and Notation no longer exist.

We already established the root can be an element in the disconnected
element case as per my example. If refNode is a Document or
DocumentFragment that would indeed fail per the definition in
http://dom.spec.whatwg.org/#dom-range-setstartbefore as parent would
be null.


> I hope, DOM2 spec is not deprecated one, the behaviour is still valid.

No, it's obsolete.See http://dom.spec.whatwg.org/#goals


-- 
http://annevankesteren.nl/

Received on Friday, 7 February 2014 09:34:20 UTC