rodneyrehm / viewport-units-buggyfill

Making viewport units (vh|vw|vmin|vmax) work properly in Mobile Safari.
MIT License
1.59k stars 151 forks source link

Incorrect regex for iOS version #72

Open matthewenks opened 7 years ago

matthewenks commented 7 years ago

viewport-units-buggyfill.js

Line 45 was: var iOSversion = userAgent.match(/OS (\d)/);

Guessing it should be: var iOSversion = userAgent.match(/OS (\d+)/);

As an aside, should like 48 read like this?

return iOSversion && iOSversion.length>1 && parseInt(iOSversion[1], 10) < 8;

rodneyrehm commented 7 years ago

Guessing it should be: var iOSversion = userAgent.match(/OS (\d+)/);

makes sense. do you want to send a PR for this?

As an aside, should like 48 read like this?

that effectively limits the buggyfill to iOS 7. I'm not sure it's still required in iOS 10

matthewenks commented 7 years ago

I'm not sure either actually - from what I've experienced viewport units work, albeit in an Apple-prescribed way. vh units will always take the maximum height of the viewport (ie. with the address bar hidden), rather than the current available height.

I've not contributed to open source before - I'll have a look into creating a PR shortly :)

johntron commented 6 years ago

FYI - the iOS version matching was fixed in https://github.com/rodneyrehm/viewport-units-buggyfill/pull/85.