Skip to content

Commit

Permalink
remove stale jshint control comments
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickkettner committed Aug 7, 2016
1 parent ff9fe4b commit 9f4f44b
Show file tree
Hide file tree
Showing 18 changed files with 255 additions and 23 deletions.
1 change: 0 additions & 1 deletion feature-detects/audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
// It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2
// It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5
Modernizr.addTest('audio', function() {
/* jshint -W053 */
var elem = createElement('audio');
var bool = false;

Expand Down
1 change: 0 additions & 1 deletion feature-detects/css/columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ define(['Modernizr', 'testAllProps'], function(Modernizr, testAllProps) {

(function() {

/* jshint -W053 */
Modernizr.addTest('csscolumns', function() {
var bool = false;
var test = testAllProps('columnCount');
Expand Down
1 change: 0 additions & 1 deletion feature-detects/es6/generators.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Check if browser implements ECMAScript 6 Generators per specification.
define(['Modernizr'], function(Modernizr) {
Modernizr.addTest('generators', function() {
try {
/* jshint evil: true */
new Function('function* test() {}')();
} catch (e) {
return false;
Expand Down
1 change: 0 additions & 1 deletion feature-detects/flash.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Detects Flash support as well as Flash-blocking plugins
*/
define(['Modernizr', 'createElement', 'docElement', 'addTest', 'getBody', 'isSVG'], function(Modernizr, createElement, docElement, addTest, getBody, isSVG) {
Modernizr.addAsyncTest(function() {
/* jshint -W053 */

var attachBody = function(body) {
if (!docElement.contains(body)) {
Expand Down
1 change: 0 additions & 1 deletion feature-detects/img/webp.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ define(['Modernizr', 'addTest'], function(Modernizr, addTest) {
var result = event && event.type === 'load' ? image.width == 1 : false;
var baseTest = name === 'webp';

/* jshint -W053 */
addTest(name, baseTest ? new Boolean(result) : result);

if (cb) {
Expand Down
1 change: 0 additions & 1 deletion feature-detects/indexeddbblob.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ define(['Modernizr', 'addTest', 'prefixed', 'test/indexeddb'], function(Moderniz
// For speed, we don't test the legacy (and beta-only) indexedDB

Modernizr.addAsyncTest(function() {
/* jshint -W053 */
var indexeddb;
var dbname = 'detect-blob-support';
var supportsBlob = false;
Expand Down
1 change: 0 additions & 1 deletion feature-detects/url/data-uri.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Modernizr.datauri.over32kb // false in IE8
define(['Modernizr', 'addTest'], function(Modernizr, addTest) {
// https://github.com/Modernizr/Modernizr/issues/14
Modernizr.addAsyncTest(function() {
/* jshint -W053 */

// IE7 throw a mixed content warning on HTTPS for this test, so we'll
// just blacklist it (we know it doesn't support data URIs anyway)
Expand Down
1 change: 0 additions & 1 deletion feature-detects/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
// It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5

Modernizr.addTest('video', function() {
/* jshint -W053 */
var elem = createElement('video');
var bool = false;

Expand Down
1 change: 0 additions & 1 deletion feature-detects/webgl/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ define(['Modernizr', 'createElement', 'test/webgl'], function(Modernizr, createE

// Not Async but handles it's own self
Modernizr.addAsyncTest(function() {
/* jshint -W053 */

// Not a good candidate for css classes, so we avoid addTest stuff
Modernizr.webglextensions = new Boolean(false);
Expand Down
2 changes: 0 additions & 2 deletions lib/build.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// this file configures require.js based on enviroment
'use strict';

/* jshint -W117 */
var inBrowser = typeof define == 'function' && typeof define.amd == 'object';
/* jshint -W117 */

var _extend = function(a, b) {
for (var prop in b) {
Expand Down
255 changes: 255 additions & 0 deletions modernizr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
/*!
* modernizr v3.3.1
* Build https://modernizr.com/download?-setclasses-dontmin
*
* Copyright (c)
* Faruk Ates
* Paul Irish
* Alex Sexton
* Ryan Seddon
* Patrick Kettner
* Stu Cox
* Richard Herrera
* MIT License
*/

/*
* Modernizr tests which native CSS3 and HTML5 features are available in the
* current UA and makes the results available to you in two ways: as properties on
* a global `Modernizr` object, and as classes on the `<html>` element. This
* information allows you to progressively enhance your pages with a granular level
* of control over the experience.
*/

;(function(window, document, undefined){
var tests = [];


/**
*
* ModernizrProto is the constructor for Modernizr
*
* @class
* @access public
*/

var ModernizrProto = {
// The current version, dummy
_version: '3.3.1',

// Any settings that don't work as separate modules
// can go in here as configuration.
_config: {
'classPrefix': '',
'enableClasses': true,
'enableJSClass': true,
'usePrefixes': true
},

// Queue of tests
_q: [],

// Stub these for people who are listening
on: function(test, cb) {
// I don't really think people should do this, but we can
// safe guard it a bit.
// -- NOTE:: this gets WAY overridden in src/addTest for actual async tests.
// This is in case people listen to synchronous tests. I would leave it out,
// but the code to *disallow* sync tests in the real version of this
// function is actually larger than this.
var self = this;
setTimeout(function() {
cb(self[test]);
}, 0);
},

addTest: function(name, fn, options) {
tests.push({name: name, fn: fn, options: options});
},

addAsyncTest: function(fn) {
tests.push({name: null, fn: fn});
}
};



// Fake some of Object.create so we can force non test results to be non "own" properties.
var Modernizr = function() {};
Modernizr.prototype = ModernizrProto;

// Leak modernizr globally when you `require` it rather than force it here.
// Overwrite name so constructor name is nicer :D
Modernizr = new Modernizr();



var classes = [];


/**
* is returns a boolean if the typeof an obj is exactly type.
*
* @access private
* @function is
* @param {*} obj - A thing we want to check the type of
* @param {string} type - A string to compare the typeof against
* @returns {boolean}
*/

function is(obj, type) {
return typeof obj === type;
}
;

/**
* Run through all tests and detect their support in the current UA.
*
* @access private
*/

function testRunner() {
var featureNames;
var feature;
var aliasIdx;
var result;
var nameIdx;
var featureName;
var featureNameSplit;

for (var featureIdx in tests) {
if (tests.hasOwnProperty(featureIdx)) {
featureNames = [];
feature = tests[featureIdx];
// run the test, throw the return value into the Modernizr,
// then based on that boolean, define an appropriate className
// and push it into an array of classes we'll join later.
//
// If there is no name, it's an 'async' test that is run,
// but not directly added to the object. That should
// be done with a post-run addTest call.
if (feature.name) {
featureNames.push(feature.name.toLowerCase());

if (feature.options && feature.options.aliases && feature.options.aliases.length) {
// Add all the aliases into the names list
for (aliasIdx = 0; aliasIdx < feature.options.aliases.length; aliasIdx++) {
featureNames.push(feature.options.aliases[aliasIdx].toLowerCase());
}
}
}

// Run the test, or use the raw value if it's not a function
result = is(feature.fn, 'function') ? feature.fn() : feature.fn;


// Set each of the names on the Modernizr object
for (nameIdx = 0; nameIdx < featureNames.length; nameIdx++) {
featureName = featureNames[nameIdx];
// Support dot properties as sub tests. We don't do checking to make sure
// that the implied parent tests have been added. You must call them in
// order (either in the test, or make the parent test a dependency).
//
// Cap it to TWO to make the logic simple and because who needs that kind of subtesting
// hashtag famous last words
featureNameSplit = featureName.split('.');

if (featureNameSplit.length === 1) {
Modernizr[featureNameSplit[0]] = result;
} else {
// cast to a Boolean, if not one already
if (Modernizr[featureNameSplit[0]] && !(Modernizr[featureNameSplit[0]] instanceof Boolean)) {
Modernizr[featureNameSplit[0]] = new Boolean(Modernizr[featureNameSplit[0]]);
}

Modernizr[featureNameSplit[0]][featureNameSplit[1]] = result;
}

classes.push((result ? '' : 'no-') + featureNameSplit.join('-'));
}
}
}
}
;

/**
* docElement is a convenience wrapper to grab the root element of the document
*
* @access private
* @returns {HTMLElement|SVGElement} The root element of the document
*/

var docElement = document.documentElement;


/**
* A convenience helper to check if the document we are running in is an SVG document
*
* @access private
* @returns {boolean}
*/

var isSVG = docElement.nodeName.toLowerCase() === 'svg';


/**
* setClasses takes an array of class names and adds them to the root element
*
* @access private
* @function setClasses
* @param {string[]} classes - Array of class names
*/

// Pass in an and array of class names, e.g.:
// ['no-webp', 'borderradius', ...]
function setClasses(classes) {
var className = docElement.className;
var classPrefix = Modernizr._config.classPrefix || '';

if (isSVG) {
className = className.baseVal;
}

// Change `no-js` to `js` (independently of the `enableClasses` option)
// Handle classPrefix on this too
if (Modernizr._config.enableJSClass) {
var reJS = new RegExp('(^|\\s)' + classPrefix + 'no-js(\\s|$)');
className = className.replace(reJS, '$1' + classPrefix + 'js$2');
}

if (Modernizr._config.enableClasses) {
// Add the new classes
className += ' ' + classPrefix + classes.join(' ' + classPrefix);
if (isSVG) {
docElement.className.baseVal = className;
} else {
docElement.className = className;
}
}

}

;

// Run each test
testRunner();

// Remove the "no-js" class if it exists
setClasses(classes);

delete ModernizrProto.addTest;
delete ModernizrProto.addAsyncTest;

// Run the things that are supposed to run after the tests
for (var i = 0; i < Modernizr._q.length; i++) {
Modernizr._q[i]();
}

// Leak Modernizr namespace
window.Modernizr = Modernizr;


;

})(window, document);
3 changes: 0 additions & 3 deletions src/addTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ define(['ModernizrProto', 'Modernizr', 'hasOwnProp', 'setClasses'], function(Mod
Modernizr[featureNameSplit[0]] = test;
} else {
// cast to a Boolean, if not one already
/* jshint -W053 */
if (Modernizr[featureNameSplit[0]] && !(Modernizr[featureNameSplit[0]] instanceof Boolean)) {
Modernizr[featureNameSplit[0]] = new Boolean(Modernizr[featureNameSplit[0]]);
}
Expand All @@ -191,9 +190,7 @@ define(['ModernizrProto', 'Modernizr', 'hasOwnProp', 'setClasses'], function(Mod
}

// Set a single class (either `feature` or `no-feature`)
/* jshint -W041 */
setClasses([(!!test && test != false ? '' : 'no-') + featureNameSplit.join('-')]);
/* jshint +W041 */

// Trigger the event
Modernizr._trigger(feature, test);
Expand Down
1 change: 0 additions & 1 deletion src/html5printshiv.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ define(['isSVG'], function(isSVG) {
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
;(function(window, document) {
/*jshint evil:true */
/** version */
var version = '3.7.3';

Expand Down
1 change: 0 additions & 1 deletion src/html5shiv.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ define(['isSVG'], function(isSVG) {
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
*/
;(function(window, document) {
/*jshint evil:true */
/** version */
var version = '3.7.3';

Expand Down
1 change: 0 additions & 1 deletion src/testRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ define(['tests', 'Modernizr', 'classes', 'is'], function(tests, Modernizr, class
Modernizr[featureNameSplit[0]] = result;
} else {
// cast to a Boolean, if not one already
/* jshint -W053 */
if (Modernizr[featureNameSplit[0]] && !(Modernizr[featureNameSplit[0]] instanceof Boolean)) {
Modernizr[featureNameSplit[0]] = new Boolean(Modernizr[featureNameSplit[0]]);
}
Expand Down
2 changes: 0 additions & 2 deletions test/browser/src/addTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,7 @@ describe('addTest', function() {
});

it('supports nested properties with a bool base', function() {
/* jshint -W053 */
addTest('fake', new Boolean(true));
/* jshint +W053 */
addTest('fake.detect', true);
expect(Modernizr.fake).to.be.an('object');
expect(Modernizr.fake.detect).to.be(true);
Expand Down
Loading

0 comments on commit 9f4f44b

Please sign in to comment.