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.

'Selector' option throws TypeError

See original GitHub issue

With the ‘selector’ option set to true using 6.0.0, the plugin throws the following error. This occurs even without any selectors being built with calc() in my stylesheets.

TypeError: Cannot read property 'charCodeAt' of undefined
  at module.exports (fakepath/node_modules/postcss-value-parser/lib/parse.js:17:21)
  at new ValueParser (fakepath/node_modules/postcss-value-parser/lib/index.js:7:22)
  at ValueParser (fakepath/node_modules/postcss-value-parser/lib/index.js:10:12)
  at exports.default (fakepath/node_modules/postcss-calc/node_modules/reduce-css-calc/dist/index.js:29:43)
  at transformValue (fakepath/node_modules/postcss-calc/dist/lib/transform.js:20:45)
  at fakepath/node_modules/postcss-calc/dist/lib/transform.js:36:19
  at fakepath/node_modules/postcss-selector-parser/dist/selectors/container.js:170:26
  at Selector.each (fakepath/node_modules/postcss-selector-parser/dist/selectors/container.js:153:22)
  at Selector.walk (fakepath/node_modules/postcss-selector-parser/dist/selectors/container.js:169:21)
  at fakepath/node_modules/postcss-selector-parser/dist/selectors/container.js:173:31

Running through the gulp-postcss 7.0.0, which is using PostCSS 6.0.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
wenkanglincommented, Jul 10, 2017

Thank you for answer. The first option is correct fix the issue for me. But we often inevitably encounter code like below:

button[disabled] {}

@mjschlot you should submit a pr and wait merged by author. 👍

1reaction
mjschlotcommented, Jul 9, 2017

The issue appears to be related to selectors like: abbr[title] This situation exists in packages like normalize.css (https://github.com/necolas/normalize.css/blob/master/normalize.css).

Possible fix would be to test if node.value is undefined in transform.js if (node.type === 'attribute' && node.value !== undefined) {

I’m not familiar enough with postcss to know if this is the best fix though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Type error for options and style base for react-select
When I define my type for the options using a custom interface, the Select component throws a type error. I searched online for...
Read more >
TypeError - JavaScript - MDN Web Docs
A TypeError may be thrown when: an operand or argument passed to a function is incompatible with the type expected by that operator...
Read more >
How to Fix 'cannot set properties of null' Errors in JS - Webtips
This will throw Uncaught TypeError: Cannot set properties of null (setting 'value') const input = null input.value = 'new value'.
Read more >
How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript error TypeError: "x" is not a function occurs when there is an attempt to call a function on a value or...
Read more >
Resolving the JavaScript Promise Error "TypeError: Cannot ...
TypeError - Cannot read property 'then' of undefined is thrown when the caller is expecting a Promise to be returned and instead receives ......
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