Update jsdoc (#2346)

* Clean up some doc tags

* Replace memberOf with memberof, undo any other changes in html5shiv/printshiv to get back to pristine state

* Small cleanups

* Add custom tags to jsdoc config

* Cleanup jsdoc tags

* Cleanup jsdoc tags

* Add inch config file to exclude html5shivs

* Update inch yml

* Use inch.json instead

* Dont inch the lib folder

* Cleanup jsdoc tags

* More jsdoc cleanups

* Move inch config into one file

* Add comma-dangle rule to eslint

* Cleanup grunt file tasks a little

* Remove some leftover async:false

* Review fixes

* Fix seplling error

* More DOC cleanups

* Fix compile error

* Whitelines/spaces cleanup

* Add eslint rule against multiple whitelines, fix those occurences

* Remove unused (and disabled) eslint entries, sort alphabetically

* Ignored file is not with".min"

* Add task for generating and reporting the coverage from istanbul

* Update eslint dependency

* Small JSdoc cleanups

* Remove unused eslint hint

* Add optional tag back to parameter

* Rname memberof -> memberOf, makes html5shivs original again
This commit is contained in:
Veeck
2018-07-28 19:15:36 +02:00
committed by GitHub
parent c2906e9eae
commit e2c27dcd32
99 changed files with 5032 additions and 339 deletions

View File

@@ -18,39 +18,22 @@
"jsdoc"
],
"rules": {
"indent": [
2,
2,
{
"SwitchCase": 1
}
],
"quotes": [
"error",
"single"
],
"comma-dangle": "error",
"comma-style": ["error", "last"],
"curly": "error",
"wrap-iife": "off",
"indent": ["error", 2, { "SwitchCase": 1 }],
"no-caller": "error",
"no-cond-assign": [
"error",
"except-parens"
],
"eqeqeq": "off",
"no-cond-assign": ["error", "except-parens"],
"no-eq-null": "error",
"new-cap": "off",
"no-undef": "error",
"no-unused-vars": "error",
"no-unused-expressions": "error",
"no-eval": "error",
"comma-style": [
"error",
"last"
],
"dot-notation": "off",
"no-global-getComputedStyle": "error",
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 1 }],
"no-undef": "error",
"no-unused-expressions": "error",
"no-unused-vars": "error",
"quotes": ["error", "single"],
"semi": "error",
"valid-jsdoc": "error",
"no-global-getComputedStyle": "error",
"jsdoc/check-tag-names": 1,
"jsdoc/check-types": 1,
"jsdoc/newline-after-description": 1,
@@ -58,5 +41,12 @@
"jsdoc/require-param": 1,
"jsdoc/require-param-type": 1,
"jsdoc/require-returns-type": 1
},
"settings": {
"jsdoc": {
"additionalTagNames": {
"customTags": ["memberOf", "optionName", "optionProp"]
}
}
}
}

2
.gitignore vendored
View File

