25.247. Range.surroundContents( ): surround range contents with the specified nodeDOM Level 2 Range25.247.1. Synopsisvoid surroundContents(Node newParent) tHRows RangeException, DOMException; 25.247.1.1. Arguments
25.247.1.2. ThrowsThis method throws a DOMException or RangeException with one of the following code values in the following circumstances:
25.247.2. DescriptionThis method reparents the contents of this range to newParent and then inserts newParent into the document at the start position of the range. It is useful to place a region of document content within a <div> or <span> element, for example. If newParent is already part of the document, it is first removed from the document, and any children it has are discarded. When this method returns, this range begins immediately before newParent and ends immediately after it. |