Created
September 24, 2018 12:06
-
-
Save eiriarte/19098601221aa047e654d9846716af68 to your computer and use it in GitHub Desktop.
Función sencillita, pero sofisticada, que se puede usar para mostrar el típico aviso de "navegador obsoleto".
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Comprueba si el navegador es compatible con alguna de las propiedades CSS | |
* especificadas. | |
* @param {Array}<String> props - propiedades CSS a comprobar | |
* @returns {boolean} true si el navegador es compatible, false si no lo es | |
*/ | |
function obsoleto(props) { | |
if (!props) { | |
// Por defecto usamos border-image (no funciona en IE10, sí en IE11) | |
props = [ 'borderImage', 'WebkitBorderImage' ]; | |
} | |
var div = document.createElement('div'); | |
for (var i = 0; i < props.length; i++) { | |
if (props[i] in div.style) { return false; } | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment