How to define setters for Element object in QtWebKit?
-
wrote on 5 Jul 2015, 11:38 last edited by
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?
-
wrote on 5 Jul 2015, 13:52 last edited by
I found a bug from 2009 about the same problem: https://code.google.com/p/chromium/issues/detail?id=13175
1/2