[Greasemonkey] Trying to find an event that indicates a change in a <div>

Aaron Boodman zboogs at gmail.com
Mon Jan 9 08:26:23 EST 2006


On 1/9/06, Blake West <blakewest at gmail.com> wrote:
> Is there any event available to tell me when the <div>'s contet has
> changed, so I don't have to poll the element constantly? I have looked
> through all the JS documentation I can find on events and event
> handlers, and I haven't found anything that made sense to me.
>
> Here's the script:
> http://www.tweaksthelimbs.org/greasemonkey/retrievrtweaks.user.js

Mutation events, particularly DOMSubtreeModified.

http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-eventgroupings-mutationevents

myDiv.addEventListener("DOMSubtreeModified", doSomething, false);

function doSomething() {
  GM_log("myDiv is now: " + myDiv.innerHTML);
}

- a


More information about the Greasemonkey mailing list