src code

instance method Element#replace

Element#replace([newContent]) → Element

Replaces element itself with newContent and returns element.

Keep in mind that this method returns the element that has just been removed — not the element that took its place.

This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.