2

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.

AJFarkas
  • 2,929
  • 1
  • 17
  • 15
  • possible duplicate of [CSS calc not working in Safari and fallback](http://stackoverflow.com/questions/20443343/css-calc-not-working-in-safari-and-fallback) – haxtbh Dec 15 '14 at 19:07
  • This has always been buggy in safari. There are some alternatives here - http://stackoverflow.com/questions/20443343/css-calc-not-working-in-safari-and-fallback – haxtbh Dec 15 '14 at 19:09
  • Fair enough. I found it strange that I didn't need a fallback for Safari >= 7, but it wasn't displaying the calculation that had clearly been done. I'll do it all in JS. – AJFarkas Dec 15 '14 at 19:17

0 Answers0