<?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: JavaScript and Selectors</title>
	<atom:link href="http://web-graphics.com/2006/05/12/javascript-and-selectors/feed/" rel="self" type="application/rss+xml" />
	<link>http://web-graphics.com/2006/05/12/javascript-and-selectors/</link>
	<description>Web development concerns, usually revolving around implimentation of designs into graphics, CSS, and HTML.</description>
	<pubDate>Thu, 24 Jul 2008 06:54:55 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: kredyt</title>
		<link>http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-31008</link>
		<dc:creator>kredyt</dc:creator>
		<pubDate>Tue, 18 Mar 2008 14:57:48 +0000</pubDate>
		<guid isPermaLink="false">http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-31008</guid>
		<description>Thanks for link form my site to you. 
thanks for really great article. Greetings</description>
		<content:encoded><![CDATA[<p>Thanks for link form my site to you.<br />
thanks for really great article. Greetings</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Londi</title>
		<link>http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-30993</link>
		<dc:creator>Londi</dc:creator>
		<pubDate>Tue, 18 Mar 2008 09:55:51 +0000</pubDate>
		<guid isPermaLink="false">http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-30993</guid>
		<description>Thank you for the good articles have helped me a lot.</description>
		<content:encoded><![CDATA[<p>Thank you for the good articles have helped me a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ann  Birret</title>
		<link>http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-14123</link>
		<dc:creator>Ann  Birret</dc:creator>
		<pubDate>Fri, 15 Jun 2007 13:09:57 +0000</pubDate>
		<guid isPermaLink="false">http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-14123</guid>
		<description>Thanks for this really interesting post. It appears really helpful for me. I would like to ask you if I could translate it and include it in our page, also with link to your page. Alternatively I would like to put link to your page on my section with interesting articles. If it would be possible to put this link on my page please email me. One more time thanks for really great article. Greetings</description>
		<content:encoded><![CDATA[<p>Thanks for this really interesting post. It appears really helpful for me. I would like to ask you if I could translate it and include it in our page, also with link to your page. Alternatively I would like to put link to your page on my section with interesting articles. If it would be possible to put this link on my page please email me. One more time thanks for really great article. Greetings</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lee, ChihCheng</title>
		<link>http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-773</link>
		<dc:creator>Lee, ChihCheng</dc:creator>
		<pubDate>Sat, 02 Sep 2006 17:03:52 +0000</pubDate>
		<guid isPermaLink="false">http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-773</guid>
		<description>Bug report:

If use UTF-8 charset, the tooltips will die.

for example, search the: BubbleTooltips.html  file, and change:

charset=iso-8859-1  -&#62;  utf-8

then , the ToolTips will not work.</description>
		<content:encoded><![CDATA[<p>Bug report:</p>
<p>If use UTF-8 charset, the tooltips will die.</p>
<p>for example, search the: BubbleTooltips.html  file, and change:</p>
<p>charset=iso-8859-1  -&gt;  utf-8</p>
<p>then , the ToolTips will not work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: liorean</title>
		<link>http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-351</link>
		<dc:creator>liorean</dc:creator>
		<pubDate>Tue, 27 Jun 2006 21:05:26 +0000</pubDate>
		<guid isPermaLink="false">http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-351</guid>
		<description>&lt;p&gt;Jeff: XPath potential algorithmical complexity is higher than selectors. Selectors matching can always be done unidirectionally, which is not true for XPath. So, selectors can be optimised harder than XPath. XPath has a worst case algorithmical complexity of O(&lt;var&gt;n&lt;/var&gt;&lt;sup&gt;&lt;var&gt;x&lt;/var&gt;&lt;/sup&gt;) for any value of &lt;var&gt;x&lt;/var&gt;. I'm not sure what the worts case algorithmical complexity of selectors might be, but given what I know about &lt;code&gt;NodeList&lt;/code&gt; traversal, I'd say O(&lt;var&gt;n&lt;/var&gt;&lt;sup&gt;2&lt;/sup&gt;) sounds likely.&lt;/p&gt;
&lt;p&gt;If you want to find elements matching a group of selectors in a given document: You can always go from the root, testing the first sequence of selectors in each selector towards the document root element and queue up testing that sequence of simple selectors against all elements in it's subtree. In case of a match, queue up testing the next sequence of simple selectors on the subtree of the matching element, excluding elements dependent on what combinator was used. This way, the traversal doesn't have to visit any node more than once. If the last sequence of simple selectors in one of the selectors matched, then the matching element is added to the list that is to be returned.&lt;/p&gt;
&lt;p&gt;If you want to find out whether a given element matches a certain group of selectors, you do it the opposite way. You test the element against the last sequence of simple selectors, and then you traverse backwards, towards the root, testing elements dependent on what combinator was used, until you've either run out of elements to test or you have found a match to the first sequence of simple selectors. If you have found a match, you abort the traversal and return &lt;code&gt;true&lt;/code&gt;. If you have run out of elements to test, you return &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;When I said that you only have to visit any given node once, I didn't take certain pseudo class, pseudo element or negation simple selectors into account. Either the testing for these can be done traversing backwards on each node, or it can be moved from the simple selectors testing into the traversal subtree exclusion by the code generator.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Jeff: XPath potential algorithmical complexity is higher than selectors. Selectors matching can always be done unidirectionally, which is not true for XPath. So, selectors can be optimised harder than XPath. XPath has a worst case algorithmical complexity of O(<var>n</var><sup><var>x</var></sup>) for any value of <var>x</var>. I&#8217;m not sure what the worts case algorithmical complexity of selectors might be, but given what I know about <code>NodeList</code> traversal, I&#8217;d say O(<var>n</var><sup>2</sup>) sounds likely.</p>
<p>If you want to find elements matching a group of selectors in a given document: You can always go from the root, testing the first sequence of selectors in each selector towards the document root element and queue up testing that sequence of simple selectors against all elements in it&#8217;s subtree. In case of a match, queue up testing the next sequence of simple selectors on the subtree of the matching element, excluding elements dependent on what combinator was used. This way, the traversal doesn&#8217;t have to visit any node more than once. If the last sequence of simple selectors in one of the selectors matched, then the matching element is added to the list that is to be returned.</p>
<p>If you want to find out whether a given element matches a certain group of selectors, you do it the opposite way. You test the element against the last sequence of simple selectors, and then you traverse backwards, towards the root, testing elements dependent on what combinator was used, until you&#8217;ve either run out of elements to test or you have found a match to the first sequence of simple selectors. If you have found a match, you abort the traversal and return <code>true</code>. If you have run out of elements to test, you return <code>false</code>.</p>
<p>When I said that you only have to visit any given node once, I didn&#8217;t take certain pseudo class, pseudo element or negation simple selectors into account. Either the testing for these can be done traversing backwards on each node, or it can be moved from the simple selectors testing into the traversal subtree exclusion by the code generator.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hax</title>
		<link>http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-326</link>
		<dc:creator>hax</dc:creator>
		<pubDate>Tue, 20 Jun 2006 06:02:33 +0000</pubDate>
		<guid isPermaLink="false">http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-326</guid>
		<description>XPath doesn't have pseudo-class and pseudo-element, and the syntax of CSS selectors is refined so it is more straightforward to write and understand. Of couse there are sth XPath can do but CSS selector not, eg. query a parent node as the pattern of descendants.</description>
		<content:encoded><![CDATA[<p>XPath doesn&#8217;t have pseudo-class and pseudo-element, and the syntax of CSS selectors is refined so it is more straightforward to write and understand. Of couse there are sth XPath can do but CSS selector not, eg. query a parent node as the pattern of descendants.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Schiller</title>
		<link>http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-306</link>
		<dc:creator>Jeff Schiller</dc:creator>
		<pubDate>Fri, 16 Jun 2006 17:43:08 +0000</pubDate>
		<guid isPermaLink="false">http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-306</guid>
		<description>Out of curiosity, assuming XML nodes, is there anything that can be done using CSS Selectors that cannot be done with an equivalent XPath expression?

Also, I'm not sure why you believe XPath would be slower, maybe I don't know enough about browser internals though...</description>
		<content:encoded><![CDATA[<p>Out of curiosity, assuming XML nodes, is there anything that can be done using CSS Selectors that cannot be done with an equivalent XPath expression?</p>
<p>Also, I&#8217;m not sure why you believe XPath would be slower, maybe I don&#8217;t know enough about browser internals though&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dustin Diaz</title>
		<link>http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-298</link>
		<dc:creator>Dustin Diaz</dc:creator>
		<pubDate>Thu, 15 Jun 2006 16:21:20 +0000</pubDate>
		<guid isPermaLink="false">http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-298</guid>
		<description>I don't have much to say except for the fact that having selector support would just be way cool for JavaScript. Having seen the growing number of cases of people wanting "getElementsBySelector" and $$(selector) and...well the list goes on; it would be down right logical to just implement a feature like that within the language.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t have much to say except for the fact that having selector support would just be way cool for JavaScript. Having seen the growing number of cases of people wanting &#8220;getElementsBySelector&#8221; and $$(selector) and&#8230;well the list goes on; it would be down right logical to just implement a feature like that within the language.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike McNally</title>
		<link>http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-179</link>
		<dc:creator>Mike McNally</dc:creator>
		<pubDate>Mon, 15 May 2006 21:08:49 +0000</pubDate>
		<guid isPermaLink="false">http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-179</guid>
		<description>I don't think there's much of a performance issue with selectors used for event listening, at least for events driven by mouse and keyboard happenings.  The only time the set of listening nodes is interesting is the point at which an event actually happens. Currently the browser can determine whether a node it's visiting has a handler by simply checking a pointer.  With selector-based registration, the browser would additionally need to match the nodes against the set of registered selectors. That doesn't seem so bad, as for any given page the number of such selectors shouldn't be that great, and the node vs. selector predicate would have to be fast anyway. It's not as if the browser has to check all the nodes on a page, because it knows already exactly what nodes to check for the event.

As to the idea of selectors being implemented as native Javascript language elements, I don't see what good that'd do as there are no other language elements against which a selector makes sense. In general Javascript does execute in the context of a DOM, but those elements are themselves not part of the language spec per se.  Thus it seems to me that definining the semantics for selectors requires references to things (like the way a node's parent is found) that are not part of the language per se, which seems pretty weird for a language element.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t think there&#8217;s much of a performance issue with selectors used for event listening, at least for events driven by mouse and keyboard happenings.  The only time the set of listening nodes is interesting is the point at which an event actually happens. Currently the browser can determine whether a node it&#8217;s visiting has a handler by simply checking a pointer.  With selector-based registration, the browser would additionally need to match the nodes against the set of registered selectors. That doesn&#8217;t seem so bad, as for any given page the number of such selectors shouldn&#8217;t be that great, and the node vs. selector predicate would have to be fast anyway. It&#8217;s not as if the browser has to check all the nodes on a page, because it knows already exactly what nodes to check for the event.</p>
<p>As to the idea of selectors being implemented as native Javascript language elements, I don&#8217;t see what good that&#8217;d do as there are no other language elements against which a selector makes sense. In general Javascript does execute in the context of a DOM, but those elements are themselves not part of the language spec per se.  Thus it seems to me that definining the semantics for selectors requires references to things (like the way a node&#8217;s parent is found) that are not part of the language per se, which seems pretty weird for a language element.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Corcoran</title>
		<link>http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-178</link>
		<dc:creator>Patrick Corcoran</dc:creator>
		<pubDate>Mon, 15 May 2006 17:45:08 +0000</pubDate>
		<guid isPermaLink="false">http://web-graphics.com/2006/05/12/javascript-and-selectors/#comment-178</guid>
		<description>I agree that the current state of affairs with regard to DOM manipulation is wanting.

But I don't really see the need to solve this problem by adding new layers of syntax and language extensions.  That to me is overkill.  If every problem were solved thus, JavaScript would ultimately end up as a worse syntactical mess than perl.  (With all due respect to perl... :)

The API needed to solve this problem is in my opinion a wrapper of utility classes.  Create a DOMSelector object, write an interpreted library for it that works across all browsers today, and then let the browser manufacturers internalize and optimize that in native code, all voluntarily and in good time.

I guess I just don't see the need to constantly formalize language extensions just to simplify the code of common design patterns.</description>
		<content:encoded><![CDATA[<p>I agree that the current state of affairs with regard to DOM manipulation is wanting.</p>
<p>But I don&#8217;t really see the need to solve this problem by adding new layers of syntax and language extensions.  That to me is overkill.  If every problem were solved thus, JavaScript would ultimately end up as a worse syntactical mess than perl.  (With all due respect to perl&#8230; :)</p>
<p>The API needed to solve this problem is in my opinion a wrapper of utility classes.  Create a DOMSelector object, write an interpreted library for it that works across all browsers today, and then let the browser manufacturers internalize and optimize that in native code, all voluntarily and in good time.</p>
<p>I guess I just don&#8217;t see the need to constantly formalize language extensions just to simplify the code of common design patterns.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
