<?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>BorkWeb &#187; selector</title>
	<atom:link href="http://borkweb.com/story/tag/selector/feed" rel="self" type="application/rss+xml" />
	<link>http://borkweb.com</link>
	<description>Some People Are Squirrel Handed.</description>
	<lastBuildDate>Tue, 17 Jan 2012 22:00:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>CSS Selector Browser Support</title>
		<link>http://borkweb.com/story/css-selector-browser-support</link>
		<comments>http://borkweb.com/story/css-selector-browser-support#comments</comments>
		<pubDate>Tue, 28 Oct 2008 19:13:03 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[development css3]]></category>
		<category><![CDATA[reference]]></category>
		<category><![CDATA[selector]]></category>

		<guid isPermaLink="false">http://borkweb.com/?p=641</guid>
		<description><![CDATA[As many web developers know, CSS support is highly varied amongst browsers. I often find myself hunting for which selectors are more heavily supported. As such, I thought I&#8217;d post a direct link to a quality resource here so I wouldn&#8217;t have to hunt anywhere besides on BorkWeb. Here&#8217;s some decent resources: CSS selector and [...]]]></description>
			<content:encoded><![CDATA[<p>As many web developers know, <a href="http://en.wikipedia.org/wiki/Cascading_Style_Sheets">CSS</a> support is highly varied amongst browsers.  I often find myself hunting for which selectors are more heavily supported.  As such, I thought I&#8217;d post a direct link to a quality resource here so I wouldn&#8217;t have to hunt anywhere besides on BorkWeb.</p>
<p>Here&#8217;s some decent resources:</p>
<ul>
<li><a href="http://kimblim.dk/csstest/">CSS selector and pseudo element support</a> from kimblim.dk.  The format on this page is a bit odd, and it lacks granular details on older browsers.</li>
<li>The <a href="http://dev.l-c-n.com/CSS3-selectors/browser-support.php">browser support charts</a> at dev.l-c-n.com are more detailed but a bit stale.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://borkweb.com/story/css-selector-browser-support/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Speeding Up Prototype&#8217;s $$ Selector</title>
		<link>http://borkweb.com/story/speeding-up-prototypes-selector</link>
		<comments>http://borkweb.com/story/speeding-up-prototypes-selector#comments</comments>
		<pubDate>Thu, 29 Jun 2006 16:06:48 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[MasterWish]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[selector]]></category>
		<category><![CDATA[silvain zimmer]]></category>

		<guid isPermaLink="false">http://borkweb.com/story/speeding-up-prototypes-selector</guid>
		<description><![CDATA[Prototype, as I&#8217;ve stated in the past, is our Javascript library of choice for Ajax at Plymouth State University and in the current re-writing of MasterWish. As of version 1.5 of Prototype there has been a sweet Selector function $$ which is best used when manipulating more than one dom element of the same type&#8230;i.e. [...]]]></description>
			<content:encoded><![CDATA[<p><img align="left" class="post_image" alt="prototype.gif" src="http://www.borkweb.com/wp-content/uploads/2006/02/prototype.gif" id="image172" style=""/> <a href="http://borkweb.com/story/prototype-makes-javascript-painless">Prototype</a>, as I&#8217;ve stated in the past, is our Javascript library of choice for Ajax at <a href="http://plymouth.edu">Plymouth State University</a> and in the <a href="http://borkweb.com/story/practicing-what-i-preach">current re-writing</a> of <a href="http://masterwish.com">MasterWish</a>.  As of version 1.5 of Prototype there has been a sweet Selector function <strong>$$</strong> which is best used when manipulating more than one dom element of the same type&#8230;i.e. updating all buddies in a buddy list at <a href="http://masterwish.com">MasterWish</a> with some property.</p>
<p>Here&#8217;s a simple example that we use at MasterWish:</p>
<pre class="brush: jscript; title: ; notranslate">
mw_b.prototype.checkAll = function()
  {
    $$('.buddy_checkbox').each(function(e){e.checked=true;});
  };
</pre>
<p>All that example does is iterates over all elements in the DOM that have the class <strong>buddy_checkbox</strong> and sets their checked value to true.  Short and sweet.  However, with version 1.5 of Prototype, it could be dog slow at times with more complex selector queries.</p>
<p>I was ecstatic when I found (<a href="http://ajaxian.com/archives/speeing-up-prototypes-selector">via Ajaxian</a>) that <a href="http://www.sylvainzimmer.com/index.php/archives/2006/06/25/speeding-up-prototypes-selector/">Sylvain Zimmer</a> has sped up the $$ function quite a bit.  I implemented it in the test area of MasterWish and have been very pleased with the results!  Here&#8217;s what Sylvain has to say on his mod:</p>
<blockquote><p>
Prototype’s current code is quite elegant (as always!) but very slow, so I wrote an add-on that makes this function up to 20 times faster in most usual cases (tested on IE6, Firefox 1.5 and Opera).</p>
<p>[...]</p>
<p>Here are the main ideas of this add-on :</p>
<ul>
<li>Forwarding the call to the old $$ if the selector expression is too complicated (currently : if it uses attributes)</li>
<li>Replacing regular expressions with a simple parser</li>
<li>Minimizing the number of operations done on each iteration.</li>
<li>Trying to use getDocumentById() instead of getDocumentByTagName() when possible.</li>
<li>Avoiding recursive functions with return values.</li>
<li>Not being afraid of some “old-style” code if it speeds up the execution ;-)</li>
</ul>
</blockquote>
<p>All you need do is <a href="http://www.sylvainzimmer.com/index.php/archives/2006/06/25/speeding-up-prototypes-selector/">get his mod</a> and include it in a script tag <em>after</em> the Prototype inclusion.  Simple as that!</p>
]]></content:encoded>
			<wfw:commentRss>http://borkweb.com/story/speeding-up-prototypes-selector/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oooo  event:Selectors for Prototype</title>
		<link>http://borkweb.com/story/oooo-eventselectors-for-prototype</link>
		<comments>http://borkweb.com/story/oooo-eventselectors-for-prototype#comments</comments>
		<pubDate>Wed, 22 Mar 2006 04:25:56 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[event selectors]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Justin Palmer]]></category>
		<category><![CDATA[onclick]]></category>
		<category><![CDATA[onmouseover]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[selector]]></category>
		<category><![CDATA[selectors]]></category>

		<guid isPermaLink="false">http://borkweb.com/story/oooo-eventselectors-for-prototype</guid>
		<description><![CDATA[My article on the Separation of Layout and Logic touched on a key point of heavy Javascript use in an Ajax rich environment&#8230;the need for separation of Javascript code &#8211; namely events &#8211; from the HTML. Behaviour was my suggested CSS/Javascript event selector framework. Behaviour is a stand-alone event framework. You can use it regardless [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/borkweb/116186426/" title="Photo Sharing"><img src="http://static.flickr.com/19/116186426_157720600c_o.gif" alt="event_selectors" align="left" class="post_image"/></a>My article on the <a href="http://borkweb.com/story/ajax-templating-and-the-separation-of-layout-and-logic">Separation of Layout and Logic</a> touched on a key point of heavy Javascript use in an Ajax rich environment&#8230;the need for separation of Javascript code &#8211; namely events &#8211; from the HTML.  Behaviour was my suggested CSS/Javascript event selector framework.  </p>
<p>Behaviour is a stand-alone event framework.  You can use it regardless of whether or not you are using <a href="http://borkweb.com/story/prototype-makes-javascript-painless">Prototype</a> (or some other Ajax/Javascript library) &#8211; which is pretty cool.  But&#8230;if you <em>are</em> using Prototype there is a lot of code duplication between the two libraries.  Luckily, <a href="http://mir.aculo.us/articles/2006/03/21/event-selectors-for-prototype">Mir.aculo.us</a> has brought <a href="http://mir.aculo.us/articles/2006/03/21/event-selectors-for-prototype">event:Selectors</a> to my attention which is causing me to sing a different tune!  Justin Palmer, <a href="http://encytemedia.com/event-selectors/">event:Selector&#8217;s</a> creator is crediting Behaviour for the idea, but he&#8217;s has what Behaviour has done a few steps further.</p>
<ul>
<li>event:Selectors is dependant on Prototype which <strong>reduces code duplication</strong>.</li>
<li>It has <strong>reduced the layer of complexity</strong> of event selecting by one layer of abstraction.</li>
<li>The framework allows <strong>concatenation of CSS elements</strong> for event assignment.</li>
<li>Lastly, its added a <strong>loaded</strong> event that is triggered when an element loads.</li>
</ul>
<p>Here&#8217;s an example of Behaviour event handlining:</p>
<pre class="brush: jscript; title: ; notranslate">
  var rules = {
    '#item li': function(element) {
      Event.observe(element, 'click', function(event) {
        var element = Event.element(element);
        element.setStyle('color': '#c00');
      });
    },

    '#otheritem li': function(element) {
      Event.observe(element, 'click', function(event) {
        var element = Event.element(element);
        element.setStyle('color': '#c00');
      });
    }
  };
  Behaviour.register(rules);
</pre>
<p>Here&#8217;s the equivalent in event:Selectors:</p>
<pre class="brush: jscript; title: ; notranslate">
  var Rules = {
    '#item li:click, #otheritem li:click': function(element) {
      element.setStyle('color': '#c00');
    }
  };

EventSelectors.start(Rules);
</pre>
<p>Simplification makes me happy.  I&#8217;m a convert.</p>
]]></content:encoded>
			<wfw:commentRss>http://borkweb.com/story/oooo-eventselectors-for-prototype/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

