postcss / postcss-color-function

PostCSS plugin to transform W3C CSS color function to more compatible CSS
MIT License
323 stars 31 forks source link

Fix similar names conflicts #12

Closed demiazz closed 9 years ago

demiazz commented 9 years ago

Hi, @MoOx!

I find bug in postcss-color-function when use my own project-only plugin, which process hover-color(<color>) patterns. postcss-color-function find color in hover-color definition, and process them. For example:

/* before */
.example { color: hover-color(red); }

/* after */
.example { color: hover-rgb(255, 0, 0); }

I fix checks in postcss-color-function and add additional test cases in fixtures.

demiazz commented 9 years ago

@MoOx, I update PR with your recommendations.

demiazz commented 9 years ago

@MoOx I revert all changes about test in begin of transformDecl, and add indexOf.

I write simple benchmark for String#indexOf and RegExp#test for our case. On node.js String#indexOf slower than RegExp#test. But, on io.js RegExp#test slower than String#indexOf.

This is my small benchmark: https://gist.github.com/demiazz/b82fd832327367ceba04