Listen for changes in a DOM structure
Is there any standardized way (not language dependent, I need at least C++, Java and Ruby) of listening for changes in a DOM-document? I开发者_运维知识库 would like to have a function called every time a node's attributes change, a node gets renamed, deleted, etcetera.
I found the Handlers for UserData, however those don't allow me to listen for e.g. changes in attribute. Right now it seems to me the only possibility is implementing my own DOM. Any ideas?
You want to add a handler for Mutation Events. I've used these in Firefox, although I don't know what availability they have in libraries for the languages you mention.
http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-mutationevents
精彩评论