[Greasemonkey] custom element properties

Timothy Babych tim at innovativemarketing.com.ua
Tue Aug 23 16:17:02 EDT 2005


Hello everybody.

I used to use custom properties of elements in my scripts.
With inroduction of GM 0.5 this trick does not work anymore in Deer Park
while working well in FF 1.0.x

The simle snippet looks like

// ==UserScript==
// @name           TeST
// @include      *
// ==/UserScript==

function hello() {
	window.alert(this.my_param)
}

a = document.createElement('a')
linktxt = document.createTextNode('A node')
a.appendChild(linktxt)
a.my_param = 111

document.body.appendChild(a)
a.addEventListener('click', hello, false)

window.alert(a.my_param)

//===============================

Alert called directly after creating element works ok, but the one
called in function says 'undefined'.

Any advice? Thanks.

-- 
Timothy Babych.

Internet Explorer is useful Windows tool
for downloading Firefox, the browser.


More information about the Greasemonkey mailing list