Remove All id Attributes from nodes in a Range of Fragment
问题 Is there a way to remove the id attribute of every node in a range or fragment? Update: I finally found out that the bug I'm struggling with is based on a <[script]> being included in a range, and therefore unexpectedly cloned, when a chrome user does a ctrl+a. My goal would be to remove any instance of <[script]> from the range (or doc fragment), such that it is not replicated when cloned. 回答1: You may be able to use a TreeWalker, which works in pretty much all the browers that Range works