I'm doing this to alter the DOM of third party webapps in a webviewer for my users:
Storing the DOM to a field with GetLayoutAttributeObject(), manipulating that string with Text Functions (such as adding values to input field tags, hiding elements... the type of stuff you might use JS DOM functions or jQuery for), and putting that into a new viewer.
It works but it's the type of cumbersome that a plugin (such as the way BE_JSONPath operates on strings containing a JSON object) could easily make so easy. It also seems like the type of thing there would totally be a plugin for. Does anyone know of one? Or a different strategy that is less cumbersome.