-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Selector string when updating a select input is incorrect #769
Comments
Can you post a stack trace? |
I'm hitting this issue as well. Basically, if you have a font-family with a space in it (ex. "Arial Black"), Chrome will encapsulate it with quotes when you ask for the font-family of the HTML element. let fontFamily = "Arial Black";
node.style['fontFamily'] = fontFamily;
fontFamily = node.style[fontFamily]; // fontFamily is now "Arial Black" (including the quotes)
fontFamily = "'Arial Black'"; // Surrounded with single quotes
node.style['fontFamily'] = fontFamily;
fontFamily = node.style[fontFamily]; // fontFamily is still "Arial Black" (with double quotes instead of single ones) The error is thrown in option = input.querySelector(`option[value="${formats[format]}"]`); // Source
option = input.querySelector('option[value="' + formats[format] + '"]') // Built file/from CDN When the selector is built, the quotes for the value aren't escaped, so you end up with a bad selector (like the original post). Replacing the double quotes with single ones (which @clemmy did in zenreach#1) should fix it. Just have to make sure that the names with spaces are single-quoted wherever you specify them as well. Please let me know if you want a PR with the changes. |
It seems brittle to just switch to single quotes. Do all browsers add double quotes as opposed to single quotes or leaving them unquoted? If multiple fonts are specified like "Arial Black", Arial, "Helvetica Neue", Helvetica, sans-serif, is the spacing between fonts and commas respected or potentially normalized? |
Was there ever a proper fix done for this? Running into this same issue. |
The problem is that when using the font-family format
Then if an option on a select on the toolbar has a value of, say,
'Arial Black, Arial, Helvetica Neue, Helvetica, sans-serif'
, we would run into an error in the update function.Notice how there are two double quotes in a row.
Platforms: [Chrome 48, Firefox 46 on Mac 10.11]
Version: [1.0.6.Beta]
The text was updated successfully, but these errors were encountered: