Operator and DOM Mutation Events
This is working so well, I have to tell the world.
I just added support for DOM Mutation events to Operator. So now when DOM nodes are added and removed from the document, Operator will update appropriately.
But that’s not the coolest part…
I added support for the DOMAttrModified event. So combined with Firebug, you can actually interactively modify your HTML to add/remove/modify a microformat and Operator will update live based on the changes you make. It’s REALLY sweet.
New version coming soon….
Comments
Comment from Axel Hecht
Date: March 23, 2007, 4:07 am
Mutation events are said to make pages really slow, do you see that? In either page load or dhtml perf?
Comment from mkaply
Date: March 23, 2007, 5:53 am
Axel:
There does seem to be a slight slowdown with with DOMAttrModified. I might make that a preference so people can decide for themselves. It’s difficult to tell though because the page I was messing with was getting slow and fast. Also, I can’t see the DOMAttrModified case being as common, but it is extremely useful for debugging.
Basically what I’m doing on DOMAttrModified is kicking off a half second time and then returning, and then if I get another event in that timeframe, I reset the timer.
Comment from Axel Hecht
Date: March 23, 2007, 6:28 am
Actually, the events themselves only get generated when there are any listeners, so it’s not only the handler code, but internal code that usually shouldn’t run. See http://mxr.mozilla.org/mozilla1.8/source/content/base/src/nsGenericElement.cpp.
If you already have an extension with mutation event listeners (not sure if firebug does), you’d hardly see.
I’m particularly cautious here in the light of fx3′ microformats support efforts. In which case, I’d expect you’d have to run Tp against a clean fx.
Not that I have any alternative suggestion to using mutation events to have microformats work for ajax pages or something, you’d need content gods to advise there.
Comment from mkaply
Date: March 23, 2007, 7:30 am
With Firefox 3, there will obviously have to be some better solution to this problem.
There needs to be a better DOM message like “Ok it looks like things have settled down, update your content”
The only other option is to check the page for changes on a timer…
Comment from Daniel E. Renfer
Date: March 23, 2007, 7:32 pm
This is really great. I’ve been toying around with the idea of writing a few greasemonkey scripts to “inject” microformats into pages that didn’t already mark their data up as such.
I wasn’t sure if Operator would be able to detect those changes or not. Now I know. I guess it’s time to start hacking up some javascript.

Write a comment