Re: Query on DOM range methods
bhanukrushna rout <[email protected]>
| Newsgroups | gmane.comp.web.dom.general |
|---|---|
| Message-ID | <[email protected]> |
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 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. DOMException 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. Thanks, Bhanu On Tuesday, 4 February 2014 6:44 PM, Anne van Kesteren <[email protected]> wrote: On Fri, Jan 31, 2014 at 9:45 AM, bhanukrushna rout <[email protected]> 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")) r.setStartBefore(ec) alert(r.startContainer == e) If you mean something else you'll have to be more clear. -- http://annevankesteren.nl/