Skip to content

Instantly share code, notes, and snippets.

@davidhund
Last active October 17, 2019 16:02
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save davidhund/b995353fdf9ce387b8a2 to your computer and use it in GitHub Desktop.
Save davidhund/b995353fdf9ce387b8a2 to your computer and use it in GitHub Desktop.
The simplest feature-detect for flexbox?
/*
* Trying to feature-detect (very naive)
* CSS Flexbox support.
* - Only most modern syntax
*
* Is this nonsense?
*/
(function NaiveFlexBoxSupport(d){
var f = "flex", e = d.createElement('b');
e.style.display = f;
return e.style.display == f;
})(document);
@patrick-fischer-hirschstein

according to mcshaman post:

cssPropertySupported(['-webkit-box', '-ms-flex', 'flex'])

should be:
cssPropertySupported(['-ms-flexbox', '-webkit-box', 'flex'])

By the way:

return true

should be:
return name

so you know what syntax is used

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment