W3C home > Mailing lists > Public > www-svg@w3.org > November 2011

Ignoring trailing semi-colon delimiters

From: Brian Birtles <bbirtles@mozilla.com>
Date: Mon, 28 Nov 2011 12:45:11 +0900
Message-ID: <4ED303C7.4010901@mozilla.com>
To: 'www-svg' <www-svg@w3.org>
Dear all,

I'd like to suggest a change to the handling of trailing semi-colon

We use semi-colon separators for the following animation attributes:


But what should happen when we have something like the following?

  values="a; b; c;"

According to the letter of the spec there are four values there: "a",
"b", "c", and "". (Or at least there's nothing to say to ignore trailing
separators like there is for whitespace.)

That might seem pedantic and we should just ignore the trailing ';' but
it's significant when you're dealing with strings (e.g. animating
attributes such as class, xlink:href, result etc.[2]) where the empty
string is a legitimate value.

However, I think we should ignore the trailing semicolon for two reasons:
1) When generating attribute values from script it's easier to just write
     for (...) attrValue += val + "; ";
   rather than having to take care to avoid the trailing separator (e.g.
by imploding an array).
2) There already appears to be content that includes the trailing

One proposal suggested by Cameron McCormack and summarised by Daniel
Holbert is:
 (a) "values" is semicolon-delimited and semicolon-terminated.
 (b) if there are extra [non-whitespace?] characters after the final
     then it's assumed that there's an implied semicolon at the end.
(Square braces are my edit based on Cameron's later feedback.)

So to actually get "a", "b", "" you'd write values="a;b;;".
I've put together a test case to demonstrate the behaviour of different
user agents.[5]

The behaviour of most browsers is closer to this proposal than the spec

Looking forward to your feedback!



[1] Thanks Daniel for having a look into this:
[2] Thanks Cameron for this breakdown:
[3] For example, http://www.telibees.com/iphone_test.svg. In Firefox 8
the frog's legs won't swell because of the trailing semi-colon on the
values list.
[4] https://bugzilla.mozilla.org/show_bug.cgi?id=705236#c1
[5] http://brian.sol1.net/svg/interop/semicolon-test.svg
Received on Monday, 28 November 2011 03:45:50 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:33 UTC