<?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: Dynamic CSS pseudo class styles with jQuery</title>
	<atom:link href="http://www.4pmp.com/2009/11/dynamic-css-pseudo-class-styles-with-jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.4pmp.com/2009/11/dynamic-css-pseudo-class-styles-with-jquery/</link>
	<description>PHP, MySQL, C, Java, Linux and other great after dinner speech topics</description>
	<lastBuildDate>Sat, 21 Jan 2012 20:07:22 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
	<item>
		<title>By: Nick</title>
		<link>http://www.4pmp.com/2009/11/dynamic-css-pseudo-class-styles-with-jquery/comment-page-1/#comment-161</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Sat, 02 Jan 2010 20:51:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.4pmp.com/?p=166#comment-161</guid>
		<description>Thanks for that, the source has been updated :-)</description>
		<content:encoded><![CDATA[<p>Thanks for that, the source has been updated <img src='http://www.4pmp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vishal Vasani</title>
		<link>http://www.4pmp.com/2009/11/dynamic-css-pseudo-class-styles-with-jquery/comment-page-1/#comment-151</link>
		<dc:creator>Vishal Vasani</dc:creator>
		<pubDate>Mon, 28 Dec 2009 14:56:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.4pmp.com/?p=166#comment-151</guid>
		<description>Hello,

There an error in your StyleSheet.001.js. download file and demo also...
            // IE
            var rules = sh.compileToRules();

replace above line with below
           // IE
            var rules = styleSheet.compileToRules();</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>There an error in your StyleSheet.001.js. download file and demo also&#8230;<br />
            // IE<br />
            var rules = sh.compileToRules();</p>
<p>replace above line with below<br />
           // IE<br />
            var rules = styleSheet.compileToRules();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://www.4pmp.com/2009/11/dynamic-css-pseudo-class-styles-with-jquery/comment-page-1/#comment-110</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Sun, 22 Nov 2009 20:31:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.4pmp.com/?p=166#comment-110</guid>
		<description>If you move the instantiation of the StyleSheet object outside the function then it will be in the global namespace.   This will allow you to consecutively call the function with different tags, updating the same StyleSheet object and therefore not overriding the previous style each time you call the function.

Something like:

var sheet = new StyleSheet();

function create_sheet(whichtag) {

    // Create a CSS element to set colour to red
    var elementBasic = new StyleSheetElement(&quot;color&quot;, &quot;#000000&quot;);

    // Attach the CSS element to the CSS description for “a”
    var tagA = sheet.addElementToTag(whichtag, elementBasic);

    // Rest of your code carries on....
    
}</description>
		<content:encoded><![CDATA[<p>If you move the instantiation of the StyleSheet object outside the function then it will be in the global namespace.   This will allow you to consecutively call the function with different tags, updating the same StyleSheet object and therefore not overriding the previous style each time you call the function.</p>
<p>Something like:</p>
<p>var sheet = new StyleSheet();</p>
<p>function create_sheet(whichtag) {</p>
<p>    // Create a CSS element to set colour to red<br />
    var elementBasic = new StyleSheetElement(&#8220;color&#8221;, &#8220;#000000&#8243;);</p>
<p>    // Attach the CSS element to the CSS description for “a”<br />
    var tagA = sheet.addElementToTag(whichtag, elementBasic);</p>
<p>    // Rest of your code carries on&#8230;.</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: clive</title>
		<link>http://www.4pmp.com/2009/11/dynamic-css-pseudo-class-styles-with-jquery/comment-page-1/#comment-109</link>
		<dc:creator>clive</dc:creator>
		<pubDate>Sun, 22 Nov 2009 16:38:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.4pmp.com/?p=166#comment-109</guid>
		<description>hi - I am passing a parameter to fn which is fine
$(create_sheet(&quot;li&quot;));

I would like to add $(create_sheet(&quot;a&quot;));
so both apply - is this possible?

code below....

function create_sheet(whichtag) {
var sheet = new StyleSheet();

// Create a CSS element to set colour to red
var elementBasic = new StyleSheetElement(&quot;color&quot;, &quot;#000000&quot;);

// Attach the CSS element to the CSS description for &quot;a&quot;
var tagA = sheet.addElementToTag(whichtag, elementBasic);

// Set the order of the tag for &quot;a&quot;  whichtag
tagA.order = 2;

// Create a CSS element to set colour to red
var elementHover = new StyleSheetElement(&quot;color&quot;, &quot;#ff0000&quot;);

// Attach the CSS element to the CSS description for &quot;a:hover&quot;

var tagHover = sheet.addElementToTag(whichtag + &quot;:hover&quot;, elementHover);

// Set the order of the tag for &quot;a:hover&quot;, will appear beore &quot;a&quot;
tagHover.order = 1;

// Create a stylesheet for the new elements and add it to the page (replaces it if one already exists)
addInlineStyleSheet(sheet);
}</description>
		<content:encoded><![CDATA[<p>hi &#8211; I am passing a parameter to fn which is fine<br />
$(create_sheet(&#8220;li&#8221;));</p>
<p>I would like to add $(create_sheet(&#8220;a&#8221;));<br />
so both apply &#8211; is this possible?</p>
<p>code below&#8230;.</p>
<p>function create_sheet(whichtag) {<br />
var sheet = new StyleSheet();</p>
<p>// Create a CSS element to set colour to red<br />
var elementBasic = new StyleSheetElement(&#8220;color&#8221;, &#8220;#000000&#8243;);</p>
<p>// Attach the CSS element to the CSS description for &#8220;a&#8221;<br />
var tagA = sheet.addElementToTag(whichtag, elementBasic);</p>
<p>// Set the order of the tag for &#8220;a&#8221;  whichtag<br />
tagA.order = 2;</p>
<p>// Create a CSS element to set colour to red<br />
var elementHover = new StyleSheetElement(&#8220;color&#8221;, &#8220;#ff0000&#8243;);</p>
<p>// Attach the CSS element to the CSS description for &#8220;a:hover&#8221;</p>
<p>var tagHover = sheet.addElementToTag(whichtag + &#8220;:hover&#8221;, elementHover);</p>
<p>// Set the order of the tag for &#8220;a:hover&#8221;, will appear beore &#8220;a&#8221;<br />
tagHover.order = 1;</p>
<p>// Create a stylesheet for the new elements and add it to the page (replaces it if one already exists)<br />
addInlineStyleSheet(sheet);<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

