W3C home > Mailing lists > Public > www-svg@w3.org > December 2013

Re: The (new, enhanced) viewbox property

From: Daniel Holbert <dholbert@mozilla.com>
Date: Wed, 18 Dec 2013 11:16:10 -0800
Message-ID: <52B1F47A.4050504@mozilla.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>, Brian Birtles <bbirtles@mozilla.com>
CC: www-svg <www-svg@w3.org>
On 12/17/2013 03:36 PM, Tab Atkins Jr. wrote:
> On Tue, Dec 17, 2013 at 2:57 PM, Brian Birtles <bbirtles@mozilla.com> wrote:
>> So I think it's a choice between 'view-box' and 'viewbox' and since it is
>> possible to use 'viewbox' as the attribute name in some contexts I think it
>> is preferable.

One reason to possibly prefer "view-box" instead of "viewbox":

Properties are generally exposed in the CSSOM (in element.style and in
getComputedStyle) by converting hyphenation to camelCase.[1]  So, if we
went with "view-box" as the property-name, we'd end up exposing
"element.style.viewBox" (and getComputedStyle(...).viewBox) to the DOM,
which would be nicely consistent with the existing camelCase "viewBox"
usages. (e.g. svgElem.viewBox, from interface SVGFitToViewBox )

In contrast, if the property were named "viewbox", it'd be exposed via
the CSSOM as "viewbox" (*not* viewBox).

> It would likely be just fine for CSS to have a property named
> "viewbox" (which SVG-comfortable authors could write as "viewBox" if
> they chose).

While it's true that authors could write viewbox as "viewBox" in CSS,
they'd still have to use the correct capitalization when accessing the
CSSOM, which would be confusing.

~Daniel

[1] see mentions of camel-case at http://dev.w3.org/csswg/cssom/
[2] http://www.w3.org/TR/SVG11/types.html#InterfaceSVGFitToViewBox
Received on Wednesday, 18 December 2013 19:16:39 UTC

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