[svgwg] Values in SVGZoomAndPan and SVGUnitTypes should be accessible to javascript

longsonr has just created a new issue for 
https://github.com/w3c/svgwg:

== Values in SVGZoomAndPan and SVGUnitTypes should be accessible to 
javascript ==
Please:
The [SVG 2 specification](
https://www.w3.org/TR/2016/CR-SVG2-20160915/types.html#InterfaceSVGZoomAndPan)

Makes it impossible to write var x = ZoomAndPan.SVG_ZOOMANDPAN_UNKNOWN
 as ZoomAndPan is [NoInterfaceObject].

Similarly with SVGUnitTypes.

This is not what either Chrome or Firefox do (both support accessing 
the ZoomAndPan interface values directly). In fact Firefox has tests 
that contain SVGUnitTypes so it's certainly likely that there's also 
usage of this in the wild.

I propose changing the ZoomAndPan interface to

    interface SVGZoomAndPan {
    };

    SVGZoomAndPan implements SVGZoomAndPanValues;

Then having this as SVGZoomAndPanValues

    [NoInterfaceObject]
    interface SVGZoomAndPanValues {

      // Zoom and Pan Types
      const unsigned short SVG_ZOOMANDPAN_UNKNOWN = 0;
      const unsigned short SVG_ZOOMANDPAN_DISABLE = 1;
      const unsigned short SVG_ZOOMANDPAN_MAGNIFY = 2;

      [SetterThrows]
      attribute unsigned short zoomAndPan;
    };

And all existing users of ZoomAndPan i.e. SVGSVGElement and 
SVGViewElement would then implement SVGZoomAndPanValues

This would mean that an SVGSVGElement would not be an SVGZoomAndPan 
but you would be able to access its contents.

Similarly for SVGUnitTypes.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1241899 and 
https://bugzilla.mozilla.org/show_bug.cgi?id=1241898 for the Firefox 
implementation which is landing now. This will align Firefox with 
Chrome's implementation.





Please view or discuss this issue at 
https://github.com/w3c/svgwg/issues/291 using your GitHub account

Received on Sunday, 16 October 2016 11:36:56 UTC