From e556ac73e09687ac726510cca6237f2ba93d3bb0 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 3 Dec 2014 18:01:55 -0800 Subject: [PATCH] jquery.client: Recognize IE12 correctly 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 | 11 +++++++++-- .../resources/jquery/jquery.client.test.js | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/resources/src/jquery/jquery.client.js b/resources/src/jquery/jquery.client.js index 662a688755..3796b0b1ab 100644 --- a/resources/src/jquery/jquery.client.js +++ b/resources/src/jquery/jquery.client.js @@ -87,11 +87,11 @@ // 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 @@ -173,6 +173,13 @@ 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] ) { diff --git a/tests/qunit/suites/resources/jquery/jquery.client.test.js b/tests/qunit/suites/resources/jquery/jquery.client.test.js index c6dd91c4c4..ee0f060cfa 100644 --- a/tests/qunit/suites/resources/jquery/jquery.client.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.client.test.js @@ -98,6 +98,24 @@ 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': { -- 2.20.1