geuis/helium-css

helium.data.stylesheets is undefined

welpher opened this issue · 11 comments

cause helium.data.stylesheets.sort(); is not a function error

Browser?

chrome firefox all get this error

I copy a url, and click the button, redirect to the url I copied, when come back get this error

Hmm let me take a look

@ashepherd89 Strange, I wasn't able to replicate this before. Would it be possible to see a test case?

xeraa commented

Could the problem be that there are no CSS files?

I have a single page site and inline the CSS, so there are no references to CSS files. Getting the same error.

geuis commented

@xeraa ahh that might be it. Btw helium doesn't read inline css (since it looks for selectors and style="" on an element isn't something you select for) or style blocks declared on the page.

xeraa commented

@geuis yeah — I didn't find a tool that supported inlined CSS and gave up. Plus my HTML+CSS are a little over 17K gzipped, so it's probably not worth the trouble anyway ;)

But nice and simple script in general :)

geuis commented

@xeraa When you say "inline", do you mean this:

<div style="color: #fff; background: #000"></div>

Or this

<style>
  div {
    color: #fff;
    background: #000;
  }
</style>
xeraa commented

The second one; I'm not duplicating the styles, just avoiding a HTTP request (using https://github.com/kaiinui/middleman-inliner).

I'm pretty sure I was getting the same error:
"Uncaught ReferenceError: style is not defined"

--->
I added the following line:
var style = document.createElement('style');
before line 72

  var style = document.createElement('style');

  helium.$('body')[0].appendChild(style);
  helium.$('body')[0].appendChild(div);

.,. and I'm now getting the URL list box