# Csspool 0.2.0 Released

**URL:** <https://www.ruby-forum.com/t/csspool-0-2-0-released/121601>\
**Category:** Ruby\
**Created:** [November 29, 2007, 7:16am UTC](https://www.ruby-forum.com/t/csspool-0-2-0-released/121601 "2007-11-29T07:16:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aaronpowell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7bcc69/32.png) [@aaronpowell](https://www.ruby-forum.com/u/aaronpowell)\
**Post date:** [November 29, 2007, 7:16am UTC](https://www.ruby-forum.com/t/csspool-0-2-0-released/121601/1 "2007-11-29T07:16:01Z")

</div>

Gossip Girl says:

csspool version 0.2.0 has been released!

- [http://csspool.rubyforge.org/](http://csspool.rubyforge.org/)

CSSpool (pronounced “cesspool”) is a validating SAC parser for CSS. The  
parser  
calls methods on a document handler depending on what it has found.  
CSSPool  
currently only supports CSS 2.1. CSSPool will not yield invalid  
properties or  
selectors.

Changes:

## 0.2.0

- Added CSS::SAC::Parser#parse\_rule to parse a single rule.

- Added CSS::StyleSheet#find\_rule for finding a particular rule.

- Added CSS::StyleSheet#rules\_matching for finding all rules matching a  
node.

- Added CSS::StyleSheet#create\_rule for creating a new rule.

- Added CSS::StyleSheet#find\_all\_rules\_matching for finding all rules  
that match  
any node in the passed in document.

- Added .eql? to selector AST

- Added .hash to selector AST

- Added .eql? to LexicalUnits

- Added .hash to LexicalUnits

- Added CSS::StyleSheet#to\_css

- Added CSS::StyleSheet#reduce!

- CSS::StyleSheet is now the default document handler

- [http://csspool.rubyforge.org/](http://csspool.rubyforge.org/)

This is a tenderlovemaking dot com joint.

---

<div class="post-metadata">

**Author:** ![aaronpowell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7bcc69/32.png) [@aaronpowell](https://www.ruby-forum.com/u/aaronpowell)\
**Post date:** [November 29, 2007, 8:28am UTC](https://www.ruby-forum.com/t/csspool-0-2-0-released/121601/2 "2007-11-29T08:28:30Z")

</div>

On 11/29/07, Aaron P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [Snip]  
> Hi Aaron,

Long time listener, first time caller… Love the show, btw.

I’ve been toying around with the lib and I noticed some issues:

- the Manifest tends to contain a .DS\_Store entry which crashes rake  
package so rake install\_gem (the way i usually install csspool) fails  
with: “Don’t know how to build task ‘.DS\_Store’”.

- the example on the homepage doesn’t work for me. I get  
“uninitialized constant CSS::SAC::Parse (NameError)” when I try to run  
it. However, the earlier examples, which show inheriting from  
CSS::SAC::DocumentHandler work for me, if i also add a “require  
‘rubygems’” first

- the following css breaks css breaks the parser and makes it ignore  
all rules and declarations after the error. In css, with browsrs at  
least, an error should just ignore the respective property or  
properties, so I was expecting similar behaviour. I’ll try to get my  
hands into the ragel stuff, but this might take a while since I  
haven’t done any before, saw a presentation at euruko, tho :).

So, the bad css that’s preventing me from getting a pink background  
and a blue p:  
a { color: red; }  
body { border: solid 1px; #000; color: pink; }  
p { color: blue; }

> This is a tenderlovemaking dot com joint.
> 
> –  
> Aaron P.  
> [http://tenderlovemaking.com/](http://tenderlovemaking.com/)

Again, thanks a lot for this project, it’s looking really cool and  
useful :).

Cheers,  
Cristi

---

<div class="post-metadata">

**Author:** ![aaronpowell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7bcc69/32.png) [@aaronpowell](https://www.ruby-forum.com/u/aaronpowell)\
**Post date:** [November 29, 2007, 1:12pm UTC](https://www.ruby-forum.com/t/csspool-0-2-0-released/121601/3 "2007-11-29T13:12:36Z")

</div>

On Nov 29, 2007, at 1:27 AM, Cristi BALAN wrote:

> > found. CSSPool
> 
> - the following css breaks css breaks the parser and makes it ignore  
> p { color: blue; }
> 
> >

Problem here is bad CSS.  
you have:

> body { border: solid 1px; #000; color: pink; }  
> which could also be this with more space:  
> body {  
> border: solid 1px; /\* this border will default to black, but perhaps  
> you intended the #000 to be in this line notice your extra  
> semicolon … _/  
> #000; /_ no property listed! _/  
> color: pink; /_ this gives you pink text \*/  
> }

When you don’t make it so tightly compact, you can see the mistake, I  
hope. Nothing there is going to give you a pink background.  
you need to put:  
background-color: pink;  
Inside of either declaration body or p.

---

<div class="post-metadata">

**Author:** ![aaronpowell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7bcc69/32.png) [@aaronpowell](https://www.ruby-forum.com/u/aaronpowell)\
**Post date:** [November 29, 2007, 7:50pm UTC](https://www.ruby-forum.com/t/csspool-0-2-0-released/121601/4 "2007-11-29T19:50:07Z")

</div>

On 11/29/07, John J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > CSSpool (pronounced “cesspool”) is a validating SAC parser for  
> > > Long time listener, first time caller… Love the show, btw.  
> > > haven’t done any before, saw a presentation at euruko, tho :).  
> > > you have:  
> > > When you don’t make it so tightly compact, you can see the mistake, I  
> > > hope. Nothing there is going to give you a pink background.  
> > > you need to put:  
> > > background-color: pink;  
> > > Inside of either declaration body or p.

Hi John,

Yes, and the error is there on purpose.

I was reporting a bug in the way such errors are handled by the  
csspool parser. Instead of just skipping the declarations you  
correctly noticed in the css, it stops parsing the rest of the css  
file.

I would have expected the color: pink for body and p { color: blue; }  
to get parsed in spite of the error.

Cristi

---

<div class="post-metadata">

**Author:** ![aaronpowell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7bcc69/32.png) [@aaronpowell](https://www.ruby-forum.com/u/aaronpowell)\
**Post date:** [November 30, 2007, 1:13pm UTC](https://www.ruby-forum.com/t/csspool-0-2-0-released/121601/5 "2007-11-30T13:13:44Z")

</div>

On Nov 29, 2007, at 12:49 PM, Cristi BALAN wrote:

> > > > 
> > > 
> > > hands into the ragel stuff, but this might take a while since I  
> > > Problem here is bad CSS.  
> > > }  
> > > Yes, and the error is there on purpose.
> 
> –  
> Cristi BALAN  
> [http://evil.che.lu/](http://evil.che.lu/)

Oops, sorry for the noise then!!  
I’m always amazed at browsers parsing css so quickly anyway.  
Even more amazed that they usually get it right. (well not all of them)

---

<div class="post-metadata">

**Author:** ![aaronpowell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7bcc69/32.png) [@aaronpowell](https://www.ruby-forum.com/u/aaronpowell)\
**Post date:** [November 30, 2007, 3:29am UTC](https://www.ruby-forum.com/t/csspool-0-2-0-released/121601/6 "2007-11-30T03:29:10Z")

</div>

On Thu, Nov 29, 2007 at 04:27:39PM +0900, Cristi BALAN wrote:

> > selectors.  
> > with: “Don’t know how to build task ‘.DS\_Store’”.  
> > Doh. I don’t know why that is there. I’ll remove it and release again.

> - the example on the homepage doesn’t work for me. I get  
> “uninitialized constant CSS::SAC::Parse (NameError)” when I try to run  
> it. However, the earlier examples, which show inheriting from  
> CSS::SAC::DocumentHandler work for me, if i also add a “require  
> ‘rubygems’” first

Yes, because I made a typo. Try CSS::SAC::Parser.

> a { color: red; }  
> body { border: solid 1px; #000; color: pink; }  
> p { color: blue; }

Great! Thanks for the test case. I’ll add that to my test suite and  
get it working.

> Again, thanks a lot for this project, it’s looking really cool and useful :).  
> Thanks. Keep the bugs coming, I need them to make it mo betta.
