filamentgroup / criticalCSS

Finds the Above the Fold CSS for your page, and outputs it into a file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getRules returns rules lowercased

BradleyStaples opened this issue · comments

Our CSS uses camelCased selectors, but the stdout outputted from critical.js > getRules() returns all lowercased selectors, so the majority of our CSS fails to match in the window.document.querySelector() statement in criticalrunner.js.

I'm unsure if this is something from phantomJS or what else is the source cause of the issue at this point.

Thinking this is a phantomJS bug, although I'm not 100% sure. In case it is, I opened an issue over there as well. ariya/phantomjs#13197

This is still going on in the CLI version as of 2016. Are there any plans to fix this?

Just been bitten by this, wondered for ages why my form (ID ending in "Form") had lost its critical style :)

FYI to all here I just submitted a PR to fix this issue. The problem was that the DOM API to pull the styles will for some reason always be lower case unless you include the HTML5 doctype in the document:

<!DOCTYPE html>
<html>
  ...
</html>