For me, the answer to my question is no, it won't break the javascript. Still, you will need to address css code for browsers that don't support --variables. Specifically, and sadly obviously, Microsoft Edge does support them but it's unable to correctly handle them in some circumstances. This makes it somewhat more buggy than IE11, which simply ignores them.
Consider this code:
@for $i from 1 through 20{
// first for legacy browsers
&[data-current="#{$i}"]{ transform: translateX(-100% * ($i - 1)); }
// then for modern ones
&[data-current="#{$i}"]{ transform: translate(calc(-100% * (#{$i} - 1) + var(--distance))); }
}
and this:
hm.on('pan', function(e){ // (hammer.js)
slide_strip.style.setProperty('--distance', e.deltaX + 'px');
});
Tested on Android browser 4.4.2, IE11, Edge.
Android 4.4.2 and IE11 do not support --variables. Edge does support them, but not inside a calc() passed to transforms.
Behaviours:
Android 4.4.2 and IE11: js will just do not set --distance
without throwing any error, and they will use the first css rule (due to data-current updates upon a swipe event > not showed here for simplicity). So it will all work as fallback.
Edge: js will not throw any error. The browser will read the second css rule, but won't be able to handle it, and the result will bee a motion freeze. So here there should be some kind of addressing. Personally I would use a tool like Bowser to detect the browser type, add a related class to body, and map different css rules based on that.
About the w3c spec, I would like to point out that:
SYNTAX_ERR: Raised if the specified value has a syntax error and is
unparsable.
In this case, we are speaking of the value, not the property. Also, the value doesn't have any syntax error.
NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is readonly or
the property is readonly.
The property is not readonly, or, it cannot be told (if the browser doesn't support i, it doesn't now about it). I guess..