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

Commit 841bb20

Browse files
committed
fix(core): remove angular.lowercase and angular.uppercase
BREAKING CHANGE: The helper functions `angular.lowercase` `and angular.uppercase` have been removed. These functions have been deprecated since 1.5.0. They are internally used, but should not be exposed as it's possible that they do not work correctly with all locales (e.g. Turkish). It makes more sense that developers use special purpose functions if they need to.
1 parent 603b66e commit 841bb20

File tree

8 files changed

+23
-39
lines changed

8 files changed

+23
-39
lines changed

src/Angular.js

+2-18
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,7 @@ function isValidObjectMaxDepth(maxDepth) {
173173
}
174174

175175
/**
176-
* @ngdoc function
177-
* @name angular.lowercase
178-
* @module ng
179-
* @kind function
180-
*
181-
* @deprecated
182-
* sinceVersion="1.5.0"
183-
* removeVersion="1.7.0"
184-
* Use [String.prototype.toLowerCase](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase) instead.
176+
* @private
185177
*
186178
* @description Converts the specified string to lowercase.
187179
* @param {string} string String to be converted to lowercase.
@@ -190,15 +182,7 @@ function isValidObjectMaxDepth(maxDepth) {
190182
var lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;};
191183

192184
/**
193-
* @ngdoc function
194-
* @name angular.uppercase
195-
* @module ng
196-
* @kind function
197-
*
198-
* @deprecated
199-
* sinceVersion="1.5.0"
200-
* removeVersion="1.7.0"
201-
* Use [String.prototype.toUpperCase](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase) instead.
185+
* @private
202186
*
203187
* @description Converts the specified string to uppercase.
204188
* @param {string} string String to be converted to uppercase.

src/AngularPublic.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,16 @@ function publishExternalAPI(angular) {
150150
'isArray': isArray,
151151
'version': version,
152152
'isDate': isDate,
153-
'lowercase': lowercase,
154-
'uppercase': uppercase,
155153
'callbacks': {$$counter: 0},
156154
'getTestability': getTestability,
157155
'reloadWithDebugInfo': reloadWithDebugInfo,
158156
'$$minErr': minErr,
159157
'$$csp': csp,
160158
'$$encodeUriSegment': encodeUriSegment,
161159
'$$encodeUriQuery': encodeUriQuery,
162-
'$$stringify': stringify
160+
'$$lowercase': lowercase,
161+
'$$stringify': stringify,
162+
'$$uppercase': uppercase
163163
});
164164

165165
angularModule = setupModuleLoader(window);

src/ngMock/angular-mocks.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2072,13 +2072,13 @@ function MockXhr() {
20722072
var header = this.$$respHeaders[name];
20732073
if (header) return header;
20742074

2075-
name = angular.lowercase(name);
2075+
name = angular.$$lowercase(name);
20762076
header = this.$$respHeaders[name];
20772077
if (header) return header;
20782078

20792079
header = undefined;
20802080
angular.forEach(this.$$respHeaders, function(headerVal, headerName) {
2081-
if (!header && angular.lowercase(headerName) === name) header = headerVal;
2081+
if (!header && angular.$$lowercase(headerName) === name) header = headerVal;
20822082
});
20832083
return header;
20842084
};

src/ngSanitize/sanitize.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ function $SanitizeProvider() {
212212
extend = angular.extend;
213213
forEach = angular.forEach;
214214
isDefined = angular.isDefined;
215-
lowercase = angular.lowercase;
215+
lowercase = angular.$$lowercase;
216216
noop = angular.noop;
217217

218218
htmlParser = htmlParserImpl;

src/ngTouch/touch.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var ngTouch = angular.module('ngTouch', []);
2727
ngTouch.provider('$touch', $TouchProvider);
2828

2929
function nodeName_(element) {
30-
return angular.lowercase(element.nodeName || (element[0] && element[0].nodeName));
30+
return angular.$$lowercase(element.nodeName || (element[0] && element[0].nodeName));
3131
}
3232

3333
/**

test/ng/compileSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11353,7 +11353,7 @@ describe('$compile', function() {
1135311353
element = $compile('<iframe srcdoc="{{html}}"></iframe>')($rootScope);
1135411354
$rootScope.html = $sce.trustAsHtml('<div onclick="">hello</div>');
1135511355
$rootScope.$digest();
11356-
expect(angular.lowercase(element.attr('srcdoc'))).toEqual('<div onclick="">hello</div>');
11356+
expect(lowercase(element.attr('srcdoc'))).toEqual('<div onclick="">hello</div>');
1135711357
}));
1135811358
});
1135911359
}

test/ng/directive/ngBindSpec.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -176,17 +176,17 @@ describe('ngBind*', function() {
176176
element = $compile('<div ng-bind-html="html"></div>')($rootScope);
177177
$rootScope.html = '<div onclick="">hello</div>';
178178
$rootScope.$digest();
179-
expect(angular.lowercase(element.html())).toEqual('<div onclick="">hello</div>');
179+
expect(lowercase(element.html())).toEqual('<div onclick="">hello</div>');
180180
}));
181181

182182
it('should update html', inject(function($rootScope, $compile, $sce) {
183183
element = $compile('<div ng-bind-html="html"></div>')($rootScope);
184184
$rootScope.html = 'hello';
185185
$rootScope.$digest();
186-
expect(angular.lowercase(element.html())).toEqual('hello');
186+
expect(lowercase(element.html())).toEqual('hello');
187187
$rootScope.html = 'goodbye';
188188
$rootScope.$digest();
189-
expect(angular.lowercase(element.html())).toEqual('goodbye');
189+
expect(lowercase(element.html())).toEqual('goodbye');
190190
}));
191191

192192
it('should one-time bind if the expression starts with two colons', inject(function($rootScope, $compile) {
@@ -220,17 +220,17 @@ describe('ngBind*', function() {
220220
element = $compile('<div ng-bind-html="html"></div>')($rootScope);
221221
$rootScope.html = $sce.trustAsHtml('<div onclick="">hello</div>');
222222
$rootScope.$digest();
223-
expect(angular.lowercase(element.html())).toEqual('<div onclick="">hello</div>');
223+
expect(lowercase(element.html())).toEqual('<div onclick="">hello</div>');
224224
}));
225225

226226
it('should update html', inject(function($rootScope, $compile, $sce) {
227227
element = $compile('<div ng-bind-html="html"></div>')($rootScope);
228228
$rootScope.html = $sce.trustAsHtml('hello');
229229
$rootScope.$digest();
230-
expect(angular.lowercase(element.html())).toEqual('hello');
230+
expect(lowercase(element.html())).toEqual('hello');
231231
$rootScope.html = $sce.trustAsHtml('goodbye');
232232
$rootScope.$digest();
233-
expect(angular.lowercase(element.html())).toEqual('goodbye');
233+
expect(lowercase(element.html())).toEqual('goodbye');
234234
}));
235235

236236
it('should not cause infinite recursion for trustAsHtml object watches',
@@ -243,7 +243,7 @@ describe('ngBind*', function() {
243243
return $sce.trustAsHtml('<div onclick="">hello</div>');
244244
};
245245
$rootScope.$digest();
246-
expect(angular.lowercase(element.html())).toEqual('<div onclick="">hello</div>');
246+
expect(lowercase(element.html())).toEqual('<div onclick="">hello</div>');
247247
}));
248248

249249
it('should handle custom $sce objects', function() {
@@ -266,10 +266,10 @@ describe('ngBind*', function() {
266266
var html = 'hello';
267267
$rootScope.getHtml = function() { return $sce.trustAsHtml(html); };
268268
$rootScope.$digest();
269-
expect(angular.lowercase(element.html())).toEqual('hello');
269+
expect(lowercase(element.html())).toEqual('hello');
270270
html = 'goodbye';
271271
$rootScope.$digest();
272-
expect(angular.lowercase(element.html())).toEqual('goodbye');
272+
expect(lowercase(element.html())).toEqual('goodbye');
273273
});
274274
});
275275

@@ -280,7 +280,7 @@ describe('ngBind*', function() {
280280
element = $compile('<div ng-bind-html="html"></div>')($rootScope);
281281
$rootScope.html = '<div onclick="">hello</div>';
282282
$rootScope.$digest();
283-
expect(angular.lowercase(element.html())).toEqual('<div>hello</div>');
283+
expect(lowercase(element.html())).toEqual('<div>hello</div>');
284284
}));
285285
});
286286
});

test/ngSanitize/directive/ngBindHtmlSpec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('ngBindHtml', function() {
88
var element = $compile('<div ng-bind-html="html"></div>')($rootScope);
99
$rootScope.html = '<div unknown>hello</div>';
1010
$rootScope.$digest();
11-
expect(angular.lowercase(element.html())).toEqual('<div>hello</div>');
11+
expect(lowercase(element.html())).toEqual('<div>hello</div>');
1212
}));
1313

1414

@@ -18,11 +18,11 @@ describe('ngBindHtml', function() {
1818
angular.forEach([null, undefined, ''], function(val) {
1919
$rootScope.html = 'some val';
2020
$rootScope.$digest();
21-
expect(angular.lowercase(element.html())).toEqual('some val');
21+
expect(lowercase(element.html())).toEqual('some val');
2222

2323
$rootScope.html = val;
2424
$rootScope.$digest();
25-
expect(angular.lowercase(element.html())).toEqual('');
25+
expect(lowercase(element.html())).toEqual('');
2626
});
2727
}));
2828
});

0 commit comments

Comments
 (0)