storybook-addon-pseudo-states
storybook-addon-pseudo-states copied to clipboard
Fail to parse className from SVG elements
Describe the bug Doesnt work with components containing SVG elements (may be already in issues but not detected as SVG problem)
To Reproduce Steps to reproduce the behavior:
- init storybook (webpack5 version), add storybook-addon-pseudo-states addon (version storybook-addon-pseudo-states": "1.1.0-canary.8.ee5c388.0)
- compose any component with SVG element inside (missing classNames attribute)
- run storybook
Expected behavior Render preview
Current behavior Render fails while trying to split className value, this attr doesnt exists on SVG elements
Desktop (please complete the following information):
- OS: OS-X, gitlab CI
I have edit dist code, apply try-catch on critical line to print error and element, as you can see its only svg and its childs. I cant reach the code from next version, if you cant find it in your source code:
`
tagSelectors.add("(?<![.#])\\b".concat(element.tagName, "\\b"));
if (element.id) idSelectors.add("#".concat(element.id));
try {
var _iterator3 = _createForOfIteratorHelper(element.className.split(/\s+/)),
_step3;
} catch (e) {
console.log(e, element);
}
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var classname = _step3.value;
if (classname) classSelectors.add("\\.".concat(classname));
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
`
+1 @ghengeveld - getting this exact same error.
Same removing plugin for now.
Using @ant-design/icons with storybook 6.30-beta
+1
We're also getting a TypeError: element.className.split is not a function
at rewriteStyleSheets
since upgrading to Webpack 5
EDIT: This also happens when using 1.1.0-canary.8.b81386e.0
from #8
Happy to take a PR that wraps the offending code in a try/catch (or other solution).