<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Reversed Ordered List with jQuery</title>
	<atom:link href="http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/</link>
	<description>Doing That Web Standards Thing</description>
	<lastBuildDate>Sun, 14 Mar 2010 01:57:03 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: David Betz</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-4269</link>
		<dc:creator>David Betz</dc:creator>
		<pubDate>Fri, 11 Dec 2009 16:17:36 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-4269</guid>
		<description>Thanks! This got me half way there. The challenge I was given: a reverse ordered list of articles grouped by year, so basically a series of ordered lists separated by headers with the reverse count preserved. 

&lt;pre&gt;&lt;code&gt;$(document).ready(function() {
	var totalAll = 0;
	$(&#039;.reversed&#039;).each(function() {
		var children = $(this).children(&#039;li&#039;);
		var totalChildren = children.length;
		totalAll+= totalChildren;
	});
	$(&#039;.reversed&#039;).each(function() {
		var children = $(this).children(&#039;li&#039;);
		var totalChildren = children.length;
		children.each(function() {
			$(this).val(totalAll--);
		});
	});
});&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Thanks! This got me half way there. The challenge I was given: a reverse ordered list of articles grouped by year, so basically a series of ordered lists separated by headers with the reverse count preserved. </p>
<pre><code>$(document).ready(function() {
	var totalAll = 0;
	$('.reversed').each(function() {
		var children = $(this).children('li');
		var totalChildren = children.length;
		totalAll+= totalChildren;
	});
	$('.reversed').each(function() {
		var children = $(this).children('li');
		var totalChildren = children.length;
		children.each(function() {
			$(this).val(totalAll--);
		});
	});
});</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Twitted by Mixedmedia</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-4205</link>
		<dc:creator>Twitted by Mixedmedia</dc:creator>
		<pubDate>Sun, 06 Dec 2009 03:15:17 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-4205</guid>
		<description>[...] This post was Twitted by Mixedmedia [...]</description>
		<content:encoded><![CDATA[<p>[...] This post was Twitted by Mixedmedia [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steward</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3966</link>
		<dc:creator>Steward</dc:creator>
		<pubDate>Mon, 23 Nov 2009 22:03:59 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3966</guid>
		<description>May be better without unnecessary variable &quot;start&quot;?
&lt;pre&gt;&lt;code&gt;$(document).ready(function() {
	$(&#039;.reversed&#039;).each(function() {
		var $children = $(this).children(&#039;li&#039;);
		var totalChildren = $children.length;
		$children.each(function() {
			$(this).val(totalChildren--);
		});
	});
});&lt;/code&gt;&lt;/pre&gt;

I don&#039;t understand - what what do you use &quot;var start = 0;&quot;?</description>
		<content:encoded><![CDATA[<p>May be better without unnecessary variable &#8220;start&#8221;?</p>
<pre><code>$(document).ready(function() {
	$('.reversed').each(function() {
		var $children = $(this).children('li');
		var totalChildren = $children.length;
		$children.each(function() {
			$(this).val(totalChildren--);
		});
	});
});</code></pre>
<p>I don&#8217;t understand &#8211; what what do you use &#8220;var start = 0;&#8221;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trevor</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3766</link>
		<dc:creator>Trevor</dc:creator>
		<pubDate>Sat, 14 Nov 2009 23:24:45 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3766</guid>
		<description>@&lt;a href=&quot;#comment-3759&quot; rel=&quot;nofollow&quot;&gt;Judd Lyon&lt;/a&gt;-
Thanks, I&#8217;m excited!</description>
		<content:encoded><![CDATA[<p>@<a href="#comment-3759" rel="nofollow">Judd Lyon</a>-<br />
Thanks, I&rsquo;m excited!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Judd Lyon</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3759</link>
		<dc:creator>Judd Lyon</dc:creator>
		<pubDate>Fri, 13 Nov 2009 19:55:03 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3759</guid>
		<description>Nice little trick, thanks!

Congrats on teaching and the new gig with Viget, they are an impressive outfit that just got better. 

Cheers.</description>
		<content:encoded><![CDATA[<p>Nice little trick, thanks!</p>
<p>Congrats on teaching and the new gig with Viget, they are an impressive outfit that just got better. </p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CSS Brigit &#124; Reversed Ordered List with jQuery</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3746</link>
		<dc:creator>CSS Brigit &#124; Reversed Ordered List with jQuery</dc:creator>
		<pubDate>Thu, 12 Nov 2009 12:37:01 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3746</guid>
		<description>&lt;strong&gt; Reversed Ordered List with jQuery...&lt;/strong&gt;

	
			
						
							
				How to create an ordered list that counts in reverse with jQuery.
			
			...</description>
		<content:encoded><![CDATA[<p><strong> Reversed Ordered List with jQuery&#8230;</strong></p>
<p>				How to create an ordered list that counts in reverse with jQuery.</p>
<p>			&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trevor</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3745</link>
		<dc:creator>Trevor</dc:creator>
		<pubDate>Wed, 11 Nov 2009 21:09:19 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3745</guid>
		<description>@&lt;a href=&quot;#comment-3742&quot; rel=&quot;nofollow&quot;&gt;Nate&lt;/a&gt;-
Wow, thanks for running the performance tests. Your point about reversing the list items is certainly valid and a nice addition to the example.</description>
		<content:encoded><![CDATA[<p>@<a href="#comment-3742" rel="nofollow">Nate</a>-<br />
Wow, thanks for running the performance tests. Your point about reversing the list items is certainly valid and a nice addition to the example.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reversed Ordered List with jQuery &#124; Trevor Davis</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3744</link>
		<dc:creator>Reversed Ordered List with jQuery &#124; Trevor Davis</dc:creator>
		<pubDate>Wed, 11 Nov 2009 20:08:22 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3744</guid>
		<description>[...] Reversed Ordered List with jQuery &#124; Trevor Davis &#8211; [...]</description>
		<content:encoded><![CDATA[<p>[...] Reversed Ordered List with jQuery | Trevor Davis &#8211; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: uberVU - social comments</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3743</link>
		<dc:creator>uberVU - social comments</dc:creator>
		<pubDate>Wed, 11 Nov 2009 18:01:33 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3743</guid>
		<description>&lt;strong&gt;Social comments and analytics for this post...&lt;/strong&gt;

This post was mentioned on Twitter by davist11: Just wrote a short blog article about creating a reversed ordered list with jQuery http://bit.ly/4z4E5V...</description>
		<content:encoded><![CDATA[<p><strong>Social comments and analytics for this post&#8230;</strong></p>
<p>This post was mentioned on Twitter by davist11: Just wrote a short blog article about creating a reversed ordered list with jQuery <a href="http://bit.ly/4z4E5V.." rel="nofollow">http://bit.ly/4z4E5V..</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3742</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Wed, 11 Nov 2009 17:01:37 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3742</guid>
		<description>@&lt;a href=&quot;#comment-3741&quot; rel=&quot;nofollow&quot;&gt;Trevor&lt;/a&gt;-

I think if you say, &quot;This is our list of $whatevers&quot;, and you have an ordered list of items, the meaning of those items is the same as if they had an invisible #1-10 next to them. Whether that ranking means &quot;best&quot; or &quot;worst&quot; or &quot;funniest&quot; or whatever is, of course, subject to the nature of the content. But it makes me feel like it&#039;s still well worth having the script reverse the actual items.

That said, there&#039;s no denying there&#039;s a performance difference between just setting the value and rearranging the elements. I profiled the four-item ordered list and then a 120-item ordered list with each of our scripts, with these results:

&lt;strong&gt;Your script:&lt;/strong&gt;

&lt;strong&gt;4:&lt;/strong&gt; 1.37ms
&lt;strong&gt;120:&lt;/strong&gt; 21.164ms

&lt;strong&gt;My script:&lt;/strong&gt;

&lt;strong&gt;4:&lt;/strong&gt; 3.608ms
&lt;strong&gt;120:&lt;/strong&gt; 63.695ms</description>
		<content:encoded><![CDATA[<p>@<a href="#comment-3741" rel="nofollow">Trevor</a>-</p>
<p>I think if you say, &#8220;This is our list of $whatevers&#8221;, and you have an ordered list of items, the meaning of those items is the same as if they had an invisible #1-10 next to them. Whether that ranking means &#8220;best&#8221; or &#8220;worst&#8221; or &#8220;funniest&#8221; or whatever is, of course, subject to the nature of the content. But it makes me feel like it&#8217;s still well worth having the script reverse the actual items.</p>
<p>That said, there&#8217;s no denying there&#8217;s a performance difference between just setting the value and rearranging the elements. I profiled the four-item ordered list and then a 120-item ordered list with each of our scripts, with these results:</p>
<p><strong>Your script:</strong></p>
<p><strong>4:</strong> 1.37ms<br />
<strong>120:</strong> 21.164ms</p>
<p><strong>My script:</strong></p>
<p><strong>4:</strong> 3.608ms<br />
<strong>120:</strong> 63.695ms</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trevor</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3741</link>
		<dc:creator>Trevor</dc:creator>
		<pubDate>Wed, 11 Nov 2009 16:27:25 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3741</guid>
		<description>@&lt;a href=&quot;#comment-3739&quot; rel=&quot;nofollow&quot;&gt;Nate&lt;/a&gt;-
Stupid WordPress.

Agreed, so I guess it just depends on whether there is a reference somewhere on the page saying that this list is presented in a certain order for a specific reason. If not, then I don&#8217;t think too much value is added in reversing it for non-JavaScript users. 

I wonder what kind of load reversing the list adds to the page. I&#8217;m sure it&#8217;s trivial in this example since the list is so short, but what about a list with 100 items?</description>
		<content:encoded><![CDATA[<p>@<a href="#comment-3739" rel="nofollow">Nate</a>-<br />
Stupid WordPress.</p>
<p>Agreed, so I guess it just depends on whether there is a reference somewhere on the page saying that this list is presented in a certain order for a specific reason. If not, then I don&rsquo;t think too much value is added in reversing it for non-JavaScript users. </p>
<p>I wonder what kind of load reversing the list adds to the page. I&rsquo;m sure it&rsquo;s trivial in this example since the list is so short, but what about a list with 100 items?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3740</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Wed, 11 Nov 2009 16:02:43 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3740</guid>
		<description>@&lt;a href=&quot;#comment-3739&quot; rel=&quot;nofollow&quot;&gt;Nate&lt;/a&gt;-
Of course, by &quot;unordered&quot; above, I mean &quot;ordered&quot;.</description>
		<content:encoded><![CDATA[<p>@<a href="#comment-3739" rel="nofollow">Nate</a>-<br />
Of course, by &#8220;unordered&#8221; above, I mean &#8220;ordered&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3739</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Wed, 11 Nov 2009 16:02:05 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3739</guid>
		<description>I had &lt;pre&gt; tags, man: I think it was stripped out by your demon CMS. (Don&#039;t be sad, WordPress, I didn&#039;t mean it.)

I guess technically there&#039;s nothing but &lt;em&gt;order&lt;/em&gt; necessarily implied by an unordered list, but there are default ways, as far as browsers are concerned, of interpreting them, and the default is as a numbered list. In this instance, I think browsers behave just like any reader would: unless we&#039;re explicitly told otherwise, the numbers start at one and proceed upwards.</description>
		<content:encoded><![CDATA[<p>I had &lt;pre&gt; tags, man: I think it was stripped out by your demon CMS. (Don&#8217;t be sad, WordPress, I didn&#8217;t mean it.)</p>
<p>I guess technically there&#8217;s nothing but <em>order</em> necessarily implied by an unordered list, but there are default ways, as far as browsers are concerned, of interpreting them, and the default is as a numbered list. In this instance, I think browsers behave just like any reader would: unless we&#8217;re explicitly told otherwise, the numbers start at one and proceed upwards.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trevor</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3738</link>
		<dc:creator>Trevor</dc:creator>
		<pubDate>Wed, 11 Nov 2009 15:47:17 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3738</guid>
		<description>@&lt;a href=&quot;#comment-3737&quot; rel=&quot;nofollow&quot;&gt;Nate&lt;/a&gt;-
&lt;pre&gt; tag sir&#8230;

I guess reordering the list does add some sort of semantic value, but how much really? It depends if there is any value given to item 10 vs. item 1.</description>
		<content:encoded><![CDATA[<p>@<a href="#comment-3737" rel="nofollow">Nate</a>-<br />
&lt;pre> tag sir&hellip;</p>
<p>I guess reordering the list does add some sort of semantic value, but how much really? It depends if there is any value given to item 10 vs. item 1.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3737</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Wed, 11 Nov 2009 15:40:53 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3737</guid>
		<description>Hmm -- that code didn&#039;t exactly format the way I would&#039;ve liked. Help a brother out?</description>
		<content:encoded><![CDATA[<p>Hmm &#8212; that code didn&#8217;t exactly format the way I would&#8217;ve liked. Help a brother out?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3736</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Wed, 11 Nov 2009 15:39:48 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3736</guid>
		<description>This is the sort of thing I mean:

&lt;pre&gt;&lt;code&gt;This is number one.
	This is number two.
	This is number three.
	This is number four.&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;$(document).ready(function() {
	$(&#039;.reversed&#039;).each(function() {
		var children = $(this).children(&#039;li&#039;).get();
		$(this).empty();
		children.reverse();
		
		$(this).append(children);
		
		$(children).each(function() {
			$(this).val(children.length - $(children).index(this));
		});
		
	});
});&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>This is the sort of thing I mean:</p>
<pre><code>This is number one.
	This is number two.
	This is number three.
	This is number four.</code></pre>
<pre><code>$(document).ready(function() {
	$('.reversed').each(function() {
		var children = $(this).children('li').get();
		$(this).empty();
		children.reverse();

		$(this).append(children);

		$(children).each(function() {
			$(this).val(children.length - $(children).index(this));
		});

	});
});</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tweets that mention Reversed Ordered List with jQuery &#124; Trevor Davis -- Topsy.com</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3735</link>
		<dc:creator>Tweets that mention Reversed Ordered List with jQuery &#124; Trevor Davis -- Topsy.com</dc:creator>
		<pubDate>Wed, 11 Nov 2009 14:43:29 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3735</guid>
		<description>[...] This post was mentioned on Twitter by Mike Lane, Dimox and Trevor Davis, Dimox. Dimox said: Reversed Ordered List with #jQuery - http://bit.ly/3aF6G2 [...]</description>
		<content:encoded><![CDATA[<p>[...] This post was mentioned on Twitter by Mike Lane, Dimox and Trevor Davis, Dimox. Dimox said: Reversed Ordered List with #jQuery &#8211; <a href="http://bit.ly/3aF6G2" rel="nofollow">http://bit.ly/3aF6G2</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3734</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Wed, 11 Nov 2009 13:53:07 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3734</guid>
		<description>I&#039;d suggest, as an alternative, actually reordering the items in the list as well as adding values, so that the meaning that&#039;s in the mark-up--that list of 1-10 items--is accurate, but simply presented in a different order than you&#039;ll accomplish via javascript.</description>
		<content:encoded><![CDATA[<p>I&#8217;d suggest, as an alternative, actually reordering the items in the list as well as adding values, so that the meaning that&#8217;s in the mark-up&#8211;that list of 1-10 items&#8211;is accurate, but simply presented in a different order than you&#8217;ll accomplish via javascript.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3733</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Wed, 11 Nov 2009 13:49:16 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3733</guid>
		<description>Sometimes it&#039;s the simple things in life. One of the things I love about jQuery is finding out how effortless and straightforward it is to do deeply satisfying things like this to one&#039;s code.

The only, very small, concern I have about this is that the meaning of the ordered list in so far as the mark-up is concerned is exactly opposite what you intend it to be. The javascript doesn&#039;t just enhance the presentation of the list, it flips the meaning. I&#039;m not sure how terribly concerned I am about the browsers that view our sites without javascript, but violating the philosophical separation of meaning:markup / behavior:script bothers me a little bit.</description>
		<content:encoded><![CDATA[<p>Sometimes it&#8217;s the simple things in life. One of the things I love about jQuery is finding out how effortless and straightforward it is to do deeply satisfying things like this to one&#8217;s code.</p>
<p>The only, very small, concern I have about this is that the meaning of the ordered list in so far as the mark-up is concerned is exactly opposite what you intend it to be. The javascript doesn&#8217;t just enhance the presentation of the list, it flips the meaning. I&#8217;m not sure how terribly concerned I am about the browsers that view our sites without javascript, but violating the philosophical separation of meaning:markup / behavior:script bothers me a little bit.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://trevordavis.net/blog/tutorial/reversed-ordered-list-jquery/#comment-3731</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Wed, 11 Nov 2009 05:22:47 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=2191#comment-3731</guid>
		<description>Cool. Just in time for the end of year &#039;best of&#039; lists to start up.</description>
		<content:encoded><![CDATA[<p>Cool. Just in time for the end of year &#8216;best of&#8217; lists to start up.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
