dom-monster
dom-monster copied to clipboard
refactor to split model / view
I recently enabled an "extension" mode for the weinre debugger - http://pmuellr.github.com/weinre/ - and have built an extension which runs DOM Monster. What happens is that I run DOM Monster in one window (say on a mobile device) and then display the results in another window (weinre web app running on a desktop / laptop).
I did the minimal amount of work to do this split, and a couple other little things, in the project https://github.com/pmuellr/weinre-ext-dom-monster . The file dom-monster-agent.js
is the hacked version of dommonster.js
.
Clearly, something better should be done. :-) Technically, from the desktop I can ship a wad of JS code down the mobile device, and get the result back. The result can be an object, it's JSON-ified before sending, and then un-JSON-ified when it arrives at the desktop. I'm essentially wrapping a function around the existing dommonster.js
, executing it, having it return the HTML it would otherwise write back into the page. I then get that HTML on the desktop, and insert it into the debugger's page.
The code for the plugin bits isn't out yet, so you can't run this extension yourself - right now - should be up next week.
You can see what it (will) look like here: http://www.flickr.com/photos/pmuellr/5692972464/ - I just love the adorable mini DOM Monster in the panel icon bar at the top!
Thanks for the work on DOM Monster, and for making it open source!