diff --git a/.jshintrc b/.jshintrc
index 8f86e76a5c..43e7313109 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -1,5 +1,6 @@
{
"expr": true,
"boss": true,
- "laxbreak": true
+ "laxbreak": true,
+ "predef": ["angular"]
}
diff --git a/src/components/datepicker/js/dateLocaleProvider.js b/src/components/datepicker/js/dateLocaleProvider.js
index e8407e5df3..4edc94f6eb 100644
--- a/src/components/datepicker/js/dateLocaleProvider.js
+++ b/src/components/datepicker/js/dateLocaleProvider.js
@@ -167,7 +167,7 @@
// d.toLocaleString(); // == "10/7/1992, 11:00:00 PM"
var localeTime = date.toLocaleTimeString();
var formatDate = date;
- if (date.getHours() == 0 &&
+ if (date.getHours() === 0 &&
(localeTime.indexOf('11:') !== -1 || localeTime.indexOf('23:') !== -1)) {
formatDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 1, 0, 0);
}
diff --git a/src/components/datepicker/js/dateUtil.js b/src/components/datepicker/js/dateUtil.js
index abf9e887ee..ecb8233667 100644
--- a/src/components/datepicker/js/dateUtil.js
+++ b/src/components/datepicker/js/dateUtil.js
@@ -192,7 +192,7 @@
* @return {boolean} Whether the date is a valid Date.
*/
function isValidDate(date) {
- return date != null && date.getTime && !isNaN(date.getTime());
+ return date && date.getTime && !isNaN(date.getTime());
}
/**
diff --git a/src/components/fabActions/fabActions.js b/src/components/fabActions/fabActions.js
index b2f8cc0657..101d0f983a 100644
--- a/src/components/fabActions/fabActions.js
+++ b/src/components/fabActions/fabActions.js
@@ -43,7 +43,7 @@
children.wrap('
');
}
}
- }
+ };
}
})();
diff --git a/src/components/fabSpeedDial/demoMoreOptions/script.js b/src/components/fabSpeedDial/demoMoreOptions/script.js
index 4e031962e8..8df9b45ead 100644
--- a/src/components/fabSpeedDial/demoMoreOptions/script.js
+++ b/src/components/fabSpeedDial/demoMoreOptions/script.js
@@ -47,6 +47,6 @@
templateUrl: 'dialog.html',
targetEvent: $event
});
- }
+ };
});
})();
diff --git a/src/components/fabSpeedDial/fabSpeedDial.js b/src/components/fabSpeedDial/fabSpeedDial.js
index 891d75267f..47bef8df85 100644
--- a/src/components/fabSpeedDial/fabSpeedDial.js
+++ b/src/components/fabSpeedDial/fabSpeedDial.js
@@ -205,7 +205,7 @@
runAnimation(element);
delayDone(done);
}
- }
+ };
}
function MdFabSpeedDialScaleAnimation($timeout) {
@@ -248,6 +248,6 @@
runAnimation(element);
delayDone(done);
}
- }
+ };
}
})();
diff --git a/src/components/fabToolbar/fabToolbar.js b/src/components/fabToolbar/fabToolbar.js
index 9a71e2b4ce..bfb21ef49f 100644
--- a/src/components/fabToolbar/fabToolbar.js
+++ b/src/components/fabToolbar/fabToolbar.js
@@ -192,6 +192,6 @@
runAnimation(element, className, done);
done();
}
- }
+ };
}
})();
diff --git a/src/components/icon/demoLoadSvgIconsFromUrl/script.js b/src/components/icon/demoLoadSvgIconsFromUrl/script.js
index 6b07c2ed0f..01c01cf2f9 100644
--- a/src/components/icon/demoLoadSvgIconsFromUrl/script.js
+++ b/src/components/icon/demoLoadSvgIconsFromUrl/script.js
@@ -5,9 +5,9 @@ angular.module('appDemoSvgIcons', ['ngMaterial'])
$scope.insertDriveIconURL = 'img/icons/ic_insert_drive_file_24px.svg';
$scope.getAndroid = function() {
return 'img/icons/android.svg';
- }
+ };
/* Returns base64 encoded SVG. */
$scope.getAndroidEncoded = function() {
return 'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGcgaWQ9ImFuZHJvaWQiPjxwYXRoIGQ9Ik02IDE4YzAgLjU1LjQ1IDEgMSAxaDF2My41YzAgLjgzLjY3IDEuNSAxLjUgMS41czEuNS0uNjcgMS41LTEuNVYxOWgydjMuNWMwIC44My42NyAxLjUgMS41IDEuNXMxLjUtLjY3IDEuNS0xLjVWMTloMWMuNTUgMCAxLS40NSAxLTFWOEg2djEwek0zLjUgOEMyLjY3IDggMiA4LjY3IDIgOS41djdjMCAuODMuNjcgMS41IDEuNSAxLjVTNSAxNy4zMyA1IDE2LjV2LTdDNSA4LjY3IDQuMzMgOCAzLjUgOHptMTcgMGMtLjgzIDAtMS41LjY3LTEuNSAxLjV2N2MwIC44My42NyAxLjUgMS41IDEuNXMxLjUtLjY3IDEuNS0xLjV2LTdjMC0uODMtLjY3LTEuNS0xLjUtMS41em0tNC45Ny01Ljg0bDEuMy0xLjNjLjItLjIuMi0uNTEgMC0uNzEtLjItLjItLjUxLS4yLS43MSAwbC0xLjQ4IDEuNDhDMTMuODUgMS4yMyAxMi45NSAxIDEyIDFjLS45NiAwLTEuODYuMjMtMi42Ni42M0w3Ljg1LjE1Yy0uMi0uMi0uNTEtLjItLjcxIDAtLjIuMi0uMi41MSAwIC43MWwxLjMxIDEuMzFDNi45NyAzLjI2IDYgNS4wMSA2IDdoMTJjMC0xLjk5LS45Ny0zLjc1LTIuNDctNC44NHpNMTAgNUg5VjRoMXYxem01IDBoLTFWNGgxdjF6Ii8+PC9nPjwvc3ZnPg==';
- }
+ };
});
diff --git a/src/components/input/input.js b/src/components/input/input.js
index d7849f5289..ddec7a7000 100644
--- a/src/components/input/input.js
+++ b/src/components/input/input.js
@@ -928,7 +928,7 @@ function ngMessagesAnimation($$AnimateRunner, $animateCss, $mdUtil) {
done();
}
}
- }
+ };
}
function ngMessageAnimation($$AnimateRunner, $animateCss, $mdUtil) {
@@ -942,7 +942,7 @@ function ngMessageAnimation($$AnimateRunner, $animateCss, $mdUtil) {
leave: function(element, done) {
return hideMessage(element);
}
- }
+ };
}
function showInputMessages(element, done) {
@@ -1001,7 +1001,7 @@ function hideMessage(element) {
//var styles = { opacity: element.css('opacity') };
// If we are already hidden, just return an empty animation
- if (styles.opacity == 0) {
+ if (parseInt(styles.opacity) === 0) {
return $animateCss(element, {});
}
diff --git a/src/components/menu/js/menuDirective.js b/src/components/menu/js/menuDirective.js
index eacb769f5d..217931f5f9 100644
--- a/src/components/menu/js/menuDirective.js
+++ b/src/components/menu/js/menuDirective.js
@@ -105,7 +105,7 @@
*
* ### Auto Focus
* By default, when a menu opens, `md-menu` focuses the first button in the menu content.
- *
+ *
* But sometimes you would like to focus another specific menu item instead of the first.
* This can be done by applying the `md-autofocus` directive on the given element.
*
@@ -123,7 +123,7 @@
* Sometimes you would like to be able to click on a menu item without having the menu
* close. To do this, ngMaterial exposes the `md-prevent-menu-close` attribute which
* can be added to a button inside a menu to stop the menu from automatically closing.
- * You can then close the menu programatically by injecting `$mdMenu` and calling
+ * You can then close the menu programatically by injecting `$mdMenu` and calling
* `$mdMenu.hide()`.
*
*
@@ -211,7 +211,7 @@ function MenuDirective($mdUtil) {
function link(scope, element, attr, ctrls) {
var mdMenuCtrl = ctrls[0];
- var isInMenuBar = ctrls[1] != undefined;
+ var isInMenuBar = !!ctrls[1];
// Move everything into a md-menu-container and pass it to the controller
var menuContainer = angular.element( '');
var menuContents = element.children()[1];
diff --git a/src/components/menu/js/menuServiceProvider.js b/src/components/menu/js/menuServiceProvider.js
index 6520460f05..5cd7eb7d63 100644
--- a/src/components/menu/js/menuServiceProvider.js
+++ b/src/components/menu/js/menuServiceProvider.js
@@ -190,7 +190,7 @@ function MenuProvider($$interimElementProvider) {
$window.removeEventListener('resize', repositionMenu);
$window.removeEventListener('orientationchange', repositionMenu);
- }
+ };
}
/**
@@ -299,7 +299,7 @@ function MenuProvider($$interimElementProvider) {
}
break;
}
- } while (target = target.parentNode)
+ } while (target = target.parentNode);
function close() {
scope.$apply(function() {
diff --git a/src/components/navBar/navBar.js b/src/components/navBar/navBar.js
index 284d3f9ad3..6c1f952d81 100644
--- a/src/components/navBar/navBar.js
+++ b/src/components/navBar/navBar.js
@@ -257,7 +257,7 @@ MdNavBarController.prototype._getTabs = function() {
var linkArray = Array.prototype.slice.call(
this._navBarEl.querySelectorAll('.md-nav-item'));
return linkArray.map(function(el) {
- return angular.element(el).controller('mdNavItem')
+ return angular.element(el).controller('mdNavItem');
});
};
@@ -280,7 +280,7 @@ MdNavBarController.prototype._getTabByName = function(name) {
*/
MdNavBarController.prototype._getSelectedTab = function() {
return this._findTab(function(tab) {
- return tab.isSelected()
+ return tab.isSelected();
});
};
@@ -290,7 +290,7 @@ MdNavBarController.prototype._getSelectedTab = function() {
*/
MdNavBarController.prototype.getFocusedTab = function() {
return this._findTab(function(tab) {
- return tab.hasFocus()
+ return tab.hasFocus();
});
};
diff --git a/src/components/panel/demoBasicUsage/script.js b/src/components/panel/demoBasicUsage/script.js
index 002fc7e054..510b6bc87f 100644
--- a/src/components/panel/demoBasicUsage/script.js
+++ b/src/components/panel/demoBasicUsage/script.js
@@ -128,20 +128,20 @@ PanelMenuCtrl.prototype.selectDessert = function(dessert) {
PanelMenuCtrl.prototype.onKeydown = function($event, dessert) {
- var handled;
+ var handled, els, index, prevIndex, nextIndex;
switch ($event.which) {
case 38: // Up Arrow.
- var els = document.querySelectorAll('.demo-menu-item');
- var index = indexOf(els, document.activeElement);
- var prevIndex = (index + els.length - 1) % els.length;
+ els = document.querySelectorAll('.demo-menu-item');
+ index = indexOf(els, document.activeElement);
+ prevIndex = (index + els.length - 1) % els.length;
els[prevIndex].focus();
handled = true;
break;
case 40: // Down Arrow.
- var els = document.querySelectorAll('.demo-menu-item');
- var index = indexOf(els, document.activeElement);
- var nextIndex = (index + 1) % els.length;
+ els = document.querySelectorAll('.demo-menu-item');
+ index = indexOf(els, document.activeElement);
+ nextIndex = (index + 1) % els.length;
els[nextIndex].focus();
handled = true;
break;
diff --git a/src/components/progressLinear/demoBasicUsage/script.js b/src/components/progressLinear/demoBasicUsage/script.js
index e2ea7ca756..b66152810e 100644
--- a/src/components/progressLinear/demoBasicUsage/script.js
+++ b/src/components/progressLinear/demoBasicUsage/script.js
@@ -36,7 +36,7 @@ angular.module('progressLinearDemo1', ['ngMaterial'])
if ( (j < 2) && !self.showList[j] && self.activated ) {
self.showList[j] = true;
}
- if ( counter++ % 4 == 0 ) j++;
+ if ( counter++ % 4 === 0 ) j++;
// Show the indicator in the "Used within Containers" after 200ms delay
if ( j == 2 ) self.contained = "indeterminate";
diff --git a/src/components/radioButton/demoMultiColumn/script.js b/src/components/radioButton/demoMultiColumn/script.js
index 529adfc274..28e3e7e392 100644
--- a/src/components/radioButton/demoMultiColumn/script.js
+++ b/src/components/radioButton/demoMultiColumn/script.js
@@ -27,5 +27,5 @@ angular
self.selectedId = 2;
self.selectedUser = function() {
return $filter('filter')(self.contacts, { id: self.selectedId })[0].lastName;
- }
+ };
});
diff --git a/src/components/select/demoValidations/script.js b/src/components/select/demoValidations/script.js
index 2309154034..69e208a098 100755
--- a/src/components/select/demoValidations/script.js
+++ b/src/components/select/demoValidations/script.js
@@ -3,7 +3,7 @@ angular.module('selectDemoValidation', ['ngMaterial', 'ngMessages'])
$scope.clearValue = function() {
$scope.quest = undefined;
$scope.favoriteColor = undefined;
- $scope.myForm.$setPristine();;
+ $scope.myForm.$setPristine();
};
$scope.save = function() {
if ($scope.myForm.$valid) {
diff --git a/src/components/sidenav/demoBasicUsage/script.js b/src/components/sidenav/demoBasicUsage/script.js
index e0c393f338..6086d7d95d 100644
--- a/src/components/sidenav/demoBasicUsage/script.js
+++ b/src/components/sidenav/demoBasicUsage/script.js
@@ -48,7 +48,7 @@ angular
.then(function () {
$log.debug("toggle " + navID + " is done");
});
- }
+ };
}
})
.controller('LeftCtrl', function ($scope, $timeout, $mdSidenav, $log) {
diff --git a/src/components/sidenav/demoCustomSidenav/script.js b/src/components/sidenav/demoCustomSidenav/script.js
index e00a0dd679..fe7b6896f4 100644
--- a/src/components/sidenav/demoCustomSidenav/script.js
+++ b/src/components/sidenav/demoCustomSidenav/script.js
@@ -7,6 +7,6 @@ angular
function buildToggler(componentId) {
return function() {
$mdSidenav(componentId).toggle();
- }
+ };
}
});
diff --git a/src/components/tabs/js/tabDirective.js b/src/components/tabs/js/tabDirective.js
index 5511b28ee9..644a4ac21d 100644
--- a/src/components/tabs/js/tabDirective.js
+++ b/src/components/tabs/js/tabDirective.js
@@ -61,12 +61,12 @@ function MdTab () {
var label = firstChild(element, 'md-tab-label'),
body = firstChild(element, 'md-tab-body');
- if (label.length == 0) {
+ if (label.length === 0) {
label = angular.element('');
if (attr.label) label.text(attr.label);
else label.append(element.contents());
- if (body.length == 0) {
+ if (body.length === 0) {
var contents = element.contents().detach();
body = angular.element('');
body.append(contents);
diff --git a/src/components/tabs/js/tabScroll.js b/src/components/tabs/js/tabScroll.js
index 16add62a68..b752135835 100644
--- a/src/components/tabs/js/tabScroll.js
+++ b/src/components/tabs/js/tabScroll.js
@@ -12,5 +12,5 @@ function MdTabScroll ($parse) {
});
};
}
- }
+ };
}
diff --git a/src/components/tabs/js/tabsController.js b/src/components/tabs/js/tabsController.js
index bbc60d8a6e..eb85ef97d4 100644
--- a/src/components/tabs/js/tabsController.js
+++ b/src/components/tabs/js/tabsController.js
@@ -643,7 +643,7 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
function adjustOffset (index) {
var elements = getElements();
- if (index == null) index = ctrl.focusIndex;
+ if (!angular.isNumber(index)) index = ctrl.focusIndex;
if (!elements.tabs[ index ]) return;
if (ctrl.shouldCenterTabs) return;
var tab = elements.tabs[ index ],
diff --git a/src/components/tabs/js/tabsDirective.js b/src/components/tabs/js/tabsDirective.js
index 393c784067..60e7765b0b 100644
--- a/src/components/tabs/js/tabsDirective.js
+++ b/src/components/tabs/js/tabsDirective.js
@@ -96,7 +96,7 @@ function MdTabs ($$mdSvgRegistry) {
selectedIndex: '=?mdSelected'
},
template: function (element, attr) {
- attr[ "$mdTabsTemplate" ] = element.html();
+ attr.$mdTabsTemplate = element.html();
return '' +
' ' +
' ' +
diff --git a/src/components/toast/demoCustomUsage/script.js b/src/components/toast/demoCustomUsage/script.js
index ac6a316e39..4ac7cd5a19 100644
--- a/src/components/toast/demoCustomUsage/script.js
+++ b/src/components/toast/demoCustomUsage/script.js
@@ -41,7 +41,7 @@
)
.then(function() {
isDlgOpen = false;
- })
+ });
};
});
diff --git a/src/components/tooltip/demoBasicUsage/script.js b/src/components/tooltip/demoBasicUsage/script.js
index 955d3e7d8d..8059b4ea7c 100644
--- a/src/components/tooltip/demoBasicUsage/script.js
+++ b/src/components/tooltip/demoBasicUsage/script.js
@@ -14,5 +14,5 @@ angular.module('tooltipDemo1', ['ngMaterial'])
if (val && val.length ) {
$scope.demo.showTooltip = true;
}
- })
+ });
});
diff --git a/src/core/services/interimElement/interimElement.js b/src/core/services/interimElement/interimElement.js
index b5feff58a8..970465f320 100644
--- a/src/core/services/interimElement/interimElement.js
+++ b/src/core/services/interimElement/interimElement.js
@@ -612,14 +612,14 @@ function InterimElementProvider() {
autoHideTimer = $timeout(service.hide, options.hideDelay) ;
cancelAutoHide = function() {
$timeout.cancel(autoHideTimer);
- }
+ };
}
// Cache for subsequent use
options.cancelAutoHide = function() {
cancelAutoHide();
options.cancelAutoHide = undefined;
- }
+ };
}
/**
@@ -663,7 +663,7 @@ function InterimElementProvider() {
// Trigger callback *before* the remove operation starts
announceRemoving(element, action);
- if ( options.$destroy == true ) {
+ if ( options.$destroy ) {
// For $destroy, onRemove should be synchronous
resolve(element);
diff --git a/src/core/services/ripple/button_ripple.js b/src/core/services/ripple/button_ripple.js
index 49349065b8..bc85a72342 100644
--- a/src/core/services/ripple/button_ripple.js
+++ b/src/core/services/ripple/button_ripple.js
@@ -37,8 +37,8 @@
return {
isMenuItem: element.hasClass('md-menu-item'),
dimBackground: true
- }
+ };
}
- };
- };
+ }
+ }
})();
diff --git a/src/core/services/ripple/checkbox_ripple.js b/src/core/services/ripple/checkbox_ripple.js
index db03ae5151..63d0ec27c2 100644
--- a/src/core/services/ripple/checkbox_ripple.js
+++ b/src/core/services/ripple/checkbox_ripple.js
@@ -28,6 +28,6 @@
dimBackground: false,
fitRipple: true
}, options));
- };
- };
+ }
+ }
})();
diff --git a/src/core/services/ripple/list_ripple.js b/src/core/services/ripple/list_ripple.js
index 1f3df2419b..9c4add90d9 100644
--- a/src/core/services/ripple/list_ripple.js
+++ b/src/core/services/ripple/list_ripple.js
@@ -29,6 +29,6 @@
outline: false,
rippleSize: 'full'
}, options));
- };
- };
+ }
+ }
})();
diff --git a/src/core/services/ripple/tab_ripple.js b/src/core/services/ripple/tab_ripple.js
index 9be7f4aca5..e0bfdb724d 100644
--- a/src/core/services/ripple/tab_ripple.js
+++ b/src/core/services/ripple/tab_ripple.js
@@ -29,6 +29,6 @@
outline: false,
rippleSize: 'full'
}, options));
- };
- };
+ }
+ }
})();
diff --git a/src/core/services/theming/theming.js b/src/core/services/theming/theming.js
index 09c3945961..a704c52f7c 100644
--- a/src/core/services/theming/theming.js
+++ b/src/core/services/theming/theming.js
@@ -290,7 +290,7 @@ function ThemingProvider($mdColorPalette, $$mdMetaProvider) {
return function () {
removeChrome();
removeWindows();
- }
+ };
};
/**
diff --git a/src/core/util/animation/animateCss.js b/src/core/util/animation/animateCss.js
index 7d0ad3f670..51dc161873 100644
--- a/src/core/util/animation/animateCss.js
+++ b/src/core/util/animation/animateCss.js
@@ -1,9 +1,8 @@
-"use strict";
-
if (angular.version.minor >= 4) {
angular.module('material.core.animate', []);
} else {
(function() {
+ "use strict";
var forEach = angular.forEach;
@@ -18,7 +17,7 @@ if (angular.version.minor >= 4) {
var $$ForceReflowFactory = ['$document', function($document) {
return function() {
return $document[0].body.clientWidth + 1;
- }
+ };
}];
var $$rAFMutexFactory = ['$$rAF', function($$rAF) {
@@ -296,7 +295,7 @@ if (angular.version.minor >= 4) {
return runner;
}
}
- }
+ };
}
function applyClasses(element, options) {
@@ -312,7 +311,7 @@ if (angular.version.minor >= 4) {
function computeTimings(element) {
var node = getDomNode(element);
- var cs = $window.getComputedStyle(node)
+ var cs = $window.getComputedStyle(node);
var tdr = parseMaxTime(cs[prop('transitionDuration')]);
var adr = parseMaxTime(cs[prop('animationDuration')]);
var tdy = parseMaxTime(cs[prop('transitionDelay')]);
diff --git a/src/core/util/autofocus.js b/src/core/util/autofocus.js
index c5f9e9838a..09b5b6a7c5 100644
--- a/src/core/util/autofocus.js
+++ b/src/core/util/autofocus.js
@@ -93,9 +93,8 @@ angular.module('material.core')
function MdAutofocusDirective() {
return {
restrict: 'A',
-
link: postLink
- }
+ };
}
function postLink(scope, element, attrs) {
diff --git a/src/core/util/color.js b/src/core/util/color.js
index fd2dcd1853..b91726bb13 100644
--- a/src/core/util/color.js
+++ b/src/core/util/color.js
@@ -69,5 +69,5 @@ function ColorUtilFactory() {
hexToRgba: hexToRgba,
rgbToRgba: rgbToRgba,
rgbaToRgb: rgbaToRgb
- }
-}
\ No newline at end of file
+ };
+}
diff --git a/src/core/util/media.js b/src/core/util/media.js
index 3dc9b859c6..aea3420f3c 100644
--- a/src/core/util/media.js
+++ b/src/core/util/media.js
@@ -182,7 +182,7 @@ function mdMediaFactory($mdConstant, $rootScope, $window) {
});
return function unwatch() {
- unwatchFns.forEach(function(fn) { fn(); })
+ unwatchFns.forEach(function(fn) { fn(); });
};
}
diff --git a/src/core/util/prefixer.js b/src/core/util/prefixer.js
index 8204988900..ac775ee809 100644
--- a/src/core/util/prefixer.js
+++ b/src/core/util/prefixer.js
@@ -43,7 +43,7 @@ function MdPrefixer(initialAttributes, buildSelector) {
return _buildList(attributes)
.map(function(item) {
- return '[' + item + ']'
+ return '[' + item + ']';
})
.join(',');
}
@@ -93,4 +93,4 @@ function MdPrefixer(initialAttributes, buildSelector) {
}
}
-}
\ No newline at end of file
+}