Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linear-gradient and multiple background #14

Closed
fabianonunes opened this issue May 29, 2011 · 7 comments
Closed

linear-gradient and multiple background #14

fabianonunes opened this issue May 29, 2011 · 7 comments

Comments

@fabianonunes
Copy link

a error has been throwed out when I set multiple background with "linear-gradient" mixin.
example:

body
    background linear-gradient(top, rgba(black, 0.8), rgba(white, 0.8)), url("/images/pattern.gif")

exception:
RangeError: /home/fabiano/workdir/smx/node_modules/nib/lib/nib/gradients.styl:105
104| linear-gradient(start, stops...)

105| error('color stops required') unless length(stops)
106| prop = current-property[0]
107| val = current-property[1]
108| stops = normalize-stops(stops)

@superstructor
Copy link
Contributor

Thanks for the bug report fabianonunes.

I had a look at this and can confirm the issue. It appears that any variation of multiple backgrounds causes the linear-gradient mixin to be called recursively around 200 times until the max call stack size is exceeded.

Tentatively I suspect the issue is caused by current-property on lines ~106-107. The error does not occur if the current-property lines and dependant add-property lines are commented.

I'm not sure yet if the fix needs to be around Evaluator.prototype.propertyExpression in Stylus itself or in changing the way the mixin is written in nib.

TJ will know far more than I do about this stuff. I'll have another look at it in about a day and fire up a debugger to see exactly whats going on if he hasn't fixed it already =)

Cheers

@tj
Copy link
Collaborator

tj commented May 30, 2011

hmm looks fine, I'll have to take a look

@ianstormtaylor
Copy link
Contributor

+1 this issue,

with this pair:

#songs-search-form-input
    background: url('/public/images/icons/search_red.png') no-repeat 5px 2px, linear-gradient(top, #0a0a0a, #161616)`

and the same error:

RangeError: /Users/Storm/ethertunes/src/webapp/public/public/stylesheets/nib/gradients.styl:105
104| linear-gradient(start, stops...)
 > 105|   error('color stops required') unless length(stops)
   106|   prop = current-property[0]
   107|   val = current-property[1]
   108|   stops = normalize-stops(stops)

@alexandertrefz
Copy link

+1 by me too. Any multiple background with linear-gradient breaks atm.

@RwwL
Copy link

RwwL commented Dec 29, 2011

Another +1; would love to see this supported by nib.

@tj
Copy link
Collaborator

tj commented Dec 29, 2011

i'll have to check this out again, there was a bug in stylus when commas were involved

@tj tj closed this as completed in cefffe4 Dec 29, 2011
@kizu
Copy link
Member

kizu commented Apr 14, 2012

@visionmedia It seems, that only the case with background-color is fixed, but when I try something like this:

body
  background: linear-gradient(top, white, black), linear-gradient(top, black, white)

I get this error:

   104|  */
   105| 
   106| linear-gradient(start, stops...)
   107|   error('color stops required') unless length(stops)
 > 108|   prop = current-property[0]
   109|   val = current-property[1]
   110|   stops = normalize-stops(stops)
   111| 

cannot perform null[(0)]
    at "body" (test/cases/linear-gradient.styl:25)

So, actually, this issue is not fixed now :(

kizu added a commit to kizu/nib that referenced this issue Aug 13, 2012
…ear gradient; prepared the linear gradient to be available in vendor-prefixed properties like border-image; actually fixes stylus#14; fixes stylus#71
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants