Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit bf0ec8c

Browse files
committed
refactor(autofocus): remove deprecated md-auto-focus attribute
BREAKING CHANGE: Removed the deprecated `md-auto-focus` directive. It was deprecated in favor of `md-autofocus`. Please see the [md-autofocus Docs](https://material.angularjs.org/latest/api/directive/mdAutofocus) for examples.
1 parent 8fc36d4 commit bf0ec8c

File tree

3 files changed

+4
-28
lines changed

3 files changed

+4
-28
lines changed

src/core/util/autofocus.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
angular.module('material.core')
2-
.directive('mdAutofocus', MdAutofocusDirective)
3-
4-
// Support the deprecated md-auto-focus as well
5-
.directive('mdAutoFocus', MdAutofocusDirective);
2+
.directive('mdAutofocus', MdAutofocusDirective);
63

74
/**
85
* @ngdoc directive

src/core/util/util.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,9 @@ function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $in
222222

223223
elToFocus = scanForFocusable(containerEl, attributeVal || AUTO_FOCUS);
224224

225-
if (!elToFocus && attributeVal !== AUTO_FOCUS) {
226-
// Scan for deprecated attribute
227-
elToFocus = scanForFocusable(containerEl, this.prefixer('md-auto-focus', true));
228-
229-
if (!elToFocus) {
230-
// Scan for fallback to 'universal' API
231-
elToFocus = scanForFocusable(containerEl, AUTO_FOCUS);
232-
}
225+
// Scan for fallback to 'universal' API
226+
if (!elToFocus) {
227+
elToFocus = scanForFocusable(containerEl, AUTO_FOCUS);
233228
}
234229

235230
return elToFocus;

src/core/util/util.spec.js

-16
Original file line numberDiff line numberDiff line change
@@ -122,22 +122,6 @@ describe('util', function() {
122122
expect(target[0].nodeName).toBe("BUTTON");
123123
}));
124124

125-
it('should find valid a valid focusTarget with "md-auto-focus"', inject(function($rootScope, $compile, $mdUtil) {
126-
var widget = $compile('<div class="autoFocus"><button md-auto-focus><img></button></div>')($rootScope);
127-
$rootScope.$apply();
128-
var target = $mdUtil.findFocusTarget(widget);
129-
130-
expect(target[0].nodeName).toBe("BUTTON");
131-
}));
132-
133-
it('should find valid a valid focusTarget with "md-auto-focus" argument', inject(function($rootScope, $compile, $mdUtil) {
134-
var widget = $compile('<div class="autoFocus"><button md-autofocus><img></button></div>')($rootScope);
135-
$rootScope.$apply();
136-
var target = $mdUtil.findFocusTarget(widget,'[md-auto-focus]');
137-
138-
expect(target[0].nodeName).toBe("BUTTON");
139-
}));
140-
141125
it('should find valid a valid focusTarget with a deep "md-autofocus" argument', inject(function($rootScope, $compile, $mdUtil) {
142126
var widget = $compile('<div class="autoFocus"><md-sidenav><button md-autofocus><img></button></md-sidenav></div>')($rootScope);
143127
$rootScope.$apply();

0 commit comments

Comments
 (0)