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.

rules skipped due to selector errors: legend+* -> Cannot read property 'type' of undefined

See original GitHub issue

Bug description:

When building angular using the production configuration, the step Generating index html... produces following warning: 1 rules skipped due to selector errors: legend+* -> Cannot read property 'type' of undefined

See this screenshot: image

Reproduction Steps

In Terminal using Angular CLI:

ng new testproject --style scss
cd testproject
ng add @ng-bootstrap/ng-bootstrap
npm run build

Versions

Critters: 0.0.16

Angular: 13.3.0 - 13.3.2

ng-bootstrap: 12.0.2

Bootstrap: 5.1.3

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:13
  • Comments:18 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
PowerKiKicommented, Aug 8, 2022

I’ve had a closer look at this bug, and I now think it comes from an incompatibility between parse5 which is used to parse HTML and css-select that is used to query CSS selectors. The document model is entirely different, and thus css-select try to access properties that never exist (node.prev).

It seems the most obvious solution would be to replace parse5 with htmlparser2, because it is part of the same ecosystem as css-select. However that also means that the DOM mutation must be ported to something else, most likely to domutils, and the same goes for the DOM serialization where the obvious choice would be dom-serializer.

All of that is a rather significant amount of work, and quite risky. It would probably be best if someone who know this codebase well would do it (instead of me)…

3reactions
Rarstcommented, Jul 28, 2022

Getting the same (I think) with Tailwind typography plugin:

4 rules skipped due to selector errors:
  .prose :where(hr + *):not(:where([class~="not-prose"] *)) -> Cannot read properties of undefined (reading 'type')
  .prose :where(h2 + *):not(:where([class~="not-prose"] *)) -> Cannot read properties of undefined (reading 'type')
  .prose :where(h3 + *):not(:where([class~="not-prose"] *)) -> Cannot read properties of undefined (reading 'type')
  .prose :where(h4 + *):not(:where([class~="not-prose"] *)) -> Cannot read properties of undefined (reading 'type')

The only selectors, that error, seem to be with + * in them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rules skipped due to selector errors: legend+* -> Cannot read ...
1 rules skipped due to selector errors: legend+* -> Cannot read property 'type' of undefined. See this screenshot:
Read more >
Warning: 1 rules skipped due to selector errors: legend + ...
In the angular.json file write the following code, under "production". "optimization": { "scripts": true, "styles": { "minify": true, ...
Read more >
Angular Universal 'Rules skipped due to selector errors' - Reddit
Angular Universal 'Rules skipped due to selector errors' ... legend+* -> Cannot read properties of undefined (reading 'type').
Read more >
legend * -> cannot read properties of undefined (reading 'type')
This error occurs when attempting to read a property of an undefined variable. It typically means that the variable in question has not...
Read more >
MDB4 with Angular12 css skipped rules
@Arkadiusz Idzikowski I upgraded to the next version and restored it to the original import, but the error still exists. 10 rules skipped...
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