From 6794bdc1310814c3a0d1deaf7ea61cd5e295712f Mon Sep 17 00:00:00 2001 From: Leonard Seymore Date: Tue, 9 Sep 2014 12:30:03 +0200 Subject: [PATCH 1/2] fix(tab): IE9 disabled attr renders grey text on enabled tab - IE9 renders elements with 'disabled' property with grey text - Tabs are rendered with grey text even if they are not disabled - By renaming attribute to 'disable' instead of 'disabled' tabs with dynamic 'disable' attribute still render correctly --- src/tabs/tabs.js | 4 ++-- src/tabs/test/tabs.spec.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tabs/tabs.js b/src/tabs/tabs.js index e1b5ee8485..e07b83179e 100644 --- a/src/tabs/tabs.js +++ b/src/tabs/tabs.js @@ -200,8 +200,8 @@ angular.module('ui.bootstrap.tabs', []) }); scope.disabled = false; - if ( attrs.disabled ) { - scope.$parent.$watch($parse(attrs.disabled), function(value) { + if ( attrs.disable ) { + scope.$parent.$watch($parse(attrs.disable), function(value) { scope.disabled = !! value; }); } diff --git a/src/tabs/test/tabs.spec.js b/src/tabs/test/tabs.spec.js index bf5e2c671c..19abd02463 100644 --- a/src/tabs/test/tabs.spec.js +++ b/src/tabs/test/tabs.spec.js @@ -531,7 +531,7 @@ describe('tabs', function() { ]; elm = $compile([ '', - ' ', + ' ', ' heading {{index}}', ' content {{$index}}', ' ', From 0551fbfa948dbf023c79d2a1febbdeb9d54667e3 Mon Sep 17 00:00:00 2001 From: Leonard Seymore Date: Mon, 6 Apr 2015 08:53:47 +0200 Subject: [PATCH 2/2] Deprecation support added for "disabled" attribute --- src/tabs/docs/demo.html | 2 +- src/tabs/docs/readme.md | 5 +++-- src/tabs/tabs.js | 13 ++++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/tabs/docs/demo.html b/src/tabs/docs/demo.html index 8f2dc57aca..a8e4065487 100644 --- a/src/tabs/docs/demo.html +++ b/src/tabs/docs/demo.html @@ -11,7 +11,7 @@ Static content - + {{tab.content}} diff --git a/src/tabs/docs/readme.md b/src/tabs/docs/readme.md index e33afdec5c..da27363b32 100644 --- a/src/tabs/docs/readme.md +++ b/src/tabs/docs/readme.md @@ -26,9 +26,10 @@ AngularJS version of the tabs directive. _(Defaults: false)_ : Whether tab is currently selected. - * `disabled` + * `disable` _(Defaults: false)_ : Whether tab is clickable and can be activated. + Note that this deprecates the "disabled" attribute * `select()` _(Defaults: null)_ : @@ -36,4 +37,4 @@ AngularJS version of the tabs directive. * `deselect()` _(Defaults: null)_ : - An optional expression called when tab is deactivated. \ No newline at end of file + An optional expression called when tab is deactivated. diff --git a/src/tabs/tabs.js b/src/tabs/tabs.js index 6657d2a973..4fbcca06ee 100644 --- a/src/tabs/tabs.js +++ b/src/tabs/tabs.js @@ -182,7 +182,7 @@ angular.module('ui.bootstrap.tabs', []) */ -.directive('tab', ['$parse', function($parse) { +.directive('tab', ['$parse', '$log', function($parse, $log) { return { require: '^tabset', restrict: 'EA', @@ -214,6 +214,17 @@ angular.module('ui.bootstrap.tabs', []) }); } + // Deprecation support of "disabled" parameter + // fix(tab): IE9 disabled attr renders grey text on enabled tab #2677 + // This code is duplicated from the lines above to make it easy to remove once + // the feature has been completely deprecated + if ( attrs.disabled ) { + $log.warn('Use of "disabled" attribute has been deprecated, please use "disable"'); + scope.$parent.$watch($parse(attrs.disabled), function(value) { + scope.disabled = !! value; + }); + } + scope.select = function() { if ( !scope.disabled ) { scope.active = true;