-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is ^|\s+
used instead of just \s+
in .split()?
#18
Comments
I think the only difference is when typenames is the empty string or entirely whitespace. "".split(/^|\s+/) // []
"".split(/\s+/) // [""] |
@mbostock Ah, thanks, I totally missed that. Perhaps that could be solved with |
I'm not even sure though that this would make things work under Qt QML, I checked pretty long ago. |
I’m not planning on taking any action. Thank you for the question. |
I think I've found a (browser?) bug related to this regex and the question asked by @ChALkeR here. In Internet Explorer (v11 is where I saw this), the regex The issues seems to be the pipe, it looks like it causes IE to split not on the whitespace but on nothing, effectively. I'm not sure what the expected browser support is, but as suggested above, using Let me know if this should be a new bug. |
On the following lines,
^|\s+
is used:d3-dispatch/src/dispatch.js
Lines 15 to 17 in 893b6f4
Does that do anything different from what just
\s+
would do?It causes problems when trying to use this library in QML environment (V4 JS engine from Qt).
Ref: QTBUG-62471.
The text was updated successfully, but these errors were encountered: