From 786cb30c618f2e5efcc0426377020ca922984ddf Mon Sep 17 00:00:00 2001 From: Martin Staffa Date: Fri, 16 Mar 2018 12:20:58 +0100 Subject: [PATCH 1/3] fix(minErr): update url to https --- src/minErr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/minErr.js b/src/minErr.js index e20040319222..3f3ba5af5767 100644 --- a/src/minErr.js +++ b/src/minErr.js @@ -101,7 +101,7 @@ function minErr(module, ErrorConstructor) { return match; }); - message += '\nhttp://errors.angularjs.org/"NG_VERSION_FULL"/' + + message += '\nhttps://errors.angularjs.org/"NG_VERSION_FULL"/' + (module ? module + '/' : '') + code; for (i = 0, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') { From 4b2de4bcbf1e496aefb5095cc574b3c1d49865ad Mon Sep 17 00:00:00 2001 From: Martin Staffa Date: Fri, 16 Mar 2018 12:21:52 +0100 Subject: [PATCH 2/3] feat(minErr): strip error url from error parameters Related https://github.com/angular/angular.js/issues/14744 --- src/minErr.js | 15 ++++++++++++--- test/minErrSpec.js | 13 +++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/minErr.js b/src/minErr.js index 3f3ba5af5767..a2f0ddc2d544 100644 --- a/src/minErr.js +++ b/src/minErr.js @@ -82,6 +82,11 @@ function isValidObjectMaxDepth(maxDepth) { function minErr(module, ErrorConstructor) { ErrorConstructor = ErrorConstructor || Error; + + var url = 'https://errors.angularjs.org/"NG_VERSION_FULL"/'; + var regex = url.replace('.', '\\.') + '[\\s\\S]*'; + var errRegExp = new RegExp(regex, 'g'); + return function() { var code = arguments[0], template = arguments[1], @@ -91,18 +96,22 @@ function minErr(module, ErrorConstructor) { }), paramPrefix, i; + // A minErr message has two parts: the message itself and the url that contains the + // encoded message. + // The message's parameters can contain other error messages which also include error urls. + // To prevent the messages from getting too long, we strip the error urls from the parameters. + message += template.replace(/\{\d+\}/g, function(match) { var index = +match.slice(1, -1); if (index < templateArgs.length) { - return templateArgs[index]; + return templateArgs[index].replace(errRegExp, ''); } return match; }); - message += '\nhttps://errors.angularjs.org/"NG_VERSION_FULL"/' + - (module ? module + '/' : '') + code; + message += '\n' + url + (module ? module + '/' : '') + code; for (i = 0, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') { message += paramPrefix + 'p' + i + '=' + encodeURIComponent(templateArgs[i]); diff --git a/test/minErrSpec.js b/test/minErrSpec.js index aae001cba415..4319fd88d569 100644 --- a/test/minErrSpec.js +++ b/test/minErrSpec.js @@ -164,5 +164,18 @@ describe('errors', function() { expect(testError('acode', 'aproblem', 'a', 'b', 'value with space').message) .toMatch(/^[\s\S]*\?p0=a&p1=b&p2=value%20with%20space$/); }); + + + it('should strip error reference urls from the error message parameters', function() { + var firstError = testError('firstcode', 'longer string and so on'); + + var error = testError('secondcode', 'description {0}, and {1}', 'a', firstError.message); + + expect(error.message).toBe('[test:secondcode] description a, and [test:firstcode] longer ' + + 'string and so on\n\nhttps://errors.angularjs.org/"NG_VERSION_FULL"/test/' + + 'secondcode?p0=a&p1=%5Btest%3Afirstcode%5D%20longer%20string%20and%20so%20on%0Ahttps' + + '%3A%2F%2Ferrors.angularjs.org%2F%22NG_VERSION_FULL%22%2Ftest%2Ffirstcode'); + }); + }); }); From c68b31cb2c0d2f30471ab03bb6193638a3aed834 Mon Sep 17 00:00:00 2001 From: Giuseppe Scoppino Date: Mon, 19 Mar 2018 13:02:52 -0400 Subject: [PATCH 3/3] docs(guide/Internet Explorer Compatibility): include warnings for usage of 'disabled' attribute * docs(guide/Internet Explorer Compatibility): Mention 'disabled' attribute Setting the 'disabled' attribute on an element that has descendant elements has unexpected behavior in Internet Explorer 11. * Input elements that are descendants have the text content of the 'placeholder' attribute inserted as the value (and it is not removed when typing in the field). * Select elements that are descendants are disabled. To avoid this issue, it is important to not set `disabled` or `ng-disabled` on an element that has descendant form elements. Normally these should only be used on actual form controls so the issue would not manifest. The issue can also appear if a directive/component is named 'disabled' or takes an attribute named 'disabled' as an input/output attribute, so avoid these. Closes #16490 Related #15700 --- docs/content/guide/ie.ngdoc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/content/guide/ie.ngdoc b/docs/content/guide/ie.ngdoc index ffd70ba69b4c..7afb1c5fefee 100644 --- a/docs/content/guide/ie.ngdoc +++ b/docs/content/guide/ie.ngdoc @@ -39,3 +39,12 @@ To ensure your AngularJS application works on IE please consider: of `placeholder="{{ someExpression }}"`. If using the latter, Internet Explorer will error on accessing the `nodeValue` on a parentless `TextNode` in Internet Explorer 10 & 11 (see [issue 5025](https://github.com/angular/angular.js/issues/5025)). +5. Using the `disabled` attribute on an element that has + descendant form controls can result in unexpected behavior in Internet Explorer 11. + For example, the value of descendant input elements with `ng-model` will not reflect + the model (or changes to the model), and the value of the `placeholder` attribute will be + inserted as the input's value. Descendant select elements will also be inoperable, as if they + had the `disabled` attribute applied to them, which may not be the intended effect. + To work around this unexpected behavior, 1) avoid using the identifier `disabled` for custom attribute + directives that are on elements with descendant form controls, and 2) avoid using `disabled` as an identifier + for an attribute passed to a custom directive that has descendant form controls.