Merge pull request #616 from google/mustard

Add "Cutting the Mustard" test
master
Addy Osmani 2015-01-27 10:23:37 +00:00
commit ad8cdb8c39
1 changed files with 11 additions and 2 deletions

View File

@ -11,7 +11,6 @@ var componentHandler = (function() {
var registeredComponents_ = []; var registeredComponents_ = [];
var createdComponents_ = []; var createdComponents_ = [];
/** /**
* Searches registered components for a class we are interested in using. * Searches registered components for a class we are interested in using.
* Optionally replaces a match with passed object if specified. * Optionally replaces a match with passed object if specified.
@ -151,5 +150,15 @@ var componentHandler = (function() {
window.addEventListener('load', function() { window.addEventListener('load', function() {
'use strict'; 'use strict';
componentHandler.upgradeAllRegistered(); /**
* Performs a "Cutting the mustard" test. If the browser supports the features
* tested, adds a wsk-js class to the <html> element. It then upgrades all WSK
* components requiring JavaScript.
*/
if ('classList' in document.createElement('div') && 'querySelector' in document && 'addEventListener' in window && Array.prototype.forEach) {
document.documentElement.classList.add('wsk-js');
componentHandler.upgradeAllRegistered();
} else {
componentHandler.upgradeElement = componentHandler.register = function () { };
}
}); });