I am working on a Firefox extension and I am trying to pass the addEventListener parameter. I am “listening” to the changes in the page title, my code looks something like this:
function Test() { this.checkTitle = function( event ) { var func = function() { this.onTitleChange ( event ); }; var target = content.document.getElementsByTagName('TITLE')[0]; target.addEventListener('DOMSubtreeModified', func, false); } this.onTitleChange = function( e ) {
I never get a "test" warning if I use func = function () {alert (event); }; it shows a warning with "[object Event]". Also tried without using this. on func but still not working.
How can I make this work have access to the checkTitle "event" parameter in onTitleChange?
gtilx source share