Re: [csswg-drafts] [css-transforms-1] Browsers do not implement transform attribute syntax as described by w3c

@longsonr @AmeliaBR @tabatkins There are actually a couple of more differences between the parsing rules for SVG transform attribute and the CSS transform property. My hope was that they do not matter to much and we could add more restrictions.

One example is:
```xml
<rect transform="translate   (20, 20)"/>
```

This is allowed according to SVG parsing rules but isn't in CSS.

I checked the implementation of MS Edge and it seems like it goes the same route as WebKit and later Blink and Firefox are going. (I have to admit that this is probably my fault as I implemented it this way in WebKit. :( ):

Example: https://codepen.io/krit/pen/LmyjVE

In the example there are 2 rectangles. Both set the `transform` attribute. Former uses the CSS syntax, latter uses the SVG syntax to translate a rectangle by 40px, 40px from the top left.

As you can see in all browsers, the one with the CSS syntax does not get transformed. That is because implementations still only accept the SVG syntax exclusively on the `transform` attribute. All browsers still support things like `translate   (`. None supports the new CSS transform functions like `translateX()` on the attribute.

Now, given that we want to get to a PR eventually and that all browsers comply, it would make sense to allow the old SVG syntax on the attribute as well. However, this may make it harder to support the actual CSS syntax in addition to the SVG syntax later.

Couple of options:
* We ask implementations to remove as many parts of the SVG syntax as possible up to the point where the SVG syntax is compatible to "legacy mode" of CSS (the parsing that @tabatkins suggested)
    * We could set a different requirement for the SVG transform attribute: Must support all transform functions supported in SVG 1.1 and may support additional transform functions from CSS Transforms.
    * Still require all transform functions, which could delay level 1 further.
* We could require the SVG syntax for `transform` **attribute**
    * Add new transform functions to the _SVG syntax_ in the next level or put them in level 1 but implementations _may_ support the new transform functions.

This broadens the scope of this issue a bit. However, we should clarify our priorities rather sooner than later.

-- 
GitHub Notification of comment by dirkschulze
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2623#issuecomment-385872124 using your GitHub account

Received on Wednesday, 2 May 2018 05:55:37 UTC