You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uncaught TypeError: Cannot read properties of undefined (reading 'substr')
at /CWD/example.css:3:3
at Object.action (/CWD/node_modules/rtlcss/lib/plugin.js:184:141)
at /CWD/node_modules/rtlcss/lib/rtlcss.js:136:27
at /CWD/node_modules/rtlcss/lib/util.js:259:37
RTLCSS 2 used to work with programmatically set !important declarations - and it worked in RTLCSS v3.0.
However, in v3.1 RTLCSS started erroring on such nodes and it appears to have been broken ever since. The error message line is from v4.1.1, the latest version at the time of writing.
I have traced the issue down to ee9dc53, which presumes that PostCSS will always have a raws.important if Declaration.important is true, but PostCSS' documentation explicitly says that DeclarationRaws.important contains "The content of the important statement, if it is not just !important." (emphasis mine).
The text was updated successfully, but these errors were encountered:
I am not a maintainer of the project but at least I can explain you what happens 🙂
Plugins are applied left to right, so when you run decl.important = true in this declaration:
color:#F00/*rtl:#00F*/;
PostCSS is the first one to run, and it doesn't expect to have comments between the declaration value and the semicolon, so it puts the important in this way:
color:#F00/*rtl:#00F*/!important;
But RTLCSS expects that a replace directive is written after the important:
Setup
Given the following little program:
Expected result
Actual result
RTLCSS 2 used to work with programmatically set
!important
declarations - and it worked in RTLCSS v3.0.However, in v3.1 RTLCSS started erroring on such nodes and it appears to have been broken ever since. The error message line is from v4.1.1, the latest version at the time of writing.
I have traced the issue down to ee9dc53, which presumes that PostCSS will always have a
raws.important
ifDeclaration.important
istrue
, but PostCSS' documentation explicitly says thatDeclarationRaws.important
contains "The content of the important statement, if it is not just!important
." (emphasis mine).The text was updated successfully, but these errors were encountered: