New issue
Advanced search Search tips

Issue 748966 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

non-breaking space breaks css property

Reported by lewis.co...@gmail.com, Jul 26 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36

Example URL:
https://codepen.io/joao-silva/pen/qjGYpo

Steps to reproduce the problem:
pre-steps (this is someone else codepen, they may update, CSS has been backed up to https://pastebin.com/uWSWZitt/raw)

1. insert (hex) 20 C2 A0 before any css-property
2. load page (style for that property won't work)
3. look into inspector (now here FF & chrome seem to differ)
  a. FF does not show the extra character
  b. Chrome displays the extra character but it looks like a space

What is the expected behavior?
all whitespace (including C2 A0) to be trimmed from CSS property names

What went wrong?
failed to replace C2 A0 (multi-byte) with 20, or trim when parsing CSS property names (as far as I can tell).

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? No
 Mozilla Firefox for Ubuntu 54.0 (64-bit)

Chrome version: 59.0.3071.115  Channel: stable
OS Version: ubuntu xenial amd64
Flash Version: N/A

In 15 years on the web, I've never noticed this in any browser. It's likely user-behaviour should also be altered to not just copy->paste such characters, but it would be nice to have a bit of backup from chrome too.
 

Comment 1 by rbyers@chromium.org, Jul 27 2017

Cc: rbyers@chromium.org
Components: -Blink Blink>CSS
Status: WontFix (was: Unconfirmed)
I created a repro here: https://rbyers.github.io/sb/css-nbsp.html

The current version of all major browsers seem to agree - the non-breaking space counts as part of the property name, it's NOT whitespace.  This is specified here: https://drafts.csswg.org/css-syntax/#consume-token

So I believe this is working as intended.
Thank you. While I'll agree it's not covered under the definition of whitespace (which seems to be space, tab and newline), the fact it looks like a space to the user makes it unnecessarily opaque for someone without knowledge of character representations.

The very issue only came to my attention from a coding newcomer asking why their styling wasn't being applied. While I have publicly relayed to them what was wrong, how to see this, I'm unsure if it went over their head a little, and how many other non CS coders would or have fallen into the same trap.
Screenshot from 2017-07-26 07-53-07.png
120 KB View Download

Comment 3 by rbyers@chromium.org, Jul 27 2017

Yeah I can see how this would be surprising / confusing.  We should at least ask the CSSWG to explain why it's defined this way.  Filed https://github.com/w3c/csswg-drafts/issues/1654
Looks from GitHub like this is dead as the CSS group have re-iterated only supporting ASCII. Thank you very much for your help with this.

Sign in to add a comment