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

refactor: use document.documentMode to determine msie version #9398

Closed
wants to merge 1 commit into from

Conversation

IgorMinar
Copy link
Contributor

No description provided.

@caitp
Copy link
Contributor

caitp commented Oct 2, 2014

I am a fan of this approach (vs. UA sniffing)

@petebacondarwin
Copy link
Contributor

There are various places still in the code that actually test the numeric value of msie. Some are only checking for IE<9 so we could drop those bits of code anyway, but others are not...

https://github.com/angular/angular.js/blob/master/src/ng/compile.js:
1358: if (!msie || msie >= 8 || attr.specified) {

https://github.com/angular/angular.js/blob/master/src/ng/directive/a.js:
20: if (msie <= 8) {

https://github.com/angular/angular.js/blob/master/src/ng/httpBackend.js:
7: if (msie <= 8 && (!method.match(/^(get|post|head|put|delete|options)$/i) ||
97: if (!(status === ABORTED && msie < 10)) {

https://github.com/angular/angular.js/blob/master/src/ng/sanitizeUri.js:
65: if (!msie || msie >= 8 ) {

https://github.com/angular/angular.js/blob/master/src/ng/sniffer.js:
75: if (event == 'input' && msie == 9) return false;

https://github.com/angular/angular.js/blob/master/src/ngScenario/browserTrigger.js:
59: if (msie < 9) {

https://github.com/angular/angular.js/blob/master/src/ngScenario/dsl.js:
202: var supportInputEvent = 'oninput' in document.createElement('div') && msie != 9;

https://github.com/angular/angular.js/blob/master/test/AngularSpec.js:
376: if (msie<=8) return;
1036: if (!msie || msie >= 9) {

https://github.com/angular/angular.js/blob/master/test/jqLiteSpec.js:
601: if (msie < 9) {
880: if (msie <= 8) {
891: if (msie <= 8) {
1190: if (msie < 9){
1540: if (msie < 9) return;

https://github.com/angular/angular.js/blob/master/test/ng/compileSpec.js:
392: if (msie < 9) return;
867: if (!msie || msie > 11) {
6149: if (!msie || msie >= 11) {

https://github.com/angular/angular.js/blob/master/test/ng/directive/aSpec.js:
25: if (msie < 9) {
100: if (msie < 9) {

https://github.com/angular/angular.js/blob/master/test/ng/directive/booleanAttrsSpec.js:
92: if (msie < 9) return; //IE8 doesn't support biding to boolean attributes

https://github.com/angular/angular.js/blob/master/test/ng/directive/formSpec.js:
262: if (msie==8) addEventListenerFn(doc[0], 'submit', assertPreventDefaultListener);
270: if (msie!=8) addEventListenerFn(doc[0], 'submit', assertPreventDefaultListener);
321: if (msie == 8) addEventListenerFn(form[0], 'submit', assertPreventDefaultListener);
325: if (msie != 8) addEventListenerFn(form[0], 'submit', assertPreventDefaultListener);
337: if (msie == 8) browserTrigger(form, 'submit');
349: if (msie < 9) {

https://github.com/angular/angular.js/blob/master/test/ng/directive/inputSpec.js:
1295: if (!msie || msie >= 9) {
1329: if (!msie || msie >= 9) {

https://github.com/angular/angular.js/blob/master/test/ng/directive/ngRepeatSpec.js:
928: if (!msie || msie > 8) {

https://github.com/angular/angular.js/blob/master/test/ng/httpBackendSpec.js:
97: expect(statusText).toBe((!msie || msie >= 10) ? 'OK' : '');

https://github.com/angular/angular.js/blob/master/test/ng/httpSpec.js:
346: if (msie < 9) return;

https://github.com/angular/angular.js/blob/master/test/ng/locationSpec.js:
1280: if (!msie || msie >= 9) {

https://github.com/angular/angular.js/blob/master/test/ng/snifferSpec.js:
83: expect($sniffer.hasEvent('input')).toBe((msie == 9) ? false : true);

https://github.com/angular/angular.js/blob/master/test/ngMock/angular-mocksSpec.js:
700: if ($sniffer.msie<=8) return;
858: if ($sniffer.msie <= 8) return;
868: if ($sniffer.msie <= 8) return;

There is a unit test to remove to:

https://github.com/angular/angular.js/blob/master/test/AngularSpec.js:
376: if (msie<=8) return;
1036: if (!msie || msie >= 9) {
1257: describe('msie UA parsing', function() {

Also $sce does other MSIE related sniffing:

https://github.com/angular/angular.js/blob/master/src/ng/sce.js:
734: if (enabled && $sniffer.msie && $sniffer.msieDocumentMode < 8) {

@tbosch
Copy link
Contributor

tbosch commented Oct 3, 2014

LGTM

1 similar comment
@btford
Copy link
Contributor

btford commented Oct 6, 2014

LGTM

@IgorMinar
Copy link
Contributor Author

@petebacondarwin msie will still be a numeric value after this change

@petebacondarwin
Copy link
Contributor

Yeah I get it now. I didn't check what documentMode actually was before
posting that monster comment. I thought it was just a function that only
existed on IE. I guess this property is accurate and available on IE9
upwards?
On 6 Oct 2014 23:28, "Igor Minar" [email protected] wrote:

@petebacondarwin https://github.com/petebacondarwin msie will still be
a numeric value after this change


Reply to this email directly or view it on GitHub
#9398 (comment).

@realityking
Copy link
Contributor

documentMode is available since Internet Explorer 7 (it has recently been deprecated but is still available). It will always return the rendering mode, so if you use Internet Explorer 11 in IE9 mode it will return 9. That's probably event better than what happens now.

@IgorMinar IgorMinar closed this in a84480a Oct 7, 2014
@btford btford removed the In Progress label Oct 7, 2014
@vitaly-t
Copy link

vitaly-t commented Oct 7, 2014

Makes me think that it would be nice if AngularJS had embedded $browser service, so it could be used by the library internally and by the client's code where needed - all in the same consistent way.

bullgare pushed a commit to bullgare/angular.js that referenced this pull request Oct 9, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants