Page MenuHomePhabricator

TemplateStyles removes space between solid and #aaa
Closed, ResolvedPublic

Description

TemplateStyles (or perhaps more correctly css-sanitizer?) removes spaces between solid and #aaa so that

p {
	border: 1px solid #aaa;
}

is turned into

p {
	border: 1px solid#aaa;
}

It should be noted (for testing purposes) that most modern browsers (Chrome/Firefox/Edge) surprisingly allow this, but IE doesn't.

Minimal test case: https://sv.wikipedia.org/wiki/Anv%C3%A4ndare:Nirmostest/sandl%C3%A5da and https://sv.wikipedia.org/wiki/Anv%C3%A4ndare:Nirmostest/sandl%C3%A5da/styles.css

Event Timeline

It's not that surprising: per the CSS spec # is not a name code point so it terminates the border style keyword (ident-token). IE apparently does not implement the spec accurately (that's no big surprise either).

Which versions of IE have this bug?

I have confirmed that IE11 has this bug.

I put together a somewhat more detailed test at https://jsfiddle.net/m8evs320/1/. Please check it in IE and let me know the results.

I put together a somewhat more detailed test at https://jsfiddle.net/m8evs320/1/. Please check it in IE and let me know the results.

jsfiddle.net-m8evs320-1.png (1×1 px, 140 KB)

Strange that test #1 isn't showing a pink background. I guess IE is using different parsing for border than background or something.

Change 423498 had a related patch set uploaded (by Anomie; owner: Anomie):
[css-sanitizer@master] Workaround IE parsing bug

https://gerrit.wikimedia.org/r/423498

Change 423498 merged by jenkins-bot:
[css-sanitizer@master] Workaround IE parsing bug

https://gerrit.wikimedia.org/r/423498

Change 423509 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/vendor@master] Upgrade css-sanitizer to v1.0.5

https://gerrit.wikimedia.org/r/423509

Change 423509 merged by jenkins-bot:
[mediawiki/vendor@master] Upgrade css-sanitizer to v1.0.5

https://gerrit.wikimedia.org/r/423509

Anomie claimed this task.

The fix should be deployed to WMF wikis with 1.31.0-wmf.28 or later. You'll likely need to purge affected pages after it's deployed.