W3C home > Mailing lists > Public > www-style@w3.org > July 2014

Re: [css-values-4] String concatenation

From: (wrong string) ński <kornel@geekhood.net>
Date: Sat, 19 Jul 2014 23:58:36 +0100
Message-Id: <328310E3-5331-4E51-A4E6-3C4AD8840AAC@geekhood.net>
To: www-style list <www-style@w3.org>
If the use case is to construct URLs, then I think it's wrong to frame it as problem of string concatenation. URLs are not just strings: they require proper encoding. String escaping is type- and context-dependent, and authors get it notoriously wrong.

With naive string concatenation a case like this will likely generate an invalid URL:

url("/picture?of=" + attr(title));

And it's not always URL-encoding, it may require punycode:

url("//" + attr(hostname) + "/favicon.ico");

or it may be expected that there is no encoding applied at all:

url("/images/foo.png" + var(--default-query-string));

regards, Kornel
Received on Saturday, 19 July 2014 22:59:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:44 UTC