Can I detect changes in a node's markup text using dojo? -


i have bunch of nodes contain markup in unpredictable structure. want able watch these nodes , see if html of of child nodes or descendants change, no matter how slightly. if do, want fire event.

can through dojo? i'm using 1.10, latest one.

thanks.

it sounds you're looking dom mutations. far i'm aware dojo not provide api this, they're pretty simple set up. problem different browsers have different ways of doing this.

var observenode = document.getelementbyid('observeme');  // check vendor-specific versions of mutationobserver. mutationobserver = (function() {   var prefixes = ['webkit', 'moz', 'o', 'ms', ''];   (var i=0, il=prefixes.length; i<il; i++) {     if (prefixes[i] + 'mutationobserver' in window) {       return window[prefixes[i] + 'mutationobserver'];     }   } }());  // sniff mutationobserver support if (mutationobserver) {   var observer = new mutationobserver(function(mutations) {     alert('something changed!');   });   observer.observe(observenode, {attributes: true, childlist: true, characterdata: true}); } else {   // fall mutation events   if (observenode.addeventlistener) {     observenode.addeventlistener('domsubtreemodified', function() {       alert('something changed!');     });   }   // ie8 , below has own little weird thing   else {     observenode.onpropertychange = function() {       alert('something changed!');     }   } } 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -