<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Is Your JavaScript Library Standards Compliant?</title>
	<atom:link href="http://www.sitepoint.com/blogs/2008/05/09/is-your-javascript-library-standards-compliant/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepoint.com/blogs/2008/05/09/is-your-javascript-library-standards-compliant/</link>
	<description></description>
	<pubDate>Sat, 05 Jul 2008 21:17:55 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: raymond</title>
		<link>http://www.sitepoint.com/blogs/2008/05/09/is-your-javascript-library-standards-compliant/#comment-721199</link>
		<dc:creator>raymond</dc:creator>
		<pubDate>Tue, 13 May 2008 01:23:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2475#comment-721199</guid>
		<description>Hi,

IMO the libraries take make the best of both worlds. For extended css selectors javascript will be used for standard css selectors the new api can be used.

So either way it's a win-win.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>IMO the libraries take make the best of both worlds. For extended css selectors javascript will be used for standard css selectors the new api can be used.</p>
<p>So either way it&#8217;s a win-win.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: solidhex</title>
		<link>http://www.sitepoint.com/blogs/2008/05/09/is-your-javascript-library-standards-compliant/#comment-721128</link>
		<dc:creator>solidhex</dc:creator>
		<pubDate>Mon, 12 May 2008 22:15:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2475#comment-721128</guid>
		<description>@rimmer33

In jQuery you don't even need the each, could just do
&lt;code&gt;$('a[rel~=external]').click(function(e){
		open(this.href);
		e.preventDefault();
	});
&lt;/code&gt;

:)</description>
		<content:encoded><![CDATA[<p>@rimmer33</p>
<p>In jQuery you don&#8217;t even need the each, could just do<br />
<code>$('a[rel~=external]').click(function(e){
		open(this.href);
		e.preventDefault();
	});
</code></p>
<p>:)</p>]]></content:encoded>
	</item>
	<item>
		<title>By: rimmer33</title>
		<link>http://www.sitepoint.com/blogs/2008/05/09/is-your-javascript-library-standards-compliant/#comment-720789</link>
		<dc:creator>rimmer33</dc:creator>
		<pubDate>Mon, 12 May 2008 07:56:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2475#comment-720789</guid>
		<description>First jQuery example is kinda lame :) Nobody in jQuery world would do so. We do &lt;code&gt;$('our selector').each(function(){here goes our stuff for each element})&lt;/code&gt; or even more simple if it is all about to delegate an event on each element.

