Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. How to define setters for Element object in QtWebKit?
QtWS25 Last Chance

How to define setters for Element object in QtWebKit?

Scheduled Pinned Locked Moved Qt WebKit
qtwebkitjavascript
2 Posts 1 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    v.martyanov
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      v.martyanov
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved