helium-css icon indicating copy to clipboard operation
helium-css copied to clipboard

helium.data.stylesheets is undefined

Open welpher opened this issue 9 years ago • 11 comments

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

welpher avatar Nov 21 '14 06:11 welpher

Browser?

geuis avatar Nov 26 '14 01:11 geuis

chrome firefox all get this error

welpher avatar Nov 26 '14 01:11 welpher

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

welpher avatar Nov 26 '14 02:11 welpher

Hmm let me take a look

geuis avatar Nov 26 '14 02:11 geuis

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

geuis avatar Apr 28 '15 20:04 geuis

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.

xeraa avatar Jul 18 '15 21:07 xeraa

@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.

geuis avatar Jul 19 '15 23:07 geuis

@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 :)

xeraa avatar Jul 19 '15 23:07 xeraa

@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>

geuis avatar Jul 20 '15 18:07 geuis

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

xeraa avatar Jul 20 '15 19:07 xeraa

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

develophelbetica avatar Jul 22 '15 21:07 develophelbetica