And about selectors: if JavaScript was emerged to browsers only for sake of doing what ony those particular browsers can do, there wouldn't be so much hype about that. JavaScript &lt;em&gt;extends&lt;/em&gt; browser capabilities, nothing less. Why should we care if IE supports CSS3 selectors API, if we use a selected cross-browser JS library. It was written to extend the possibilities, not to wrap them in yet another layer. So, I use what I use, take benefit of it's powers and don't care if it is standard in any part. It just works. It's a job of library author to follow standards in his code, not mine, I follow standards only in my part. &lt;em&gt;Separation&lt;/em&gt; that is. Good practice, I think.</description>
		<content:encoded><![CDATA[<p>First jQuery example is kinda lame :) Nobody in jQuery world would do so. We do <code>$('our selector').each(function(){here goes our stuff for each element})</code> or even more simple if it is all about to delegate an event on each element.</p>
<p>And about selectors: if JavaScript was emerged to browsers only for sake of doing what ony those particular browsers can do, there wouldn&#8217;t be so much hype about that. JavaScript <em>extends</em> browser capabilities, nothing less. Why should we care if IE supports CSS3 selectors API, if we use a selected cross-browser JS library. It was written to extend the possibilities, not to wrap them in yet another layer. So, I use what I use, take benefit of it&#8217;s powers and don&#8217;t care if it is standard in any part. It just works. It&#8217;s a job of library author to follow standards in his code, not mine, I follow standards only in my part. <em>Separation</em> that is. Good practice, I think.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: anon</title>
		<link>http://www.sitepoint.com/blogs/2008/05/09/is-your-javascript-library-standards-compliant/#comment-720757</link>
		<dc:creator>anon</dc:creator>
		<pubDate>Mon, 12 May 2008 05:50:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2475#comment-720757</guid>
		<description>@asp_funda: your info. about dojo is far outdated.  While your comments may have been true for Dojo 0.4, more recent versions of Dojo are extremely competitive in size and performance with Prototype and jQuery, and outperform most toolkits it the selectors SlickSpeed tests.  It seems a bit odd to complain about incorrect info. with incorrect info.  The Dojo of today is fast... if you don't believe me, check it out.

What Alex was saying is that by only supporting valid selectors, it's a lot easier to flip the switch from custom to native selector engines, without having to fork based on each selector, which helps keep code lean and concise.  But complaining about Alex's explanation for why Dojo chooses to do this, because of the way the author created this story is a bit unfair to Alex.  He was simply explaining why Dojo took this route (to make it easier to support the coming native engines).</description>
		<content:encoded><![CDATA[<p>@asp_funda: your info. about dojo is far outdated.  While your comments may have been true for Dojo 0.4, more recent versions of Dojo are extremely competitive in size and performance with Prototype and jQuery, and outperform most toolkits it the selectors SlickSpeed tests.  It seems a bit odd to complain about incorrect info. with incorrect info.  The Dojo of today is fast&#8230; if you don&#8217;t believe me, check it out.</p>
<p>What Alex was saying is that by only supporting valid selectors, it&#8217;s a lot easier to flip the switch from custom to native selector engines, without having to fork based on each selector, which helps keep code lean and concise.  But complaining about Alex&#8217;s explanation for why Dojo chooses to do this, because of the way the author created this story is a bit unfair to Alex.  He was simply explaining why Dojo took this route (to make it easier to support the coming native engines).</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Yank</title>
		<link>http://www.sitepoint.com/blogs/2008/05/09/is-your-javascript-library-standards-compliant/#comment-720518</link>
		<dc:creator>Kevin Yank</dc:creator>
		<pubDate>Sun, 11 May 2008 20:33:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2475#comment-720518</guid>
		<description>kangax,

&lt;blockquote&gt;1) I don't understand the promotion of using for/in for array enumeration.&lt;/blockquote&gt;

You’re absolutely right, and I’ve amended the code to use &lt;code&gt;for&lt;/code&gt; loops instead.

&lt;blockquote&gt;2) Redeclaring variables in each iteration is quite redundant.&lt;/blockquote&gt;

This causes no overhead, and keeps the code tidy.

&lt;blockquote&gt;3) &lt;code&gt;href != null&lt;/code&gt; is redundant as well.&lt;/blockquote&gt;

Not so. In Internet Explorer, an &lt;code&gt;&#60;a name="…"&#62;&lt;/code&gt; tag’s &lt;code&gt;href&lt;/code&gt; property is &lt;code&gt;undefined&lt;/code&gt;, while all other browsers return an empty string. A &lt;code&gt;typeof&lt;/code&gt; check is therefore inadequate.

&lt;blockquote&gt;4) "[href]" selector matches empty attributes, so there's no need to test for &lt;code&gt;length &#62; 0&lt;/code&gt;&lt;/blockquote&gt;

I don’t know what you mean here. The test for &lt;code&gt;href.length &#62; 0&lt;/code&gt; doesn’t appear in the same example as the &lt;code&gt;[href]&lt;/code&gt; selector.

&lt;blockquote&gt;4) &lt;code&gt;rel != null &#38;&#38; /(^&#124; )external( &#124;$)/.test(rel)&lt;/code&gt; could be replaced with &lt;code&gt;/external/.test(rel)&lt;/code&gt; as "test" works just fine with any falsy values.&lt;/blockquote&gt;

The &lt;code&gt;rel&lt;/code&gt; attribute is a space-separated list of values. Thus the need for the more complicated regular expression.</description>
		<content:encoded><![CDATA[<p>kangax,</p>
<blockquote><p>1) I don&#8217;t understand the promotion of using for/in for array enumeration.</p></blockquote>
<p>You’re absolutely right, and I’ve amended the code to use <code>for</code> loops instead.</p>
<blockquote><p>2) Redeclaring variables in each iteration is quite redundant.</p></blockquote>
<p>This causes no overhead, and keeps the code tidy.</p>
<blockquote><p>3) <code>href != null</code> is redundant as well.</p></blockquote>
<p>Not so. In Internet Explorer, an <code>&lt;a name="…"&gt;</code> tag’s <code>href</code> property is <code>undefined</code>, while all other browsers return an empty string. A <code>typeof</code> check is therefore inadequate.</p>
<blockquote><p>4) &#8220;[href]&#8221; selector matches empty attributes, so there&#8217;s no need to test for <code>length &gt; 0</code></p></blockquote>
<p>I don’t know what you mean here. The test for <code>href.length &gt; 0</code> doesn’t appear in the same example as the <code>[href]</code> selector.</p>
<blockquote><p>4) <code>rel != null &amp;&amp; /(^| )external( |$)/.test(rel)</code> could be replaced with <code>/external/.test(rel)</code> as &#8220;test&#8221; works just fine with any falsy values.</p></blockquote>
<p>The <code>rel</code> attribute is a space-separated list of values. Thus the need for the more complicated regular expression.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: mattymcg</title>
		<link>http://www.sitepoint.com/blogs/2008/05/09/is-your-javascript-library-standards-compliant/#comment-720267</link>
		<dc:creator>mattymcg</dc:creator>
		<pubDate>Sun, 11 May 2008 11:08:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2475#comment-720267</guid>
		<description>Harald wrote:

