modernizr-detects
v1.3.0
Published
Feature detection not suitable for Modernizr, but within it’s API for easier usage.
Downloads
2,993
Readme
modernizr-detects
Feature detection not suitable for Modernizr, but within it’s API for easier usage.
Install
npm install modernizr-detects --save-dev
ES Modules
npm install modernizr-esm modernizr-detects --save
Usage
Use it as part of customTests
feature of Customizr.
Since that project is currently unmaintained, I’m maintaining fork (Gulp and Grunt plugin also) which is updated to work with new Modernizr features.
const customizr = require('customizr');
customizr({
// … Customizr config
customTests: [
'print',
'proxybrowser',
'oninputproper'
].map(( featureName ) => require.resolve(`modernizr-detects/feature-detects/${featureName}`))
}, () => {
// All done!
});
ES Modules
There is no need for build step. Import feature detection and use it’s return value.
import print from 'modernizr-detects/feature-detects/esm/print';
console.log(print); // Is printing supported?
List of feature detections
adblock
Detects presence of ad blockers such as AdBlock Plus.
ie
Gives you information regarding current IE version (if browser is IE).
oninputproper
oninput
event which detects falsy values.
Detects if current device has printing capability.
proxybrowser
Detects if current browser is proxy browser.
animationstart, animationend, transitionend
Not detection per se, but gives you prefixed/unprefixed string for animation/transition event according to browser capabilities.
Browser support
Tested in IE9+ and all modern browsers.
Test
For automated tests, run npm run test:automated
(append :watch
for watcher support).
For manual tests, run npm run test:manual
and open http://localhost:9000/ in your browser.
License
MIT © Ivan Nikolić