[Greasemonkey] GM 0.6.4 and new DOMParser()

Joe la Poutre jsixpack at gmail.com
Fri Dec 2 15:10:31 EST 2005


John,

Have a look at Mark Pilgrim's article for O'Reilly:
http://www.oreillynet.com/pub/a/network/2005/11/01/avoid-common-greasemonkey-pitfalls.html

This happens to be hack #12 from his excellent book Greasemonkey Hacks.

Getting to your question, my work around for DOM parser:

// snippet...
if (typeof(XPCNativeWrapper) == "function") {
	var dp = new XPCNativeWrapper(window, "DOMParser()");
	var parser = new dp.DOMParser();
	var DOM = parser.parseFromString(gReq.responseText, "application/xhtml+xml");
	process(DOM);
}

Either window or unsafeWindow work as first argument to
XPCNativeWrapper, not sure which is best (see my question earlier on
this list).

HTH,

Joe.

On 12/1/05, John Plsek <jplsek at iinet.net.au> wrote:
> OK, I need DOMParser to work ... why is it broken in GM0.6.4?? Is there
> a workaround???
>
> Where is that definitive list of GM 0.6.x traps from us poor GM
> scripters??? new Image() isn't working, now new DOMParser() .... when
> will it end
>
> John
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>


More information about the Greasemonkey mailing list