W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2014

Re: Query on DOM range methods

From: bhanukrushna rout <bhanu_nitrkl12@yahoo.co.in>
Date: Fri, 7 Feb 2014 14:37:57 +0800 (SGT)
Message-ID: <1391755077.24302.YahooMailNeo@web192606.mail.sg3.yahoo.com>
To: Anne van Kesteren <annevk@annevk.nl>
Cc: Aryeh Gregor <ayg@aryeh.name>, "www-dom@w3.org" <www-dom@w3.org>

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.

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
        refNode of type Node
        Range starts before refNode

            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.

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

setStartBefore in DOM4 :
    Let parent be node's parent.
    If parent is null, throw an "InvalidNodeTypeError" exception.
    Set the start of the context object to boundary point (parent, node's index).

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


On Tuesday, 4 February 2014 6:44 PM, Anne van Kesteren <annevk@annevk.nl> wrote:
On Fri, Jan 31, 2014 at 9:45 AM, bhanukrushna rout
<bhanu_nitrkl12@yahoo.co.in> wrote:
> Now, I am confused if a particular spec revision is complete in itself or
> its a change in addition to the previous revisions.
> Please help me understand it and let me know if element node to be allowed
> as a root container.

Yes it could be.

var r = new Range()
var e = document.createElement("test")
var ec = e.appendChild(document.createElement("test"))
alert(r.startContainer == e)

If you mean something else you'll have to be more clear.

Received on Friday, 7 February 2014 06:38:28 UTC

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