dvtng / jss

JavaScript library for getting and setting CSS stylesheet rules
335 stars 54 forks source link

selectorText is case-sensitive #7

Open 4poc opened 12 years ago

4poc commented 12 years ago

First thanks for that lib! I had a problem jss not working at all, this was the problem: // Browsers report selectors in lowercase if (selector) selector = selector.toLowerCase();

"Browsers report selectors in lowercase", Are you sure that is true? I tested Opera, Firefox and Chromium it doesn't looks like it.

blq commented 12 years ago

I can confirm this is the case (Chrome 22).

barneycarroll commented 12 years ago

selectorText also strips redundant whitespace (eg returns), which causes a similar silent failure because JSS creates the rule and then iterates through the output stylesheet looking for a match with the raw input before assigning properties.

I see the wisdom of relying on native CSSOM for a lot of the crucial work, but when nuts & bolts methods break because their own internals are erroneous, it becomes a problem.

I think this could be forked such that the internal methods checked to cache the output selector they had created and match against that… It would also avoid later iteration, I think.