New issue
Advanced search Search tips

Issue 733906 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug-Regression



Sign in to add a comment

Chrome creating nested double quotes in "style" attribute when setting fontFamily via JavaScript.

Reported by gr...@yahoo-inc.com, Jun 16 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36

Steps to reproduce the problem:
When setting fontFamily via JavaScript, Chrome wraps multi-word fonts in double quotes, resulting in nested double quotes (which is invalid).  Firefox & Safari are doing it correctly... They use single quotes (or no quotes) instead of double quotes.

Here is an example:
https://jsfiddle.net/grese/qhw0mxtt/

Steps to reproduce:
1. Open the fiddle link above (or the attached html file) in Chrome
2. Inspect the text rendered in the "result" pane.
3. Notice that the style attribute says:  style="font-family: Georgia, "Times New Roman", serif;"

The problem is that there are now double quotes inside double quotes (and nothing is escaped).  A better solution would be to either not add the extra quotes, or just use single quotes around 'Times New Roman'. If you repeat the above steps in Safari, or Firefox, you'll see the correct behavior.

Here is what I would expect to see in the style attribute:
style="font-family: Georgia, 'Times New Roman', serif;"
OR
style="font-family: Georgia, Times New Roman, serif;"

What is the expected behavior?
Here is what I would expect to see in the style attribute:
style="font-family: Georgia, 'Times New Roman', serif;"
OR
style="font-family: Georgia, Times New Roman, serif;"

What went wrong?
Chrome is wrapping multi-word fonts in double quotes, which results in nested double quotes in the style attribute.  Nested double quotes are invalid when nothing is escaped.

Here are the invalid contents of the style attribute (copied from Chrome).
style="font-family: Georgia, "Times New Roman", serif;"
(notice the nested double quotes).

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 58.0.3029.110  Channel: stable
OS Version: OS X 10.12.5
Flash Version: N/A

Please feel free to reach out if anything is unclear.
grese@yahoo-inc.com
 
font-family-bug.html
312 bytes View Download
font-family-bug.html
312 bytes View Download

Comment 1 by tapted@chromium.org, Jun 16 2017

Components: Blink>Fonts
Labels: Needs-Milestone

Comment 3 by e...@chromium.org, Jun 19 2017

Components: -Blink>Fonts Blink>CSS

Comment 4 by shans@chromium.org, Jun 19 2017

Labels: Needs-Bisect
Status: Untriaged (was: Unconfirmed)
Cc: kkaluri@chromium.org ajha@chromium.org
Labels: -Needs-Bisect -Needs-Milestone hasbisect-per-revision M-61 OS-Linux OS-Windows
Owner: rob.b...@samsung.com
Status: Assigned (was: Untriaged)
Able to reproduce this issue on Windows 10, Ubuntu 14.04 and Mac 10.12.5 with chrome stable #59.0.3071.104, Canary #61.0.3135.0
Issue broken in M-51.

Bisect Info:
===========
Good build : 51.0.2680.0 ,  Revision Range - 381354
Bad build  : 51.0.2682.0 ,  Revision Range - 381839

After executing the per-revision bisect script , i got the following CL's between good and bad build versions
===========================================
https://chromium.googlesource.com/chromium/src/+log/8468b4eb877dd991361f0da7541c7da961c8b3c7..0c2c3981d4621fc6f5525e01f4de2a14cbc2d15e


The suspecting CL is :
-----------
Review URL: https://codereview.chromium.org/1778743003

rob.buis@- Could you please look into this issue, if it's related to your change?  if not could you please help us to reassign this issue to the right owner.

Labels: -Type-Bug -Pri-2 Pri-1 Type-Bug-Regression

Comment 7 by shend@chromium.org, Jun 20 2017

Labels: Update-Weekly
Owner: kkaluri@chromium.org
I am not sure this is a P1. It is just a visible incorrectness in the inspector markup and also note "Copy element" menu option does correct escaping:
 <div id="foo" style="font-family: Georgia, &quot;Times New Roman&quot;, serif; color: darkblue;">

@kkaluri I think the inspector folks should have a first look. IIRC we were just following spec when standardizing on double quotes, so it may be more correct for inspector to be fixed, especially if there is custom code/logic to print css properties and values including font families.
Labels: -Pri-1 Pri-2
Labels: -Update-Weekly

Sign in to add a comment