question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Color-stop matching fails with TypeError due to faulty regexp

See original GitHub issue

I’m seeing a TypeError when using color keywords (e.g. transparent, as opposed to rgb() values) since matching against the “step” regex in LinearGradientContainer will always return null in that case (see this line).

Can you please update the regexp to work as expected with both [a-z]+ color keywords as well as the rgb()/rgba() functional notation? Or would you be open to a pull request that does just that? (I can even add hsl()/hsla() support to the regexp, if you want…) Thanks!

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:29 (25 by maintainers)

github_iconTop GitHub Comments

2reactions
denizgokcecommented, Jun 17, 2019

@usmonster @niklasvh Hello guys I know this issue is closed but I am using the latest version of html2canvas and I am getting the same error in Chrome latest version but in Firefox it is working.

html2canvas.js:formatted:1377 Uncaught (in promise) TypeError: Cannot read property ‘1’ of null at LinearGradientContainer.<anonymous> (html2canvas.js:formatted:1377) at Array.map (<anonymous>) at new LinearGradientContainer (html2canvas.js:formatted:1374) at ImageLoader.loadImage (html2canvas.js:formatted:1256) at ImageLoader.<anonymous> (html2canvas.js:formatted:1227) at Array.forEach (<anonymous>) at ImageLoader.<anonymous> (html2canvas.js:formatted:1225) at Array.forEach (<anonymous>) at ImageLoader.findBackgroundImage (html2canvas.js:formatted:1219) at html2canvas.js:formatted:2563

0reactions
usmonstercommented, Dec 29, 2016

Hi @Observer999! This issue is closed. Please search for a similar open issue or create a new issue with a link to a page that reproduces the issue you’re having. (Please also specify there which version of Firefox you’ve tested in.) I can imagine it might have something to do with the TODOs in the code… Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

path-to-regexp not matching when passing arguments as ...
I've run into a odd problem. When I try to test if path-to-regexp will match a given path I will not get a...
Read more >
RegExp - JavaScript - MDN Web Docs - Mozilla
Chrome Edge RegExp Full support. Chrome1. Toggle history Full support. Edge12. Toggle history @@match Full support. Chrome50. Toggle history Full support. Edge13. Toggle history @@matchAll Full...
Read more >
path-to-regexp - npm
Start using path-to-regexp in your project by running `npm i ... (default: false ); end When true the regexp will match to the...
Read more >
43 Regular expressions ( RegExp ) - Exploring JS
One important use case for match indices are parsers that point to where exactly a syntactic error is located. The following code solves...
Read more >
Best Practices for Regular Expressions in .NET - Microsoft Learn
Text that matches the regular expression pattern. Text that doesn't match the regular ... To solve this problem, you can do the following:....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found