@@ -2,7 +2,7 @@ node_modules
test/coverage
test/*.html
gh-pages
modernizr.min.js
modernizr.js
modernizr-test.js
metadata.json
build

View File

@@ -5,5 +5,5 @@ gh-pages
appveyor.yml
Gruntfile.js
metadata.json
modernizr.min.js
modernizr.js
.*

View File

@@ -1,5 +1,3 @@
/*global module */
var browsers = require('./test/browser/sauce-browsers.json');
var serveStatic = require('serve-static');
@@ -16,12 +14,17 @@ module.exports = function(grunt) {
'!test/browser/integration/*.js'
]);
var integrationTests = grunt.file.expand([
'test/browser/integration/*.js'
]);
var nodeTests = grunt.file.expand([
'test/universal/**/*.js',
'test/node/**/*.js'
]);
grunt.initConfig({
env: {
nodeTests: [
'test/universal/**/*.js',
'test/node/**/*.js'
],
browserTests: browserTests,
coverage: {
APP_DIR_FOR_CODE_COVERAGE: 'test/coverage/instrument',
@@ -29,7 +32,9 @@ module.exports = function(grunt) {
'http://localhost:9999/test/unit.html',
'http://localhost:9999/test/index.html'
]
}
},
integrationTests: integrationTests,
nodeTests: nodeTests
},
generate: {
dest: './dist/modernizr-build.js'
@@ -52,10 +57,10 @@ module.exports = function(grunt) {
},
eslint: {
target: [
'<%= env.nodeTests%>',
'<%= env.nodeTests %>',
'<%= env.browserTests %>',
'<%= env.integrationTests %>',
'test/browser/setup.js',
'test/browser/integration/*.js',
'Gruntfile.js',
'src/*.js',
'lib/*.js',
@@ -83,7 +88,7 @@ module.exports = function(grunt) {
options: {
data: {
unitTests: browserTests,
integrationTests: grunt.file.expand(['test/browser/integration/*.js'])
integrationTests: integrationTests
}
},
files: {
@@ -164,7 +169,7 @@ module.exports = function(grunt) {
reporter: 'dot',
timeout: 5000
},
src: ['<%= env.nodeTests%>']
src: ['<%= env.nodeTests %>']
}
},
instrument: {
@@ -219,6 +224,14 @@ module.exports = function(grunt) {
grunt.registerTask('build', ['clean', 'generate']);
/**
* Performs the code coverage tasks provided by Istanbul
*/
grunt.registerTask('coverage', ['env:coverage', 'instrument', 'mochaTest', 'storeCoverage', 'makeReport']);
/**
* Default task for creating a modernizr build using lib/config-all.json
*/
grunt.registerTask('default', ['eslint', 'build']);
var tests = ['clean', 'eslint', 'pug', 'instrument', 'env:coverage', 'nodeTests'];

View File

@@ -4,9 +4,7 @@
"property": "audioautoplay",
"authors": ["Jordy van Dortmont"],
"tags": ["audio"],
"async" : true,
"warnings": [],
"knownBugs": []
"async": true
}
!*/
/* DOC

View File

@@ -3,7 +3,6 @@
"name": "canvas blending support",
"property": "canvasblending",
"tags": ["canvas"],
"async" : false,
"notes": [{
"name": "HTML5 Spec",
"href": "https://dvcs.w3.org/hg/FXTF/rawfile/tip/compositing/index.html#blending"

View File

@@ -4,7 +4,6 @@
"property": ["todataurljpeg", "todataurlpng", "todataurlwebp"],
"tags": ["canvas"],
"builderAliases": ["canvas_todataurl_type"],
"async" : false,
"notes": [{
"name": "MDN article",
"href": "https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement.toDataURL"

View File

@@ -3,7 +3,6 @@
"name": "canvas winding support",
"property": "canvaswinding",
"tags": ["canvas"],
"async" : false,
"notes": [{
"name": "Article",
"href": "https://blogs.adobe.com/webplatform/2013/01/30/winding-rules-in-canvas/"

View File

@@ -9,9 +9,7 @@
"name": "W3C Editor's Draft",
"href": "https://www.w3.org/TR/WebCryptoAPI/"
}],
"polyfills": [
"polycrypt"
]
"polyfills": ["polycrypt"]
}
!*/
/* DOC

View File

@@ -9,9 +9,7 @@
"name": "W3C Editors Draft",
"href": "https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#RandomSource-method-getRandomValues"
}],
"polyfills": [
"polycrypt"
]
"polyfills": ["polycrypt"]
}
!*/
/* DOC

View File

@@ -3,9 +3,7 @@
"name": "CSS text-overflow ellipsis",
"property": "ellipsis",
"caniuse": "text-overflow",
"polyfills": [
"text-overflow"
],
"polyfills": ["text-overflow"],
"tags": ["css"]
}
!*/

View File

@@ -99,7 +99,6 @@ define(['Modernizr', 'prefixes', 'createElement', 'testAllProps', 'addTest'], fu
div.appendChild(span);
document.body.insertBefore(div, firstChild);
/* get height of unwrapped text */
span.innerHTML = 'mm';
spanSize = span.offsetHeight;
@@ -152,7 +151,6 @@ define(['Modernizr', 'prefixes', 'createElement', 'testAllProps', 'addTest'], fu
document.body.insertBefore(div, firstChild);
document.body.insertBefore(dummy, div);
/* reset the selection to the dummy input element, i.e. BEFORE the div container
* stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area */
if (dummy.setSelectionRange) {

View File

@@ -8,7 +8,7 @@
"name": "Chrome bug report",
"href":"https://code.google.com/p/chromium/issues/detail?id=322972"
}],
"warnings": [ "using position:sticky on anything but top aligned elements is buggy in Chrome < 37 and iOS <=7+" ]
"warnings": ["using position:sticky on anything but top aligned elements is buggy in Chrome < 37 and iOS <=7+"]
}
!*/
define(['Modernizr', 'createElement', 'prefixes'], function(Modernizr, createElement, prefixes) {

View File

@@ -62,7 +62,6 @@ define(['Modernizr', 'createElement', 'docElement', 'isSVG', 'prefixed'], functi
var flowedRect, delta;
var plainRect = content.getBoundingClientRect();
content.style[flowIntoProperty] = flowName;
flowedRect = content.getBoundingClientRect();

View File

@@ -10,9 +10,7 @@
},{
"name": "MDN documentation",
"href": "https://developer.mozilla.org/en-US/docs/Web/API/navigator.registerProtocolHandler"
}],
"warnings": [],
"polyfills": []
}]
}
!*/
/* DOC

View File

@@ -10,9 +10,7 @@
},{
"name": "HTML5 Rocks tutorial",
"href": "https://www.html5rocks.com/en/tutorials/doodles/gamepad/#toc-featuredetect"
}],
"warnings": [],
"polyfills": []
}]
}
!*/
/* DOC

View File

@@ -9,7 +9,7 @@
"name": "WhatWG Spec",
"href": "https://html.spec.whatwg.org/multipage/embedded-content.html#attr-iframe-sandbox"
}],
"knownBugs": [ "False-positive on Firefox < 29" ]
"knownBugs": ["False-positive on Firefox < 29"]
}
!*/
/* DOC

View File

@@ -10,9 +10,7 @@
"name": "Wufoo demo",
"href": "https://www.wufoo.com/html5/attributes/13-formaction.html"
}],
"polyfills": [
"webshims"
]
"polyfills": ["webshims"]
}
!*/
/* DOC

View File

@@ -10,9 +10,7 @@
"name": "Wufoo demo",
"href": "https://www.wufoo.com/html5/attributes/16-formenctype.html"
}],
"polyfills": [
"html5formshim"
]
"polyfills": ["html5formshim"]
}
!*/
/* DOC

View File

@@ -9,9 +9,7 @@
"name": "Wufoo demo",
"href": "https://www.wufoo.com/html5/attributes/14-formmethod.html"
}],
"polyfills": [
"webshims"
]
"polyfills": ["webshims"]
}
!*/
/* DOC

View File

@@ -10,9 +10,7 @@
"name": "Wufoo demo",
"href": "https://www.wufoo.com/html5/attributes/12-formnovalidate.html"
}],
"polyfills": [
"html5formshim"
]
"polyfills": ["html5formshim"]
}
!*/
/* DOC

View File

@@ -10,9 +10,7 @@
"name": "Wufoo demo",
"href": "https://www.wufoo.com/html5/attributes/15-formtarget.html"
}],
"polyfills": [
"html5formshim"
]
"polyfills": ["html5formshim"]
}
!*/
/* DOC

View File

@@ -1,11 +1,7 @@
/*!
{
"name": "Hover Media Query",
"property": "hovermq",
"notes": [{
"name": "//Name of reference document",
"href": "//URL of reference document"
}]
"property": "hovermq"
}
!*/
/* DOC

View File

@@ -1,11 +1,7 @@
/*!
{
"name": "Pointer Media Query",
"property": "pointermq",
"notes": [{
"name": "//Name of reference document",
"href": "//URL of reference document"
}]
"property": "pointermq"
}
!*/
/* DOC

View File

@@ -14,9 +14,7 @@
"name": "Changes in Chrome to Notifications API due to Service Worker Push Notifications",
"href": "https://developers.google.com/web/updates/2015/05/Notifying-you-of-notificiation-changes"
}],
"knownBugs": [
"Possibility of false-positive on Chrome for Android if permissions we're granted for a website prior to Chrome 44."
],
"knownBugs": ["Possibility of false-positive on Chrome for Android if permissions we're granted for a website prior to Chrome 44."],
"polyfills": ["desktop-notify", "html5-notifications"]
}
!*/

View File

@@ -4,9 +4,6 @@
"property": "localstorage",
"caniuse": "namevalue-storage",
"tags": ["storage"],
"knownBugs": [],
"notes": [],
"warnings": [],
"polyfills": [
"joshuabell-polyfill",
"cupcake",

View File

@@ -7,9 +7,7 @@
"name": "MDN documentation",
"href": "https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea"
}],
"polyfills": [
"maxlength"
]
"polyfills": ["maxlength"]
}
!*/
/* DOC

View File

@@ -36,6 +36,5 @@ define(['Modernizr', 'createElement', 'testStyles', 'isSVG'], function(Modernizr
});
return bool;
});
});

View File

@@ -4,9 +4,7 @@
"property": "video",
"caniuse": "video",
"tags": ["html5"],
"knownBugs": [
"Without QuickTime, `Modernizr.video.h264` will be `undefined`; https://github.com/Modernizr/Modernizr/issues/546"
],
"knownBugs": ["Without QuickTime, `Modernizr.video.h264` will be `undefined`; https://github.com/Modernizr/Modernizr/issues/546"],
"polyfills": [
"html5media",
"mediaelementjs",

View File

@@ -6,7 +6,6 @@
"builderAliases": ["webgl_extensions"],
"async" : true,
"authors": ["Ilmari Heikkinen"],
"knownBugs": [],
"notes": [{
"name": "Kronos extensions registry",
"href": "https://www.khronos.org/registry/webgl/extensions/"

View File

@@ -4,8 +4,7 @@
"property": "xdomainrequest",
"tags": ["cors", "xdomainrequest", "ie9", "ie8"],
"authors": ["Ivan Pan (@hypotenuse)"],
"notes": [
{
"notes": [{
"name": "MDN documentation",
"href": "https://developer.mozilla.org/en-US/docs/Web/API/XDomainRequest"
},

13
inch.json Normal file
View File

@@ -0,0 +1,13 @@
{
"files": {
"included": [
"feature-detects/",
"src/"
],
"excluded": [
"lib/",
"src/html5printshiv.js",
"src/html5shiv.js"
]
}
}

View File

@@ -1,4 +1,4 @@
// this file configures require.js based on enviroment
// this file configures require.js based on environment
'use strict';
var inBrowser = typeof define === 'function' && typeof define.amd === 'object';
@@ -95,7 +95,6 @@ function build(generate, generateBanner, pkg) {
}
cb(output);
};
requirejs.optimize(requireConfig);

View File

@@ -3,5 +3,5 @@
module.exports = {
build: require('./build'),
metadata: require('./metadata'),
options: require('./options'),
options: require('./options')
};

View File

@@ -137,5 +137,4 @@ function metadata(cb) {
return tests;
}
module.exports = metadata;

View File

@@ -32,7 +32,6 @@ function options(cb, allMetadata) {
'example',
'function',
'memberOf',
'memberof',
'name',
'optionName',
'optionProp',
@@ -79,7 +78,6 @@ function options(cb, allMetadata) {
})
.flatten()
.value();
});
if (cb) {
@@ -87,7 +85,6 @@ function options(cb, allMetadata) {
}
return opts;
}
module.exports = options;

4801
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,7 @@
},
"devDependencies": {
"@alrra/travis-scripts": "^3.0.1",
"eslint": "^5.1.0",
"eslint": "^5.2.0",
"eslint-plugin-jsdoc": "^3.7.1",
"expect.js": "^0.3.1",
"grunt": "^1.0.3",
@@ -53,14 +53,6 @@
"bugs": {
"url": "https://github.com/Modernizr/Modernizr/issues"
},
"inch": {
"files": {
"included": [
"feature-detects/",
"src/"
]
}
},
"keywords": [
"modernizr",
"html5",

View File

@@ -1,12 +1,10 @@
define(['tests'], function(tests) {
/**
*
* ModernizrProto is the constructor for Modernizr
*
* @class
* @access public
*/
var ModernizrProto = {
// The current version, dummy
_version: '__VERSION__',

View File

@@ -8,12 +8,13 @@ define(['ModernizrProto', 'Modernizr', 'hasOwnProp', 'setClasses'], function(Mod
* asynchronous, they may not finish before your scripts run. As a result you
* will get a possibly false negative `undefined` value.
*
* @memberof Modernizr
* @memberOf Modernizr
* @name Modernizr.on
* @access public
* @function on
* @param {string} feature - String name of the feature detect
* @param {function} cb - Callback function returning a Boolean - true if feature is supported, false if not
* @param {Function} cb - Callback function returning a Boolean - true if feature is supported, false if not
* @returns {void}
* @example
*
* ```js
@@ -26,7 +27,6 @@ define(['ModernizrProto', 'Modernizr', 'hasOwnProp', 'setClasses'], function(Mod
* });
* ```
*/
ModernizrProto.on = function(feature, cb) {
// Create the list of listeners if it doesn't exist
if (!this._l[feature]) {
@@ -49,15 +49,15 @@ define(['ModernizrProto', 'Modernizr', 'hasOwnProp', 'setClasses'], function(Mod
* _trigger is the private function used to signal test completion and run any
* callbacks registered through [Modernizr.on](#modernizr-on)
*
* @memberof Modernizr
* @memberOf Modernizr
* @name Modernizr._trigger
* @access private
* @function _trigger
* @param {string} feature - string name of the feature detect
* @param {function|boolean} [res] - A feature detection function, or the boolean =
* @param {Function|boolean} [res] - A feature detection function, or the boolean =
* result of a feature detection function
* @returns {void}
*/
ModernizrProto._trigger = function(feature, res) {
if (!this._l[feature]) {
return;
@@ -81,20 +81,22 @@ define(['ModernizrProto', 'Modernizr', 'hasOwnProp', 'setClasses'], function(Mod
/**
* addTest allows you to define your own feature detects that are not currently
* included in Modernizr (under the covers it's the exact same code Modernizr
* uses for its own [feature detections](https://github.com/Modernizr/Modernizr/tree/master/feature-detects)). Just like the official detects, the result
* uses for its own [feature detections](https://github.com/Modernizr/Modernizr/tree/master/feature-detects)).
* Just like the official detects, the result
* will be added onto the Modernizr object, as well as an appropriate className set on
* the html element when configured to do so
*
* @memberof Modernizr
* @memberOf Modernizr
* @name Modernizr.addTest
* @optionName Modernizr.addTest()
* @optionProp addTest
* @access public
* @function addTest
* @param {string|object} feature - The string name of the feature detect, or an
* @param {string|Object} feature - The string name of the feature detect, or an
* object of feature detect names and test
* @param {function|boolean} test - Function returning true if feature is supported,
* @param {Function|boolean} test - Function returning true if feature is supported,
* false if not. Otherwise a boolean representing the results of a feature detection
* @returns {Object} the Modernizr object to allow chaining
* @example
*
* The most common way of creating your own feature detects is by calling
@@ -146,7 +148,6 @@ define(['ModernizrProto', 'Modernizr', 'hasOwnProp', 'setClasses'], function(Mod
* There is really no difference between the first methods and this one, it is
* just a convenience to let you write more readable code.
*/
function addTest(feature, test) {
if (typeof feature === 'object') {

View File

@@ -3,7 +3,7 @@ define(['ModernizrProto', 'cssomPrefixes'], function(ModernizrProto, prefixes) {
* atRule returns a given CSS property at-rule (eg @keyframes), possibly in
* some prefixed form, or false, in the case of an unsupported rule
*
* @memberof Modernizr
* @memberOf Modernizr
* @name Modernizr.atRule
* @optionName Modernizr.atRule()
* @optionProp atRule
@@ -23,9 +23,7 @@ define(['ModernizrProto', 'cssomPrefixes'], function(ModernizrProto, prefixes) {
* // keyframes === `false`
* }
* ```
*
*/
var atRule = function(prop) {
var length = prefixes.length;
var cssrule = window.CSSRule;

View File

@@ -6,11 +6,11 @@ define(function() {
*
* @access private
* @function computedStyle
* @param {HTMLElement|SVGElement} - The element we want to find the computed styles of
* @param {string|null} [pseudoSelector]- An optional pseudo element selector (e.g. :before), of null if none
* @returns {CSSStyleDeclaration}
* @param {HTMLElement|SVGElement} elem - The element we want to find the computed styles of
* @param {string|null} [pseudo] - An optional pseudo element selector (e.g. :before), of null if none
* @param {string} prop - A CSS property
* @returns {CSSStyleDeclaration} the value of the specified CSS property
*/
function computedStyle(elem, pseudo, prop) {
var result;

View File

@@ -1,5 +1,4 @@
define(function() {
/**
* contains checks to see if a string contains another string
*
@@ -7,9 +6,8 @@ define(function() {
* @function contains
* @param {string} str - The string we want to check for substrings
* @param {string} substr - The substring we want to search the first string for
* @returns {boolean}
* @returns {boolean} true if and only if the first string 'str' contains the second string 'substr'
*/
function contains(str, substr) {
return !!~('' + str).indexOf(substr);
}

View File

@@ -9,7 +9,6 @@ define(['isSVG'], function(isSVG) {
* @function createElement
* @returns {HTMLElement|SVGElement} An HTML or SVG element
*/
function createElement() {
if (typeof document.createElement !== 'function') {
// This is the case in IE7, where the type of createElement is "object".

View File

@@ -8,11 +8,11 @@ define(function() {
* @param {string} name - String name of kebab-case prop we want to convert
* @returns {string} The camelCase version of the supplied name
*/
function cssToDOM(name) {
return name.replace(/([a-z])-([a-z])/g, function(str, m1, m2) {
return m1 + m2.toUpperCase();
}).replace(/^-/, '');
}
return cssToDOM;
});

View File

@@ -5,7 +5,6 @@ define(function() {
* @access private
* @returns {HTMLElement|SVGElement} The root element of the document
*/
var docElement = document.documentElement;
return docElement;
});

View File

@@ -2,7 +2,7 @@ define(['ModernizrProto', 'omPrefixes'], function(ModernizrProto, omPrefixes) {
/**
* List of JavaScript DOM values used for tests
*
* @memberof Modernizr
* @memberOf Modernizr
* @name Modernizr._domPrefixes
* @optionName Modernizr._domPrefixes
* @optionProp domPrefixes
@@ -16,7 +16,6 @@ define(['ModernizrProto', 'omPrefixes'], function(ModernizrProto, omPrefixes) {
* Modernizr._domPrefixes === [ "Moz", "O", "ms", "Webkit" ];
* ```
*/
var domPrefixes = (ModernizrProto._config.usePrefixes ? omPrefixes.toLowerCase().split(' ') : []);
ModernizrProto._domPrefixes = domPrefixes;
return domPrefixes;

View File

@@ -8,11 +8,11 @@ define(function() {
* @param {string} name - String name of camelCase prop we want to convert
* @returns {string} The kebab-case version of the supplied name
*/
function domToCSS(name) {
return name.replace(/([A-Z])/g, function(str, m1) {
return '-' + m1.toLowerCase();
}).replace(/^ms-/, '-ms-');
}
return domToCSS;
});

View File

@@ -4,11 +4,10 @@ define(function() {
*
* @access private
* @function fnBind
* @param {function} fn - a function you want to change `this` reference to
* @param {object} that - the `this` you want to call the function with
* @returns {function} The wrapped version of the supplied function
* @param {Function} fn - a function you want to change `this` reference to
* @param {Object} that - the `this` you want to call the function with
* @returns {Function} The wrapped version of the supplied function
*/
function fnBind(fn, that) {
return function() {
return fn.apply(that, arguments);

View File

@@ -5,12 +5,11 @@ define(['lodash'], function(_) {
*
* @access private
* @function generate
* @param {object} [config] - A configuration object
* @param {array} [config.options[]] - An array of options to include in the build
* @param {array} [config.feature-detects[]] - An array of the feature detects to include
* @param {Object} [config] - A configuration object
* @param {Array} [config.options] - An array of options to include in the build
* @param {Array} [config.feature-detects] - An array of the feature detects to include
* @returns {string} A string of the require.js build
*/
return function generate(config) {
// Set some defaults
if (!config) {
@@ -70,8 +69,7 @@ define(['lodash'], function(_) {
output += ' delete ModernizrProto.addAsyncTest;\n' +
'\n';
// TODO:: if there's a way to figure out if there will be no
// items in this queue, then we could avoid the code.
// TODO:: if there's a way to figure out if there will be no items in this queue, then we could avoid the code.
output += ' // Run the things that are supposed to run after the tests\n' +
' for (var i = 0; i < Modernizr._q.length; i++) {\n' +
' Modernizr._q[i]();\n' +

View File

@@ -8,7 +8,6 @@ define(['createElement', 'isSVG'], function(createElement, isSVG) {
* @returns {HTMLElement|SVGElement} Returns the real body of a document, or an
* artificially created element that stands in for the body
*/
function getBody() {
// After page load injecting a fake body doesn't work so check if body exists
var body = document.body;

View File

@@ -2,14 +2,14 @@ define(['ModernizrProto', 'createElement'], function(ModernizrProto, createEleme
/**
* Modernizr.hasEvent() detects support for a given event
*
* @memberof Modernizr
* @memberOf Modernizr
* @name Modernizr.hasEvent
* @optionName Modernizr.hasEvent()
* @optionProp hasEvent
* @access public
* @function hasEvent
* @param {string|*} eventName - the name of an event to test for (e.g. "resize")
* @param {Element|string} [element=HTMLDivElement] - is the element|document|window|tagName to test on
* @param {string|*} eventName - the name of an event to test for (e.g. "resize")
* @param {Element|string} [element=HTMLDivElement] - is the element|document|window|tagName to test on
* @returns {boolean}
* @example
* `Modernizr.hasEvent` lets you determine if the browser supports a supplied event.
@@ -25,9 +25,7 @@ define(['ModernizrProto', 'createElement'], function(ModernizrProto, createEleme
* ```js
* hasEvent('devicelight', window) // true;
* ```
*
*/
var hasEvent = (function() {
// Detect whether event support can be detected via `in`. Test on a DOM element
@@ -71,7 +69,6 @@ define(['ModernizrProto', 'createElement'], function(ModernizrProto, createEleme
return inner;
})();
ModernizrProto.hasEvent = hasEvent;
return hasEvent;
});

View File

@@ -1,17 +1,17 @@
define(['isSVG'], function(isSVG) {
/**
* @optionName html5printshiv
* @optionProp html5printshiv
*/
/**
* @optionName html5printshiv
* @optionProp html5printshiv
*/
// Take the html5 variable out of the html5shiv scope so we can return it.
var html5;
if (!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';
@@ -31,7 +31,7 @@ define(['isSVG'], function(isSVG) {
var expando = '_html5shiv';
/** The id for the the documents expando */
var expandoID = 0;
var expanID = 0;
/** Cached data for each document */
var expandoData = {};
@@ -52,8 +52,8 @@ define(['isSVG'], function(isSVG) {
var frag = document.createDocumentFragment();
return (
typeof frag.cloneNode == 'undefined' ||
typeof frag.createDocumentFragment == 'undefined' ||
typeof frag.createElement == 'undefined'
typeof frag.createDocumentFragment == 'undefined' ||
typeof frag.createElement == 'undefined'
);
}());
} catch(e) {
@@ -119,9 +119,9 @@ define(['isSVG'], function(isSVG) {
var data = expandoData[ownerDocument[expando]];
if (!data) {
data = {};
expandoID++;
ownerDocument[expando] = expandoID;
expandoData[expandoID] = data;
expanID++;
ownerDocument[expando] = expanID;
expandoData[expanID] = data;
}
return data;
}
@@ -211,16 +211,16 @@ define(['isSVG'], function(isSVG) {
};
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
'var n=f.cloneNode(),c=n.createElement;' +
'h.shivMethods&&(' +
// unroll the `createElement` calls
getElements().join().replace(/[\w\-:]+/g, function(nodeName) {
data.createElem(nodeName);
data.frag.createElement(nodeName);
return 'c("' + nodeName + '")';
}) +
'var n=f.cloneNode(),c=n.createElement;' +
'h.shivMethods&&(' +
// unroll the `createElement` calls
getElements().join().replace(/[\w\-:]+/g, function(nodeName) {
data.createElem(nodeName);
data.frag.createElement(nodeName);
return 'c("' + nodeName + '")';
}) +
');return n}'
)(html5, data.frag);
)(html5, data.frag);
}
/*--------------------------------------------------------------------------*/
@@ -239,13 +239,13 @@ define(['isSVG'], function(isSVG) {
if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
data.hasCSS = !!addStyleSheet(ownerDocument,
// corrects block display not defined in IE6/7/8/9
'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
// adds styling not present in IE6/7/8/9
'mark{background:#FF0;color:#000}' +
// hides non-rendered elements
'template{display:none}'
);
// corrects block display not defined in IE6/7/8/9
'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
// adds styling not present in IE6/7/8/9
'mark{background:#FF0;color:#000}' +
// hides non-rendered elements
'template{display:none}'
);
}
if (!supportsUnknownElements) {
shivMethods(ownerDocument, data);
@@ -342,10 +342,10 @@ define(['isSVG'], function(isSVG) {
var docEl = document.documentElement;
return !(
typeof document.namespaces == 'undefined' ||
typeof document.parentWindow == 'undefined' ||
typeof docEl.applyElement == 'undefined' ||
typeof docEl.removeNode == 'undefined' ||
typeof window.attachEvent == 'undefined'
typeof document.parentWindow == 'undefined' ||
typeof docEl.applyElement == 'undefined' ||
typeof docEl.removeNode == 'undefined' ||
typeof window.attachEvent == 'undefined'
);
}());
@@ -530,7 +530,7 @@ define(['isSVG'], function(isSVG) {
module.exports = html5;
}
}(typeof window !== 'undefined' ? window : this, document));
}(typeof window !== "undefined" ? window : this, document));
}
return html5;

55
src/html5shiv.js vendored
View File

@@ -1,8 +1,8 @@
define(['isSVG'], function(isSVG) {
/**
* @optionName html5shiv
* @optionProp html5shiv
*/
/**
* @optionName html5shiv
* @optionProp html5shiv
*/
// Take the html5 variable out of the html5shiv scope so we can return it.
var html5;
@@ -11,6 +11,7 @@ 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';
@@ -30,7 +31,7 @@ define(['isSVG'], function(isSVG) {
var expando = '_html5shiv';
/** The id for the the documents expando */
var expandoID = 0;
var expanID = 0;
/** Cached data for each document */
var expandoData = {};
@@ -51,8 +52,8 @@ define(['isSVG'], function(isSVG) {
var frag = document.createDocumentFragment();
return (
typeof frag.cloneNode == 'undefined' ||
typeof frag.createDocumentFragment == 'undefined' ||
typeof frag.createElement == 'undefined'
typeof frag.createDocumentFragment == 'undefined' ||
typeof frag.createElement == 'undefined'
);
}());
} catch(e) {
@@ -118,9 +119,9 @@ define(['isSVG'], function(isSVG) {
var data = expandoData[ownerDocument[expando]];
if (!data) {
data = {};
expandoID++;
ownerDocument[expando] = expandoID;
expandoData[expandoID] = data;
expanID++;
ownerDocument[expando] = expanID;
expandoData[expanID] = data;
}
return data;
}
@@ -210,16 +211,16 @@ define(['isSVG'], function(isSVG) {
};
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
'var n=f.cloneNode(),c=n.createElement;' +
'h.shivMethods&&(' +
// unroll the `createElement` calls
getElements().join().replace(/[\w\-:]+/g, function(nodeName) {
data.createElem(nodeName);
data.frag.createElement(nodeName);
return 'c("' + nodeName + '")';
}) +
'var n=f.cloneNode(),c=n.createElement;' +
'h.shivMethods&&(' +
// unroll the `createElement` calls
getElements().join().replace(/[\w\-:]+/g, function(nodeName) {
data.createElem(nodeName);
data.frag.createElement(nodeName);
return 'c("' + nodeName + '")';
}) +
');return n}'
)(html5, data.frag);
)(html5, data.frag);
}
/*--------------------------------------------------------------------------*/
@@ -238,13 +239,13 @@ define(['isSVG'], function(isSVG) {
if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
data.hasCSS = !!addStyleSheet(ownerDocument,
// corrects block display not defined in IE6/7/8/9
'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
// adds styling not present in IE6/7/8/9
'mark{background:#FF0;color:#000}' +
// hides non-rendered elements
'template{display:none}'
);
// corrects block display not defined in IE6/7/8/9
'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
// adds styling not present in IE6/7/8/9
'mark{background:#FF0;color:#000}' +
// hides non-rendered elements
'template{display:none}'
);
}
if (!supportsUnknownElements) {
shivMethods(ownerDocument, data);
@@ -331,7 +332,7 @@ define(['isSVG'], function(isSVG) {
module.exports = html5;
}
}(typeof window !== 'undefined' ? window : this, document));
}(typeof window !== "undefined" ? window : this, document));
}
return html5;
});

View File

@@ -5,12 +5,11 @@ define(['ModernizrProto', 'docElement', 'createElement', 'getBody'], function(Mo
* @access private
* @function injectElementWithStyles
* @param {string} rule - String representing a css rule
* @param {function} callback - A function that is used to test the injected element
* @param {Function} callback - A function that is used to test the injected element
* @param {number} [nodes] - An integer representing the number of additional nodes you want injected
* @param {string[]} [testnames] - An array of strings that are used as ids for the additional nodes
* @returns {boolean}
* @returns {boolean} the result of the specified callback test
*/
function injectElementWithStyles(rule, callback, nodes, testnames) {
var mod = 'modernizr';
var style;
@@ -69,7 +68,6 @@ define(['ModernizrProto', 'docElement', 'createElement', 'getBody'], function(Mo
}
return !!ret;
}
return injectElementWithStyles;

View File

@@ -6,11 +6,11 @@ define(function() {
* @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}
* @returns {boolean} true if the typeof the first parameter is exactly the specified type, false otherwise
*/
function is(obj, type) {
return typeof obj === type;
}
return is;
});

View File

@@ -5,7 +5,7 @@ define(['docElement'], function(docElement) {
* @access private
* @returns {boolean}
*/
var isSVG = docElement.nodeName.toLowerCase() === 'svg';
return isSVG;
});

View File

@@ -1,17 +1,4 @@
define(['ModernizrProto'], function(ModernizrProto) {
/**
* Previously, Modernizr.load was an alias for yepnope. Since yepnope was
* deprecated, we removed it as well. It is not available on the website builder,
* this is only included as an improved warning to those who build a custom
* version locally.
*
* @memberof Modernizr
* @name Modernizr.load
* @access private
* @function load
*
*/
var err = function() {};
var warn = function() {};
@@ -27,6 +14,17 @@ define(['ModernizrProto'], function(ModernizrProto) {
};
}
/**
* Previously, Modernizr.load was an alias for yepnope. Since yepnope was
* deprecated, we removed it as well. It is not available on the website builder,
* this is only included as an improved warning to those who build a custom
* version locally.
*
* @memberOf Modernizr
* @name Modernizr.load
* @function load
* @returns {void}
*/
ModernizrProto.load = function() {
if ('yepnope' in window) {
warn('yepnope.js (aka Modernizr.load) is no longer included as part of Modernizr. yepnope appears to be available on the page, so well use it to handle this call to Modernizr.load, but please update your code to use yepnope directly.\n See http://github.com/Modernizr/Modernizr/issues/1182 for more information.');
@@ -35,5 +33,4 @@ define(['ModernizrProto'], function(ModernizrProto) {
err('yepnope.js (aka Modernizr.load) is no longer included as part of Modernizr. Get it from http://yepnopejs.com. See http://github.com/Modernizr/Modernizr/issues/1182 for more information.');
}
};
});

View File

@@ -4,7 +4,6 @@ define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
*
* @access private
*/
var modElem = {
elem: createElement('modernizr')
};

View File

@@ -4,7 +4,7 @@ define(['ModernizrProto', 'injectElementWithStyles'], function(ModernizrProto, i
* adapted from matchMedia polyfill by Scott Jehl and Paul Irish
* gist.github.com/786768
*
* @memberof Modernizr
* @memberOf Modernizr
* @name Modernizr.mq
* @optionName Modernizr.mq()
* @optionProp mq
@@ -41,11 +41,9 @@ define(['ModernizrProto', 'injectElementWithStyles'], function(ModernizrProto, i
* Modernizr.mq('only all'); // true if MQ are supported, false if not
* ```
*
*
* Note that if the browser does not support media queries (e.g. old IE) mq will
* always return false.
*/
var mq = (function() {
var matchMedia = window.matchMedia || window.msMatchMedia;
if (matchMedia) {
@@ -68,7 +66,6 @@ define(['ModernizrProto', 'injectElementWithStyles'], function(ModernizrProto, i
};
})();
ModernizrProto.mq = mq;
return mq;

View File

@@ -9,7 +9,6 @@ define(['injectElementWithStyles', 'domToCSS', 'computedStyle'], function(inject
* @param {string} value - A string representing the value we want to check via @supports
* @returns {boolean|undefined} A boolean when @supports exists, undefined otherwise
*/
// Accepts a list of property names and a single value
// Returns `undefined` if native detection not available
function nativeTestProps(props, value) {

View File

@@ -14,7 +14,6 @@ define(function() {
* @access private
* @returns {string} The string representing the vendor-specific style properties
*/
var omPrefixes = 'Moz O ms Webkit';
return omPrefixes;
});

View File

@@ -2,14 +2,14 @@ define(['ModernizrProto', 'testPropsAll', 'cssToDOM', 'atRule'], function(Modern
/**
* prefixed returns the prefixed or nonprefixed property name variant of your input
*
* @memberof Modernizr
* @memberOf Modernizr
* @name Modernizr.prefixed
* @optionName Modernizr.prefixed()
* @optionProp prefixed
* @access public
* @function prefixed
* @param {string} prop - String name of the property to test for
* @param {object} [obj] - An object to test for the prefixed properties on
* @param {Object} [obj] - An object to test for the prefixed properties on
* @param {HTMLElement} [elem] - An element used to test specific properties against
* @returns {string|false} The string representing the (possibly prefixed) valid
* version of the property, or `false` when it is unsupported.
@@ -63,7 +63,6 @@ define(['ModernizrProto', 'testPropsAll', 'cssToDOM', 'atRule'], function(Modern
*
* If you want a similar lookup, but in kebab-case, you can use [prefixedCSS](#modernizr-prefixedcss).
*/
var prefixed = ModernizrProto.prefixed = function(prop, obj, elem) {
if (prop.indexOf('@') === 0) {
return atRule(prop);

View File

@@ -3,7 +3,7 @@ define(['ModernizrProto', 'prefixed', 'domToCSS'], function(ModernizrProto, pref
* prefixedCSS is just like [prefixed](#modernizr-prefixed), but the returned values are in
* kebab-case (e.g. `box-sizing`) rather than camelCase (boxSizing).
*
* @memberof Modernizr
* @memberOf Modernizr
* @name Modernizr.prefixedCSS
* @optionName Modernizr.prefixedCSS()
* @optionProp prefixedCSS
@@ -26,10 +26,10 @@ define(['ModernizrProto', 'prefixed', 'domToCSS'], function(ModernizrProto, pref
*
* Properties can be passed as both the DOM style camelCase or CSS style kebab-case.
*/
var prefixedCSS = ModernizrProto.prefixedCSS = function(prop) {
var prefixedProp = prefixed(prop);
return prefixedProp && domToCSS(prefixedProp);
};
return prefixedCSS;
});

View File

@@ -2,7 +2,7 @@ define(['ModernizrProto', 'domPrefixes', 'createElement'], function(ModernizrPro
/**
* prefixedCSSValue is a way test for prefixed css properties (e.g. display: -webkit-flex)
*
* @memberof Modernizr
* @memberOf Modernizr
* @name Modernizr.prefixedCSSValue
* @optionName Modernizr.prefixedCSSValue()
* @optionProp prefixedCSSValue
@@ -19,9 +19,7 @@ define(['ModernizrProto', 'domPrefixes', 'createElement'], function(ModernizrPro
* ```js
* Modernizr.prefixedCSSValue('background', 'linear-gradient(left, red, red)')
* ```
*
*/
var prefixedCSSValue = function(prop, value) {
var result = false;
var elem = createElement('div');

View File

@@ -3,7 +3,7 @@ define(['ModernizrProto'], function(ModernizrProto) {
* List of property values to set for css tests. See ticket #21
* http://git.io/vUGl4
*
* @memberof Modernizr
* @memberOf Modernizr
* @name Modernizr._prefixes
* @optionName Modernizr._prefixes
* @optionProp prefixes
@@ -30,7 +30,6 @@ define(['ModernizrProto'], function(ModernizrProto) {
* rule === 'display:flex; display:-webkit-flex; display:-moz-flex; display:-o-flex; display:-ms-flex; display:flex'
* ```
*/
// we use ['',''] rather than an empty array in order to allow a pattern of .`join()`ing prefixes to test
// values in feature detects to continue to work
var prefixes = (ModernizrProto._config.usePrefixes ? ' -webkit- -moz- -o- -ms- '.split(' ') : ['','']);

View File

@@ -4,11 +4,10 @@ define(function() {
*
* @access private
* @function roundedEquals
* @param {number} a
* @param {number} b
* @returns {boolean}
* @param {number} a - first integer
* @param {number} b - second integer
* @returns {boolean} true if the first integer is within 1 of the second, false otherwise
*/
function roundedEquals(a, b) {
return a - 1 === b || a === b || a + 1 === b;
}

View File

@@ -6,7 +6,6 @@ define(['Modernizr', 'docElement', 'isSVG'], function(Modernizr, docElement, isS
* @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) {
@@ -35,7 +34,6 @@ define(['Modernizr', 'docElement', 'isSVG'], function(Modernizr, docElement, isS
docElement.className = className;
}
}
}
return setClasses;

View File

@@ -6,7 +6,6 @@ define(['classes'], function(classes) {
*
* @access private
*/
var slice = classes.slice;
return slice;
});

View File

@@ -2,7 +2,7 @@ define(['ModernizrProto', 'testPropsAll'], function(ModernizrProto, testPropsAll
/**
* testAllProps determines whether a given CSS property is supported in the browser
*
* @memberof Modernizr
* @memberOf Modernizr
* @name Modernizr.testAllProps
* @optionName Modernizr.testAllProps()
* @optionProp testAllProps
@@ -11,6 +11,7 @@ define(['ModernizrProto', 'testPropsAll'], function(ModernizrProto, testPropsAll
* @param {string} prop - String naming the property to test (either camelCase or kebab-case)
* @param {string} [value] - String of the value to test
* @param {boolean} [skipValueTest=false] - Whether to skip testing that the value is supported when using non-native detection
* @returns {false|string} returns the string version of the property, or false if it is unsupported
* @example
*
* testAllProps determines whether a given CSS property, in some prefixed form,
@@ -35,10 +36,11 @@ define(['ModernizrProto', 'testPropsAll'], function(ModernizrProto, testPropsAll
* testAllProps('shapeOutside', 'content-box', true);
* ```
*/
function testAllProps(prop, value, skipValueTest) {
return testPropsAll(prop, undefined, undefined, value, skipValueTest);
}
ModernizrProto.testAllProps = testAllProps;
return testAllProps;
});

View File

@@ -3,7 +3,7 @@ define(['ModernizrProto', 'testProps'], function(ModernizrProto, testProps) {
* testProp() investigates whether a given style property is recognized
* Property names can be provided in either camelCase or kebab-case.
*
* @memberof Modernizr
* @memberOf Modernizr
* @name Modernizr.testProp
* @access public
* @optionName Modernizr.testProp()
@@ -12,7 +12,7 @@ define(['ModernizrProto', 'testProps'], function(ModernizrProto, testProps) {
* @param {string} prop - Name of the CSS property to check
* @param {string} [value] - Name of the CSS value to check
* @param {boolean} [useValue] - Whether or not to check the value if @supports isn't supported
* @returns {boolean}
* @returns {boolean} an empty string if the property is supported, undefined if its unsupported
* @example
*
* Just like [testAllProps](#modernizr-testallprops), only it does not check any vendor prefixed
@@ -32,9 +32,9 @@ define(['ModernizrProto', 'testProps'], function(ModernizrProto, testProps) {
* Modernizr.testProp('pointerEvents', 'penguin') // false
* ```
*/
var testProp = ModernizrProto.testProp = function(prop, value, useValue) {
return testProps([prop], undefined, value, useValue);
};
return testProp;
});

View File

@@ -3,8 +3,8 @@ define(['tests', 'Modernizr', 'classes', 'is'], function(tests, Modernizr, class
* Run through all tests and detect their support in the current UA.
*
* @access private
* @returns {void}
*/
function testRunner() {
var featureNames;
var feature;
@@ -39,7 +39,6 @@ define(['tests', 'Modernizr', 'classes', 'is'], function(tests, Modernizr, class
// 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];

View File

@@ -2,7 +2,7 @@ define(['ModernizrProto', 'injectElementWithStyles'], function(ModernizrProto, i
/**
* testStyles injects an element with style element and some CSS rules
*
* @memberof Modernizr
* @memberOf Modernizr
* @name Modernizr.testStyles
* @optionName Modernizr.testStyles()
* @optionProp testStyles
@@ -53,9 +53,7 @@ define(['ModernizrProto', 'injectElementWithStyles'], function(ModernizrProto, i
* elem.lastChild === document.getElementById('bar'); // true
* }, 2, ['foo', 'bar']);
* ```
*
*/
var testStyles = ModernizrProto.testStyles = injectElementWithStyles;
return testStyles;
});

View File

@@ -2,14 +2,12 @@ define(function() {
/**
* http://mathiasbynens.be/notes/xhr-responsetype-json#comment-4
*
* @author Mathias Bynens
* @access private
* @function testXhrType
* @param {string} type - String name of the XHR type you want to detect
* @returns {boolean}
* @author Mathias Bynens
* @returns {boolean} true if the responseType is of the specified type
*/
/* istanbul ignore next */
var testXhrType = function(type) {
if (typeof XMLHttpRequest === 'undefined') {
return false;

View File

@@ -8,7 +8,6 @@ define(function() {
* @function toStringFn
* @returns {function} An abstracted toString function
*/
var toStringFn = ({}).toString;
return toStringFn;
});

View File

@@ -219,7 +219,6 @@ window.caniusecb = function(caniuse) {
return;
}
// caniuse counts a partial support for CORS via the XDomainRequest,
// but thats not really cors - so skip the comparison.
if (o.feature === 'cors' && o.browser === 'IE' && o.version < 10) {
@@ -241,7 +240,6 @@ window.caniusecb = function(caniuse) {
});
}
// we breakout flexbox sniffing into three separate detects, which borks the caniuse mappings,
// since no browser supports all three
if (o.ciufeature === 'flexbox') {

View File

@@ -50,8 +50,6 @@ describe('prefixed autobind', function() {
});
}
// Moz only:
if (!_.isUndefined(document.mozFullScreen)) {
// boolean
@@ -61,7 +59,6 @@ describe('prefixed autobind', function() {
});
}
// Webkit-only.. takes advantage of Webkit's mixed case of prefixes
if (document.body.style.WebkitAnimation) {
// string

View File

@@ -87,7 +87,6 @@ describe('addTest', function() {
expect(ModernizrProto._l.fakeDetect.length).to.be(2);
});
it('triggers results if the detect already ran', function(done) {
Modernizr.fakeDetect = 'fake';
Modernizr._trigger = sinon.spy();

View File

@@ -17,7 +17,6 @@ describe('classes', function() {
});
});
it('is an array', function() {
expect(classes).to.be.an('array');
});

View File

@@ -17,7 +17,6 @@ describe('createElement', function() {
});
});
it('is a function', function() {
expect(createElement).to.be.a('function');
});

View File

@@ -1,9 +1,13 @@
describe('cssomPrefixes', function() {
/*
eslint no-unused-vars: [ "error", {
eslint no-unused-vars: ["error", {
"varsIgnorePattern": "cssomPrefixes"
}]
*/
*/
var cssomPrefixes;
var cleanup;
var req;
var setup = function(done, bool) {
return (function() {
define('ModernizrProto', [], function() {return {_config: {usePrefixes: bool}};});
@@ -21,10 +25,6 @@ describe('cssomPrefixes', function() {
req.undef('ModernizrProto');
};
var cssomPrefixes;
var cleanup;
var req;
before(function(done) {
define('package', [], function() {return {version: 'v9999'};});

View File

@@ -1,10 +1,11 @@
describe('domPrefixes', function() {
/*
eslint no-unused-vars: [ "error", {
eslint no-unused-vars: ["error", {
"varsIgnorePattern": "domPrefixes"
}]
*/
*/
var domPrefixes;
var cleanup;
var req;
var setup = function(done, bool) {
@@ -23,8 +24,6 @@ describe('domPrefixes', function() {
req.undef('domPrefixes');
req.undef('ModernizrProto');
};
var domPrefixes;
var cleanup;
before(function(done) {
define('package', [], function() {return {version: 'v9999'};});

View File

@@ -32,12 +32,10 @@ describe('hasEvent', function() {
expect(hasEvent('click', document)).to.be(true);
});
it('returns false when no event name is provided', function() {
expect(hasEvent()).to.be(false);
});
it('returns true when the event exists', function() {
expect(hasEvent('click')).to.be(true);
});

View File

@@ -1,9 +1,9 @@
describe('injectElementWithStyles', function() {
/*
eslint no-unused-vars: [ "error", {
eslint no-unused-vars: ["error", {
"varsIgnorePattern": "sinon"
}]
*/
*/
var injectElementWithStyles;
var originalBody;
var parentNode;
@@ -101,7 +101,6 @@ describe('injectElementWithStyles', function() {
injectElementWithStyles('', callback, 2, ['test', 'element']);
});
it('copes with a fake body', function(done) {
originalBody = document.body;

View File

@@ -17,7 +17,6 @@ describe('is', function() {
});
});
it('is a function', function() {
expect(is).to.be.a('function');
});

View File

@@ -1,15 +1,14 @@
describe('load', function() {
/*
eslint no-unused-vars: [ "error", {
eslint no-unused-vars: ["error", {
"varsIgnorePattern": "load"
}]
*/
*/
var ModernizrProto;
var cleanup;
var sinon;
var load;
before(function(done) {
define('ModernizrProto', [], function() {return {};});
@@ -36,7 +35,6 @@ describe('load', function() {
expect(ModernizrProto.load).to.be.a('function');
});
if (window.console && console.error) {
describe('errors', function() {

View File

@@ -38,7 +38,6 @@ describe('prefixed', function() {
define('cssToDOM', [], function() {return cssToDOM;});
define('atRule', [], function() {return atRule;});
req(['prefixed'], function(_prefixed) {
prefixed = _prefixed;

View File

@@ -7,7 +7,6 @@ describe('prefixedCSS', function() {
define('ModernizrProto', [], function() {return ModernizrProto;});
define('package', [], function() {return {version: 'v9999'};});
var req = requirejs.config({
context: Math.random().toString().slice(2),
baseUrl: '../src',

View File

@@ -1,9 +1,13 @@
describe('prefixes', function() {
/*
eslint no-unused-vars: [ "error", {
eslint no-unused-vars: ["error", {
"varsIgnorePattern": "prefixes"
}]
*/
*/
var prefixes;
var cleanup;
var req;
var setup = function(done, bool) {
return (function() {
define('ModernizrProto', [], function() {return {_config: {usePrefixes: bool}};});
@@ -14,15 +18,12 @@ describe('prefixes', function() {
});
})();
};
var teardown = function() {
prefixes = undefined;
req.undef('prefixes');
req.undef('ModernizrProto');
};
var prefixes;
var cleanup;
var req;
before(function(done) {
define('package', [], function() {return {};});

View File

@@ -1,9 +1,9 @@
describe('setClasses', function() {
/*
eslint no-unused-vars: [ "error", {
eslint no-unused-vars: ["error", {
"varsIgnorePattern": "setClasses"
}]
*/
*/
var setClasses;
var cleanup;
var elm;
@@ -27,6 +27,7 @@ describe('setClasses', function() {
});
})();
};
var teardown = function() {
setClasses = undefined;
req.undef('setClasses');
@@ -34,7 +35,6 @@ describe('setClasses', function() {
req.undef('Modernizr');
};
before(function(done) {
define('package', [], function() {return {};});
@@ -106,7 +106,6 @@ describe('setClasses', function() {
});
});
describe('enableJSClass enabled, with prefix', function() {
before(function(done) {
setup(done, {

View File

@@ -134,7 +134,6 @@ describe('testProps', function() {
// kebab-case should work too
});
afterEach(function() {
req.undef('mStyle');
req.undef('cssToDOM');

View File

@@ -3,7 +3,6 @@ describe('testStyles', function() {
var ModernizrProto;
var cleanup;
before(function(done) {
define('ModernizrProto', [], function() {return {};});

View File

@@ -17,7 +17,6 @@ describe('tests', function() {
});
});
it('is an array', function() {
expect(tests).to.be.an('array');
});

View File

@@ -17,7 +17,6 @@ describe('toStringFn', function() {
});
});
it('is an function', function() {
expect(toStringFn).to.be.an('function');
});

View File

@@ -149,7 +149,6 @@ describe('svg context unit tests', function() {
});
});
afterEach(function() {
object.parentNode.removeChild(object);
cleanup();

View File

@@ -5,7 +5,7 @@ define([], [
'caniuse': 'css3-boxsizing',
'polyfills': [],
'tags': [],
'builderAliases': [ ],
'builderAliases': [],
'notes': [{
'name': 'MDN Docs',
'href': 'http://developer.mozilla.org/en/CSS/box-sizing'

View File

@@ -3,7 +3,6 @@ var expect = require('expect.js');
var cp = require('child_process');
var Modernizr = require(root + 'lib/cli');
describe('cli', function() {
it('exposes a build function', function() {

View File

@@ -10,7 +10,6 @@ var schema = Joi.array().items(
})
);
describe('cli/options', function() {
this.timeout(20000);

View File

@@ -13,7 +13,6 @@ if (typeof define !== 'function') {
var cleanup;
var req;
describe('build-query', function() {
var buildQuery;
@@ -86,7 +85,6 @@ describe('build-query', function() {
expect(query).to.be('?-boxsizing-dontmin');
});
after(function() {
cleanup();
});