&lt;blockquote&gt;Wow, the worst post about JavaScript I saw in a long time. I use MooTools, I love JavaScript code, but what you wrote here is blasphemy. Its not only bad code but bad advices. Read &lt;a href="http://streetteam.webstandards.org/goodbooks/" rel="nofollow"&gt;better books&lt;/a&gt; about DOM Scripting.&lt;/blockquote&gt;

I have to laugh at this comment. Harald you do actually realise that Kevin WROTE &lt;a href="http://www.sitepoint.com/books/javascript1/" rel="nofollow"&gt;one of the books on that list&lt;/a&gt;? :-D</description>
		<content:encoded><![CDATA[<p>Harald wrote:</p>
<blockquote><p>Wow, the worst post about JavaScript I saw in a long time. I use MooTools, I love JavaScript code, but what you wrote here is blasphemy. Its not only bad code but bad advices. Read <a href="http://streetteam.webstandards.org/goodbooks/" rel="nofollow">better books</a> about DOM Scripting.</p></blockquote>
<p>I have to laugh at this comment. Harald you do actually realise that Kevin WROTE <a href="http://www.sitepoint.com/books/javascript1/" rel="nofollow">one of the books on that list</a>? :-D</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Sorccu</title>
		<link>http://www.sitepoint.com/blogs/2008/05/09/is-your-javascript-library-standards-compliant/#comment-719690</link>
		<dc:creator>Sorccu</dc:creator>
		<pubDate>Sat, 10 May 2008 13:28:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2475#comment-719690</guid>
		<description>solidhex:

I was just pointing out how things are. for .. in does not work the way it's been used in the post. Clearly the author didn't even bother testing anything. I find it most unfortunate that SitePoint's once top-quality blogs have become like this.</description>
		<content:encoded><![CDATA[<p>solidhex:</p>
<p>I was just pointing out how things are. for .. in does not work the way it&#8217;s been used in the post. Clearly the author didn&#8217;t even bother testing anything. I find it most unfortunate that SitePoint&#8217;s once top-quality blogs have become like this.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: asp_funda</title>
		<link>http://www.sitepoint.com/blogs/2008/05/09/is-your-javascript-library-standards-compliant/#comment-719597</link>
		<dc:creator>asp_funda</dc:creator>
		<pubDate>Sat, 10 May 2008 07:37:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2475#comment-719597</guid>
		<description>Kevin, aren't all Javascript libaries today used majorly for functionalities that browsers by default don't provide? Isn't depending on browsers the reason which kept Rich User Interfaces and interactive applications in Javascript away from users for 7-8 years before they were actually put in mass use? IE introduced it 10 years back &#38; the other browsers didn't implement it for the next 7-8 years, else imagine what the scene would've been of the web had these RUI's came out 10 years ago!

So I don't understand what exactly Dojo’s Alex Russell mean to say! Did he mean that making a check in the javascript function to see if the browser by default supports selector query or not is impossible or too hard? Did he mean that its impossible to check if browser supports the functionality natively or not &#38; then use browser's call(if it supports) else use the library's own engine! If he means that then I think that's enough said &#38; I will not consider Dojo at all if these kind of developers make that framework!

I think what he skipped over is that the reason why people like prototype &#38; jQuery etc. is that these are quite lightweight &#38; by default come as no-frills libraries! The developer working on them can then add on top of them whatever frills (s)he wants but Dojo is one beast that's quite slow &#38; comes with all the bells &#38; whistles by default that not everyone might want!!</description>
		<content:encoded><![CDATA[<p>Kevin, aren&#8217;t all Javascript libaries today used majorly for functionalities that browsers by default don&#8217;t provide? Isn&#8217;t depending on browsers the reason which kept Rich User Interfaces and interactive applications in Javascript away from users for 7-8 years before they were actually put in mass use? IE introduced it 10 years back &amp; the other browsers didn&#8217;t implement it for the next 7-8 years, else imagine what the scene would&#8217;ve been of the web had these RUI&#8217;s came out 10 years ago!</p>
<p>So I don&#8217;t understand what exactly Dojo’s Alex Russell mean to say! Did he mean that making a check in the javascript function to see if the browser by default supports selector query or not is impossible or too hard? Did he mean that its impossible to check if browser supports the functionality natively or not &amp; then use browser&#8217;s call(if it supports) else use the library&#8217;s own engine! If he means that then I think that&#8217;s enough said &amp; I will not consider Dojo at all if these kind of developers make that framework!</p>
<p>I think what he skipped over is that the reason why people like prototype &amp; jQuery etc. is that these are quite lightweight &amp; by default come as no-frills libraries! The developer working on them can then add on top of them whatever frills (s)he wants but Dojo is one beast that&#8217;s quite slow &amp; comes with all the bells &amp; whistles by default that not everyone might want!!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: kangax</title>
		<link>http://www.sitepoint.com/blogs/2008/05/09/is-your-javascript-library-standards-compliant/#comment-719504</link>
		<dc:creator>kangax</dc:creator>
		<pubDate>Sat, 10 May 2008 02:26:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2475#comment-719504</guid>
		<description>Huh?

1) I don't understand the promotion of using for/in for array enumeration.
2) Redeclaring variables in each iteration is quite redundant.
3) &lt;code&gt;href != null&lt;/code&gt; is redundant as well.
4) "[href]" selector matches empty attributes, so there's no need to test for &lt;code&gt;length &#62; 0&lt;/code&gt;
4) &lt;code&gt;rel != null &#38;&#38; /(^&#124; )external( &#124;$)/.test(rel)&lt;/code&gt; could be replaced with &lt;code&gt;/external/.test(rel)&lt;/code&gt; as "test" works just fine with any falsy values.

I don't mean to sound offensive, but giving such examples to novice javascripters doesn't sound like a good idea.

&lt;code&gt;
for (var anchors = document.getElementsByTagName('a'), i=0, l=anchors.length; i&#60;l; i++) {
  if (typeof anchors[i].getAttribute('href') == 'string' &#38;&#38; /external/.test(anchors[i].getAttribute('rel'))) {
    ...
  }
}
&lt;/code&gt;

Cheers,
kangax</description>
		<content:encoded><![CDATA[<p>Huh?</p>
<p>1) I don&#8217;t understand the promotion of using for/in for array enumeration.<br />
2) Redeclaring variables in each iteration is quite redundant.<br />
3) <code>href != null</code> is redundant as well.<br />
4) &#8220;[href]&#8221; selector matches empty attributes, so there&#8217;s no need to test for <code>length &gt; 0</code><br />
4) <code>rel != null &amp;&amp; /(^| )external( |$)/.test(rel)</code> could be replaced with <code>/external/.test(rel)</code> as &#8220;test&#8221; works just fine with any falsy values.</p>
<p>I don&#8217;t mean to sound offensive, but giving such examples to novice javascripters doesn&#8217;t sound like a good idea.</p>
<code>
for (var anchors = document.getElementsByTagName('a'), i=0, l=anchors.length; i&lt;l; i++) {
  if (typeof anchors[i].getAttribute('href') == 'string' &amp;&amp; /external/.test(anchors[i].getAttribute('rel'))) {
    ...
  }
}
</code>
<p>Cheers,<br />
kangax</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Joan Molina</title>
		<link>http://www.sitepoint.com/blogs/2008/05/09/is-your-javascript-library-standards-compliant/#comment-719288</link>
		<dc:creator>Joan Molina</dc:creator>
		<pubDate>Fri, 09 May 2008 18:12:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=2475#comment-719288</guid>
		<description>Well, if a browser still does not support a CSS feature surely Javascript libraries should provide a way to support it. But once the browser supports it, a Javascript library should be rewritten so as to adapt the new feature into its code. Therefore, we, developers, need not worry about these things. Keep the code as it is.

It's a similar situation as forgetting about browser sniffing when coding. That annoying question is hardcoded into the Javascript library. No problem.</description>
		<content:encoded><![CDATA[<p>Well, if a browser still does not support a CSS feature surely Javascript libraries should provide a way to support it. But once the browser supports it, a Javascript library should be rewritten so as to adapt the new feature into its code. Therefore, we, developers, need not worry about these things. Keep the code as it is.</p>
<p>It&#8217;s a similar situation as forgetting about browser sniffing when coding. That annoying question is hardcoded into the Javascript library. No problem.</p>]]></content:encoded>
	</item>
</channel>
</rss>
