setup.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Avoid `console` errors in browsers that lack a console
  2. if (!(window.console && console.log)) {
  3. (function() {
  4. var noop = function() {};
  5. var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'markTimeline', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn'];
  6. var length = methods.length;
  7. var console = window.console = {};
  8. while (length--) {
  9. console[methods[length]] = noop;
  10. }
  11. }());
  12. }
  13. // test helper object
  14. window.TEST = {
  15. // note some unique members of the Modernizr object
  16. inputs : ['input','inputtypes', 'textarea'],
  17. audvid : ['video','audio'],
  18. API : ['addTest', 'mq', 'hasEvent', 'testProp', 'testAllProps', 'testStyles', '_prefixes', '_domPrefixes', '_cssomPrefixes', 'prefixed'],
  19. extraclass: ['js'],
  20. privates : ['_enableHTML5','_version','_fontfaceready'],
  21. deprecated : [
  22. { oldish : 'crosswindowmessaging', newish : 'postmessage'},
  23. { oldish : 'historymanagement', newish : 'history'},
  24. ],
  25. // utility methods
  26. inArray: function(elem, array) {
  27. if (array.indexOf) {
  28. return array.indexOf(elem);
  29. }
  30. for (var i = 0, length = array.length; i < length; i++) {
  31. if (array[i] === elem) {
  32. return i;
  33. }
  34. }
  35. return -1;
  36. },
  37. trim : function(str){
  38. return str.replace(/^\s*/, "").replace(/\s*$/, "");
  39. }
  40. };