Safari not computing calc() values

266 views Asked by At

I wonder if this is a bug or if there's a good workaround:

Only on Safari (using iOS Safari 8.1 and Safari 7.0.5 for the Dev Tools), the browser doesn't seem to have a calculated value for an an element with the style:

.node { top: calc(39px - 100%); }

it displays properly in the browser, but window.getComputedStyle($('.node')).top returns null and in fact the Computed Properties in Safari's dev tools also show top: null. If I change the style to a pixel value, the Computed Property shows correctly (i.e., top: 400px).

This is a problem for me because I'd like to use the computed style value in JavaScript calculations.

0

There are 0 answers