Skip to content

Commit

Permalink
Add new Modernizr test: pointer events
Browse files Browse the repository at this point in the history
close #44
  • Loading branch information
ImBobby committed Jul 18, 2016
1 parent 91717bb commit e8a5564
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions dev/js/vendor/modernizr.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ window.Modernizr = (function( window, document, undefined ) {

slice = classes.slice,

featureName,
featureName,


injectElementWithStyles = function( rule, callback, nodes, testnames ) {
Expand Down Expand Up @@ -105,7 +105,7 @@ window.Modernizr = (function( window, document, undefined ) {
return bool;

},


isEventSupported = (function() {

Expand Down Expand Up @@ -152,7 +152,7 @@ window.Modernizr = (function( window, document, undefined ) {
};
}
else {
hasOwnProp = function (object, property) {
hasOwnProp = function (object, property) {
return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
};
}
Expand Down Expand Up @@ -520,6 +520,23 @@ window.Modernizr = (function( window, document, undefined ) {
return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));
};

tests['pointerevents'] = function() {
var element = document.createElement('x'),
documentElement = document.documentElement,
getComputedStyle = window.getComputedStyle,
supports;
if(!('pointerEvents' in element.style)){
return false;
}
element.style.pointerEvents = 'auto';
element.style.pointerEvents = 'x';
documentElement.appendChild(element);
supports = getComputedStyle &&
getComputedStyle(element, '').pointerEvents === 'auto';
documentElement.removeChild(element);
return !!supports;
};

function webforms() {
Modernizr['input'] = (function( props ) {
for ( var i = 0, len = props.length; i < len; i++ ) {
Expand Down Expand Up @@ -603,7 +620,7 @@ window.Modernizr = (function( window, document, undefined ) {

}

return Modernizr;
return Modernizr;
};


Expand Down Expand Up @@ -877,11 +894,11 @@ Modernizr.addTest('mediaqueries', Modernizr.mq('only all'));// code.google.com/s

image.onerror = function() {
Modernizr.addTest('webp', false);
};
};
image.onload = function() {
Modernizr.addTest('webp', function() { return image.width == 1; });
};

image.src = 'data:image/webp;base64,UklGRiwAAABXRUJQVlA4ICAAAAAUAgCdASoBAAEAL/3+/3+CAB/AAAFzrNsAAP5QAAAAAA==';

}());;
}());;

0 comments on commit e8a5564

Please sign in to comment.