<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>greasemonkey firefox js javascript Archives - The Story of David Kaspar</title>
	<atom:link href="https://blog.davidkaspar.com/archives/tag/greasemonkey-firefox-js-javascript/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.davidkaspar.com/archives/tag/greasemonkey-firefox-js-javascript</link>
	<description>Online journal and ponderings about the Internet, gadgets and photography.</description>
	<lastBuildDate>Fri, 02 Dec 2005 17:40:52 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://blog.davidkaspar.com/wp-content/uploads/2020/05/chubby.gif</url>
	<title>greasemonkey firefox js javascript Archives - The Story of David Kaspar</title>
	<link>https://blog.davidkaspar.com/archives/tag/greasemonkey-firefox-js-javascript</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Firefox 1.5 and Greasemonkey 0.6.4: where is my DOMParser</title>
		<link>https://blog.davidkaspar.com/archives/2005/12/firefox-1-5-and-greasemonkey-0-6-4-where-is-my-domparser.php</link>
					<comments>https://blog.davidkaspar.com/archives/2005/12/firefox-1-5-and-greasemonkey-0-6-4-where-is-my-domparser.php#comments</comments>
		
		<dc:creator><![CDATA[David Kaspar]]></dc:creator>
		<pubDate>Fri, 02 Dec 2005 17:40:52 +0000</pubDate>
				<category><![CDATA[GreaseMonkey]]></category>
		<category><![CDATA[greasemonkey firefox js javascript]]></category>
		<guid isPermaLink="false">https://davidkaspar.com/wp/2005/12/02/firefox-1-5-and-greasemonkey-0-6-4-where-is-my-domparser/</guid>

					<description><![CDATA[<p>The good news is that Firefox 1.5 is out and for it there is also the newest Greasemonkey 0.6.4. The bad news is that this combination breaks a lot of existing user scripts. There is a WiKi up that gives a helping hand at upgrading scripts but it is not complete (covers mainly XPCNativeWrappers, you &#8230; <a href="https://blog.davidkaspar.com/archives/2005/12/firefox-1-5-and-greasemonkey-0-6-4-where-is-my-domparser.php" class="more-link">Continue reading<span class="screen-reader-text"> "Firefox 1.5 and Greasemonkey 0.6.4: where is my DOMParser"</span></a></p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2005/12/firefox-1-5-and-greasemonkey-0-6-4-where-is-my-domparser.php">Firefox 1.5 and Greasemonkey 0.6.4: where is my DOMParser</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The good news is that Firefox 1.5 is out and for it there is also the newest Greasemonkey 0.6.4.<br />
The bad news is that this combination breaks a lot of existing <a href="http://www.userscripts.org/">user scripts</a>. There is a <a href="http://dunck.us/collab/GreaseMonkeyUserScripts?action=show&amp;redirect=GreasemonkeyUserScripts#head-4ac4d1e80f8bbd66bf4f1fbea77ea2390b6a2870">WiKi</a> up that gives a helping hand at upgrading scripts but it is not complete (covers mainly XPCNativeWrappers, you know the unsafeWindow thingy).<br />
I was quite surprised that the <a href="http://blog.davidkaspar.com/archives/2005/10/imdb-ratings-and-links-for-myvuecom.php">IMDB ratings for MyVue.com</a> stopped working. It was specifically the DOMParser that stops working with the cryptic error message &#8216;DOMParser is not a constructor&#8217;.<br />
The instinctive thing would be to use responseXML instead of responseText but only until you remind your self that the GM_xmlhttpRequest implementation returns the same string for both functions (instead of the correct DOM object for responseXML).<br />
I was just about to dive into manual parsing of the XML response with regexp and indexOf goodness but was literally saved by boogs from the <a href="http://greaseblog.blogspot.com/">Greaseblog</a>.<br />
He pointed me to the little known &#8220;new XML()&#8221; of <a href="http://developer.mozilla.org/presentations/xtech2005/e4x/">Mozilla E4X</a>. It can parse XML text strings and provide DOM like interface so it is good enough for the job.<br />
There are some oddities of course. When first using it you will get a <em>xml is a reserved identifier</em> error. Don&#8217;t ask why but the xml declaration has to be stripped out from the top of your xml document. Achieve this with <code>responseText.replace(/&lt;\?xml version="1.0"\?&gt;/,'')</code>.<br />
To get to a node use the following syntax: <code>xmlDoc..foo[0]</code> (for the first instance of foo tag). I found more information on the EX4 syntax at the <a href="http://www.linkwerk.com/pub/javascript/e4x/e4x-tester/">E4X Expression Tester</a>.<br />
Now get busy fixing those old Greasemonkey scripts!<br />
<u>Update</u><br />
Turns out that you can use XPCNativeWrapper to instantiate a new DOMParser (and other missing objects like XMLSerializer, HTMLBodyElement, &#8230;) like so:<br />
<code>var dp = new XPCNativeWrapper(window, "DOMParser").DOMParser</code>.<br />
I am not sure about the security implications of doing this.</p>
<p>The post <a href="https://blog.davidkaspar.com/archives/2005/12/firefox-1-5-and-greasemonkey-0-6-4-where-is-my-domparser.php">Firefox 1.5 and Greasemonkey 0.6.4: where is my DOMParser</a> appeared first on <a href="https://blog.davidkaspar.com">The Story of David Kaspar</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.davidkaspar.com/archives/2005/12/firefox-1-5-and-greasemonkey-0-6-4-where-is-my-domparser.php/feed</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
