Important: Please read the Qt Code of Conduct -

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!");, 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:

Log in to reply