[Greasemonkey] delete object attribute?

Andre gm at andrecgn.de
Sun Feb 5 23:51:49 EST 2006


more a JS question than GM ... but ...

I am using an object as an associative array:

	var x = {};
	x['foo'] = 'bar';
	x['abc'] = 'def';
	GM_setValue('x', uneval(x));
	...
	if ( x[someIndex] ) { ... }

sometimes I want to delete an element. Setting it to null or undefined 
still keeps it, just with that value. Since I am getting and setting it 
with GM_setValue and GM_getValue over time the object collects 
attributes and grows. Is there any way to actually delete an attribute? 
I could not find anything in the JS docs. maybe I looked in the wrong 
place...

Thanks, Andre



More information about the Greasemonkey mailing list