<?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>Eli Grey &#187; E4X</title>
	<atom:link href="http://eligrey.com/blog/post/tag/e4x/feed" rel="self" type="application/rss+xml" />
	<link>http://eligrey.com/blog</link>
	<description>this instanceof Whitty</description>
	<lastBuildDate>Sat, 24 Dec 2011 22:58:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Another E4X DOM library</title>
		<link>http://eligrey.com/blog/post/another-e4x-dom-library</link>
		<comments>http://eligrey.com/blog/post/another-e4x-dom-library#comments</comments>
		<pubDate>Sun, 22 Nov 2009 16:10:26 +0000</pubDate>
		<dc:creator>Eli</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[E4X]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JavaScript Libraries]]></category>

		<guid isPermaLink="false">http://eligrey.com/blog/?p=390</guid>
		<description><![CDATA[I just made another E4X DOM library, but this one is intended to implement the optional features in the ECMA-357 standard that are not implemented by Mozilla in JavaScript. The library is named e4x.js due to, for the most part, it only implementing stuff already specified in E4X. The only difference between the standard and [...]]]></description>
			<content:encoded><![CDATA[<p>I just made another E4X DOM library, but this one is intended to implement the optional features in the ECMA-357 standard that are not implemented by Mozilla in JavaScript. The library is named <a href="http://github.com/eligrey/e4x.js">e4x.js</a> due to, for the most part, it only implementing stuff already specified in E4X. The only difference between the standard and my implementation is that the <code>XML.xpath(xpathExpression)</code> method also supports numeric, string, and boolean result types.</p>
]]></content:encoded>
			<wfw:commentRss>http://eligrey.com/blog/post/another-e4x-dom-library/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E4X DOM toolkit</title>
		<link>http://eligrey.com/blog/post/e4x-dom-toolkit</link>
		<comments>http://eligrey.com/blog/post/e4x-dom-toolkit#comments</comments>
		<pubDate>Sun, 27 Sep 2009 19:36:11 +0000</pubDate>
		<dc:creator>Eli</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[E4X]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JavaScript Libraries]]></category>
		<category><![CDATA[JavaScript Snippets]]></category>

		<guid isPermaLink="false">http://eligrey.com/blog/?p=387</guid>
		<description><![CDATA[I have created a small JavaScript toolkit named e4x-dom.js for making it easy to manipulate the DOM with E4X. The following methods are implemented on XML objects by e4x-dom.js: node() Returns the HTML node representation of the XML. over(element or selector) Either overwrites element or every element matched by the CSS selector with node(). overId(id) [...]]]></description>
			<content:encoded><![CDATA[<p>I have created a small JavaScript toolkit named <a href="http://purl.eligrey.com/e4x-dom">e4x-dom.js</a> for making it easy to manipulate the DOM with E4X.</p>
<p>The following methods are implemented on XML objects by e4x-dom.js:</p>
<dl>
<dt><code>node()</code></dt>
<dd>Returns the HTML node representation of the XML.</dd>
<dt><code>over(element or selector)</code></dt>
<dd>Either overwrites <code>element</code> or every element matched by the CSS selector with <code>node()</code>.</dd>
<dt><code>overId(id)</code></dt>
<dd>Same as <code>over(document.getElementById(id))</code> but also preserves the the id of the element being overwritten in the element replacing it.</dd>
<dt><code>fill(element or selector)</code></dt>
<dd>Removes every child node of <code>element</code> or every element matched by the CSS selector. Then <code>node()</code> is appended to all of the emptied elements.</dd>
<dt><code>fillId(id)</code></dt>
<dd>Same as <code>fill(document.getElementById(id))</code></dd>
<dt><code>appendTo(element or selector)</code></dt>
<dd>Appends <code>node()</code> to <code>element</code> or every element matched by the CSS selector.</dd>
<dt><code>appendToId(id)</code></dt>
<dd>Same as <code>appendTo(document.getElementById(id))</code>.</dd>
<dt><code>insertBefore(element or selector)</code></dt>
<dd>Inserts <code>node()</code> before <code>element</code> or every element matched by the CSS selector.</dd>
<dt><code>insertBeforeId(id)</code></dt>
<dd>Same as <code>insertBefore(document.getElementById(id))</code>.</dd>
<dt><code>insertAfter(element or selector)</code></dt>
<dd>Inserts <code>node()</code> after <code>element</code> or every element matched by the CSS selector.</dd>
<dt><code>insertAfterId(id)</code></dt>
<dd>Same as <code>insertAfter(document.getElementById(id))</code>.</dd>
</dl>
<p>The following are examples of using the toolkit:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> img <span style="color: #339933;">=</span> <span style="color: #339933;">&lt;</span>img
 src<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span><span style="color: #000066;">prompt</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Enter an image URI&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span>
 alt<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span><span style="color: #000066;">prompt</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Describe the image&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span>
 id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;foobar&quot;</span>
<span style="color: #339933;">/&gt;;</span>
img.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">body</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>h1<span style="color: #339933;">&gt;</span>The image was <span style="color: #339933;">&lt;</span>em<span style="color: #339933;">&gt;</span>removed<span style="color: #339933;">&lt;/</span>em<span style="color: #339933;">&gt;</span>.<span style="color: #339933;">&lt;/</span>em<span style="color: #339933;">&gt;</span>.<span style="color: #660066;">overId</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;foobar&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;!</span><span style="color: #009900;">&#91;</span>CDATA<span style="color: #009900;">&#91;</span>And then <span style="color: #000066; font-weight: bold;">this</span> text node filled the header<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">&gt;</span>.<span style="color: #660066;">fill</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#foobar&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// the CDATA isn't itself put into the document but the data inside it is escaped so it</span>
<span style="color: #006600; font-style: italic;">// works in HTML and XHTML</span>
<span style="color: #339933;">&lt;</span>h1<span style="color: #339933;">&gt;&lt;!</span><span style="color: #009900;">&#91;</span>CDATA<span style="color: #009900;">&#91;</span><span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span> <span style="color: #000066; font-weight: bold;">in</span> here <span style="color: #000066; font-weight: bold;">is</span> <span style="color: #339933;">&lt;</span>escaped<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">&gt;&lt;/</span>h1<span style="color: #339933;">&gt;</span>.<span style="color: #660066;">insertBefore</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">body</span>.<span style="color: #660066;">firstChild</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// if you just want to create an element quickly, do xml.node()</span>
<span style="color: #339933;">&lt;</span>svg xmlns<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://www.w3.org/2000/svg&quot;</span> viewBox<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;0 0 100 100&quot;</span><span style="color: #339933;">/&gt;</span>.<span style="color: #660066;">node</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// SVG node</span>
<span style="color: #339933;">&lt;</span>div<span style="color: #339933;">/&gt;</span>.<span style="color: #660066;">node</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// div node</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// DOM methods are forwarded to .node()[method]()</span>
<span style="color: #339933;">&lt;</span>canvas<span style="color: #339933;">/&gt;</span>.<span style="color: #660066;">getContext</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;2d&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;</span>foo bar<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;baz&quot;</span><span style="color: #339933;">/&gt;</span>.<span style="color: #660066;">getAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;bar&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;baz&quot;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// same as getting .@bar</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// mass-modifications with CSS selectors</span>
<span style="color: #339933;">&lt;</span>strong<span style="color: #339933;">&gt;</span>Absolute links are <span style="color: #339933;">&lt;</span>em<span style="color: #339933;">&gt;</span>not<span style="color: #339933;">&lt;/</span>em<span style="color: #339933;">&gt;</span> allowed<span style="color: #339933;">&lt;/</span>strong<span style="color: #339933;">&gt;</span>
 .<span style="color: #660066;">over</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a[href^=&quot;http://&quot;], a[href^=&quot;https://&quot;], a[href^=&quot;//&quot;]'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>user.<span style="color: #660066;">hasEditPrivileges</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #006600; font-style: italic;">// wikipedia-style &quot;put an edit link at the start of each section&quot;</span>
 <span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;/edit?page=&quot;</span> <span style="color: #339933;">+</span> page.<span style="color: #660066;">id</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">&gt;</span><span style="color: #009900;">&#91;</span>edit<span style="color: #009900;">&#93;</span><span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>.<span style="color: #660066;">insertAfter</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'h2'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// &lt;![CDATA[]]&gt; nodes directly accessed are converted to text nodes:</span>
&nbsp;
<span style="color: #339933;">&lt;!</span><span style="color: #009900;">&#91;</span>CDATA<span style="color: #009900;">&#91;</span>
 <span style="color: #000066; font-weight: bold;">This</span> <span style="color: #000066; font-weight: bold;">is</span> a text node.
 <span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span> <span style="color: #000066; font-weight: bold;">is</span> escaped inside it.
<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">&gt;</span>.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#some-element&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://eligrey.com/blog/post/e4x-dom-toolkit/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Array methods for XML lists</title>
		<link>http://eligrey.com/blog/post/array-methods-for-xml</link>
		<comments>http://eligrey.com/blog/post/array-methods-for-xml#comments</comments>
		<pubDate>Thu, 28 May 2009 02:46:35 +0000</pubDate>
		<dc:creator>Eli</dc:creator>
				<category><![CDATA[E4X]]></category>
		<category><![CDATA[JavaScript Libraries]]></category>

		<guid isPermaLink="false">http://eligrey.com/?p=360</guid>
		<description><![CDATA[I have created an open source library that implements every array method for E4X XML lists in JavaScript named e4x-array-methods.js. The methods output XML as opposed to arrays to make the output directly usable with other XML. To get the array representation of an XML list, use slice. This returns XML when used to slice [...]]]></description>
			<content:encoded><![CDATA[<p>I have created an open source library that implements every array method for E4X XML lists in JavaScript named <strong>e4x-array-methods.js</strong>. The methods output XML as opposed to arrays to make the output directly usable with other XML. To get the array representation of an XML list, use <code>slice</code>. This returns XML when used to slice out ranges from XML but if no arguments are passed or a third argument is specified which is equivalent to <code>true</code>, it will convert an XML list to an array instead. For example, <code>xmllist.slice(3, 5)</code> returns an XML list and <code>xmllist.slice(3, 5, true)</code> returns an array.</p>
<h2 id="download">Download</h2>
<p>You can download e4x-array-methods.js at it&#8217;s <a href="http://github.com/eligrey/e4x-array-methods.js/tree/master">github repository</a>. If you wish to minify the library yourself, make sure that your minification tool supports the E4X used in this library. Rhino-based minifiers fail, throwing syntax errors, and <a href="http://dean.edwards.name/packer/">/packer/</a> errantly minifies all of the public methods names preceded by <code>.function::</code>.</p>
<h2 id="examples">Example</h2>
<p>The following example demonstrate the usefulness of having array methods for XML lists. If you want to try out the example in a JavaScript shell, make sure <code>XML.prettyPrinting</code> is set to <code>false</code>, which removes any unnecessary whitespace from <code>xml.toString()</code> and <code>xml.toXMLString()</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">XML.<span style="color: #660066;">prettyPrinting</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// for simplifying the comparisons below</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> foo <span style="color: #339933;">=</span> <span style="color: #339933;">&lt;&gt;&lt;/&gt;;</span> <span style="color: #006600; font-style: italic;">// XMLList literal</span>
foo.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">&lt;</span>n<span style="color: #339933;">&gt;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">&lt;/</span>n<span style="color: #339933;">&gt;,</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">3</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">6</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
foo.<span style="color: #660066;">toXMLString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;&lt;n&gt;0&lt;/n&gt;&lt;n&gt;1&lt;/n&gt;&lt;n&gt;5&lt;/n&gt;&lt;n&gt;3&lt;/n&gt;&lt;n&gt;2&lt;/n&gt;&lt;n&gt;6&lt;/n&gt;&lt;n&gt;4&lt;/n&gt;&quot;</span><span style="color: #339933;">;</span>
foo.<span style="color: #660066;">sort</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>a<span style="color: #339933;">,</span> b<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> a <span style="color: #339933;">-</span> b<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toXMLString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;&lt;n&gt;0&lt;/n&gt;&lt;n&gt;1&lt;/n&gt;&lt;n&gt;2&lt;/n&gt;&lt;n&gt;3&lt;/n&gt;&lt;n&gt;4&lt;/n&gt;&lt;n&gt;5&lt;/n&gt;&lt;n&gt;6&lt;/n&gt;&quot;</span><span style="color: #339933;">;</span>
foo.<span style="color: #660066;">filter</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">// filter out integers less then 3</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toXMLString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;&lt;n&gt;3&lt;/n&gt;&lt;n&gt;4&lt;/n&gt;&lt;n&gt;5&lt;/n&gt;&lt;n&gt;6&lt;/n&gt;&quot;</span><span style="color: #339933;">;</span>
foo.<span style="color: #660066;">slice</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">5</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toXMLString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;&lt;n&gt;2&lt;/n&gt;&lt;n&gt;3&lt;/n&gt;&lt;n&gt;4&lt;/n&gt;&quot;</span><span style="color: #339933;">;</span>
foo.<span style="color: #660066;">splice</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #339933;">&lt;</span>n<span style="color: #339933;">&gt;</span><span style="color: #CC0000;">9</span><span style="color: #339933;">&lt;/</span>n<span style="color: #339933;">&gt;,</span> <span style="color: #339933;">&lt;</span>n<span style="color: #339933;">&gt;</span><span style="color: #CC0000;">8</span><span style="color: #339933;">&lt;/</span>n<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toXMLString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;&lt;n&gt;2&lt;/n&gt;&quot;</span><span style="color: #339933;">;</span>
foo.<span style="color: #660066;">slice</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">5</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toXMLString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;&lt;n&gt;3&lt;/n&gt;&lt;n&gt;9&lt;/n&gt;&lt;n&gt;8&lt;/n&gt;&quot;</span><span style="color: #339933;">;</span>
foo.<span style="color: #660066;">pop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toXMLString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;&lt;n&gt;6&lt;/n&gt;&quot;</span><span style="color: #339933;">;</span>
foo.<span style="color: #660066;">shift</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toXMLString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;&lt;n&gt;0&lt;/n&gt;&quot;</span><span style="color: #339933;">;</span>
foo.<span style="color: #660066;">shift</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toXMLString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;&lt;n&gt;1&lt;/n&gt;&quot;</span><span style="color: #339933;">;</span>
foo.<span style="color: #660066;">unshift</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">&lt;</span>bar<span style="color: #339933;">/&gt;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
foo.<span style="color: #660066;">toXMLString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;&lt;bar/&gt;&lt;n&gt;3&lt;/n&gt;&lt;n&gt;9&lt;/n&gt;&lt;n&gt;8&lt;/n&gt;&lt;n&gt;4&lt;/n&gt;&lt;n&gt;5&lt;/n&gt;&quot;</span><span style="color: #339933;">;</span>
foo.<span style="color: #660066;">map</span><span style="color: #009900;">&#40;</span>parseFloat<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">forEach</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000066;">print</span><span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">// prints NaN, 3, 9, 8, 4, 5</span>
foo.<span style="color: #660066;">some</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">// some are greater than 5</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>x <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">5</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
foo.<span style="color: #660066;">every</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">// all are numbers</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> x <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;number&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://eligrey.com/blog/post/array-methods-for-xml/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

