<?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: CSS parser in Javascript</title>
	<atom:link href="http://bililite.nfshost.com/blog/2007/10/19/css-parser-in-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://bililite.nfshost.com/blog/2007/10/19/css-parser-in-javascript/</link>
	<description>Thoughts on web design and programming from a very occasional volunteer webmaster</description>
	<lastBuildDate>Fri, 03 Feb 2012 05:24:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Danny</title>
		<link>http://bililite.nfshost.com/blog/2007/10/19/css-parser-in-javascript/comment-page-1/#comment-3357</link>
		<dc:creator>Danny</dc:creator>
		<pubDate>Thu, 24 Feb 2011 01:46:29 +0000</pubDate>
		<guid isPermaLink="false">http://bililite.nfshost.com/blog/index.php/2007/10/19/css-parser-in-javascript/#comment-3357</guid>
		<description>@Pavel:
Your first solution is interesting: create a server-side CSS parser and generate a series of javascript statements to be included in the served file. Two downsides: you can&#039;t take different actions based on browser capabilities, like implementing CSS3 selectors: you&#039;d always rather use real CSS than javascript. It&#039;s faster, always &quot;live&quot; and can be undone just by changing the element&#039;s class. The other downside is including javascript in an HTML file can be quirky, with potentially non-validating symbols like &#039;&lt;&#039; and &#039;&amp;&#039;. You could generate a .js file as well, but things start getting real complicated. 
The second solution, not using a &lt;link rel=&quot;stylesheet&quot;... at all, just executing the javascript to create the link elements on the fly, would be far slower than having the browser read and implement the CSS itself.
In the end, the browser should cache the stylesheet so the second, AJAX, request for the file should take minimal time.
--Danny</description>
		<content:encoded><![CDATA[<p>@Pavel:<br />
Your first solution is interesting: create a server-side CSS parser and generate a series of javascript statements to be included in the served file. Two downsides: you can&#8217;t take different actions based on browser capabilities, like implementing CSS3 selectors: you&#8217;d always rather use real CSS than javascript. It&#8217;s faster, always &#8220;live&#8221; and can be undone just by changing the element&#8217;s class. The other downside is including javascript in an HTML file can be quirky, with potentially non-validating symbols like &#8216;&lt;&#039; and &#039;&amp;&#039;. You could generate a .js file as well, but things start getting real complicated.<br />
The second solution, not using a &lt;link rel=&quot;stylesheet&quot;&#8230; at all, just executing the javascript to create the link elements on the fly, would be far slower than having the browser read and implement the CSS itself.<br />
In the end, the browser should cache the stylesheet so the second, AJAX, request for the file should take minimal time.<br />
&#8211;Danny</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pavel</title>
		<link>http://bililite.nfshost.com/blog/2007/10/19/css-parser-in-javascript/comment-page-1/#comment-3356</link>
		<dc:creator>Pavel</dc:creator>
		<pubDate>Wed, 23 Feb 2011 23:48:37 +0000</pubDate>
		<guid isPermaLink="false">http://bililite.nfshost.com/blog/index.php/2007/10/19/css-parser-in-javascript/#comment-3356</guid>
		<description>Doh! &quot;You can include a &quot;[link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;my.css&quot;]&quot; tag...&quot;</description>
		<content:encoded><![CDATA[<p>Doh! &#8220;You can include a &#8220;[link rel="stylesheet" type="text/css" href="my.css"]&#8221; tag&#8230;&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pavel</title>
		<link>http://bililite.nfshost.com/blog/2007/10/19/css-parser-in-javascript/comment-page-1/#comment-3355</link>
		<dc:creator>Pavel</dc:creator>
		<pubDate>Wed, 23 Feb 2011 23:48:01 +0000</pubDate>
		<guid isPermaLink="false">http://bililite.nfshost.com/blog/index.php/2007/10/19/css-parser-in-javascript/#comment-3355</guid>
		<description>You can include a &quot;&quot; tag and initilize your JavaScript library with file_get_contents(&#039;my.css&#039;) on the server-side, so no double request at all.

On the client side you can request CSS by Ajax once, than parse it and dynamically generate rules and stylesheets without any second request. No double requests at all.</description>
		<content:encoded><![CDATA[<p>You can include a &#8220;&#8221; tag and initilize your JavaScript library with file_get_contents(&#8216;my.css&#8217;) on the server-side, so no double request at all.</p>
<p>On the client side you can request CSS by Ajax once, than parse it and dynamically generate rules and stylesheets without any second request. No double requests at all.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danny</title>
		<link>http://bililite.nfshost.com/blog/2007/10/19/css-parser-in-javascript/comment-page-1/#comment-1586</link>
		<dc:creator>Danny</dc:creator>
		<pubDate>Fri, 25 Jun 2010 04:48:19 +0000</pubDate>
		<guid isPermaLink="false">http://bililite.nfshost.com/blog/index.php/2007/10/19/css-parser-in-javascript/#comment-1586</guid>
		<description>@Ciantic:
Yes, that&#039;s a disadvantage (even more than the double request, the same-source security restrictions make it harder to use). But I don&#039;t see any way around that. I did complete the CSS parser (in &lt;a href=&quot;/blog/2009/01/16/jquery-css-parser/&quot; rel=&quot;nofollow&quot;&gt;this post&lt;/a&gt;).
--Danny</description>
		<content:encoded><![CDATA[<p>@Ciantic:<br />
Yes, that&#8217;s a disadvantage (even more than the double request, the same-source security restrictions make it harder to use). But I don&#8217;t see any way around that. I did complete the CSS parser (in <a href="/blog/2009/01/16/jquery-css-parser/" rel="nofollow">this post</a>).<br />
&#8211;Danny</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ciantic</title>
		<link>http://bililite.nfshost.com/blog/2007/10/19/css-parser-in-javascript/comment-page-1/#comment-1585</link>
		<dc:creator>Ciantic</dc:creator>
		<pubDate>Tue, 22 Jun 2010 07:50:21 +0000</pubDate>
		<guid isPermaLink="false">http://bililite.nfshost.com/blog/index.php/2007/10/19/css-parser-in-javascript/#comment-1585</guid>
		<description>You know, that is still very valid idea.

Only drawback is the double HTTP request for CSS files, first time normally and second time ajax.</description>
		<content:encoded><![CDATA[<p>You know, that is still very valid idea.</p>
<p>Only drawback is the double HTTP request for CSS files, first time normally and second time ajax.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

