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….

Please note: I reserve the right to delete comments that are offensive or off-topic.

Leave a Reply

Your email address will not be published. Required fields are marked *

5 thoughts on “Operator and DOM Mutation Events

  1. 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.

  2. 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.

  3. 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…

  4. 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.