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

Nirmos created this task.Mar 31 2018, 6:19 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 31 2018, 6:19 AM
Tgr added a subscriber: Tgr.Mar 31 2018, 1:44 PM

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).

Anomie added a subscriber: Anomie.Mar 31 2018, 5:59 PM

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.

JJMC89 added a subscriber: JJMC89.Mar 31 2018, 6:42 PM

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.

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 closed this task as Resolved.Apr 2 2018, 6:40 PM
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.

Nirmos added a comment.Apr 2 2018, 6:42 PM

Thank you!

ggellerman moved this task from Up next to Done on the TemplateStyles board.Apr 11 2018, 4:40 PM