jquery.client: Recognize IE12 correctly
authorRoan Kattouw <roan.kattouw@gmail.com>
Thu, 4 Dec 2014 02:01:55 +0000 (18:01 -0800)
committerKrinkle <krinklemail@gmail.com>
Fri, 5 Dec 2014 12:22:00 +0000 (12:22 +0000)
IE12's User-Agent is, unhelpfully:

Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36 Edge/12.0

Unsurprisingly, this is currently recognized as Chrome 36.
The word "Trident" also doesn't appear any more, because IE12's
new layout engine is called "Edge". So look for that string instead.

Change-Id: I94a4ff2cc37ae6ce0c677ef92eeb6a2dff30c1f4

resources/src/jquery/jquery.client.js
tests/qunit/suites/resources/jquery/jquery.client.test.js

index 662a688..3796b0b 100644 (file)
                                // Tanslations for conforming browser names
                                nameTranslations = [],
                                // Names of known layout engines
-                               layouts = ['gecko', 'konqueror', 'msie', 'trident', 'opera', 'webkit'],
+                               layouts = ['gecko', 'konqueror', 'msie', 'trident', 'edge', 'opera', 'webkit'],
                                // Translations for conforming layout names
                                layoutTranslations = [ ['konqueror', 'khtml'], ['msie', 'trident'], ['opera', 'presto'] ],
                                // Names of supported layout engines for version number
-                               layoutVersions = ['applewebkit', 'gecko', 'trident'],
+                               layoutVersions = ['applewebkit', 'gecko', 'trident', 'edge'],
                                // Names of known operating systems
                                platforms = ['win', 'wow64', 'mac', 'linux', 'sunos', 'solaris', 'iphone'],
                                // Translations for conforming operating system names
                                        version = match[1];
                                }
                        }
+                       // And IE 12's different lies about not being IE
+                       if ( name === 'chrome' && ( match = ua.match( /\bedge\/([0-9\.]*)/ ) ) ) {
+                               name = 'msie';
+                               version = match[1];
+                               layout = 'edge';
+                               layoutversion = parseInt( match[1], 10 );
+                       }
                        // And Amazon Silk's lies about being Android on mobile or Safari on desktop
                        if ( match = ua.match( /\bsilk\/([0-9.\-_]*)/ ) ) {
                                if ( match[1] ) {
index c6dd91c..ee0f060 100644 (file)
                                        rtl: true
                                }
                        },
+                       // Internet Explorer 12
+                       'Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36 Edge/12.0': {
+                               title: 'Internet Explorer 12',
+                               platform: 'WOW64',
+                               profile: {
+                                       name: 'msie',
+                                       layout: 'edge',
+                                       layoutVersion: 12,
+                                       platform: 'win',
+                                       version: '12.0',
+                                       versionBase: '12',
+                                       versionNumber: 12
+                               },
+                               wikiEditor: {
+                                       ltr: true,
+                                       rtl: true
+                               }
+                       },
                        // Firefox 2
                        // Firefox 3.5
                        'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.19) Gecko/20110420 Firefox/3.5.19': {