How to define setters for Element object in QtWebKit?



  • I'm trying to define my own setter for innerHTML property, for example. JS code:
    var oldDescr = Object.getOwnPropertyDescriptor(Element.prototype, "innerHTML");

    	Object.defineProperty(Element.prototype, 'innerHTML',
    	  {
    		set: function(htmlVal)
    		  {
    			document.write("CATCH!");
    			oldDescr.set.call(this, htmlVal);
    		  }
    	  });
    
    	document.getElementById("foobar").innerHTML = "HEHE";
    

    This code works fine in FF 39 and Chrome 43. But my new setter function is not called when I test it in qtwebkit. I tried with examples (browser/fancybrowser) from Qt 5.4. Who's wrong? How to set my setters?



  • I found a bug from 2009 about the same problem: https://code.google.com/p/chromium/issues/detail?id=13175


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.