From: MatmaRex Date: Sun, 7 Jul 2013 22:23:00 +0000 (+0200) Subject: jquery.client: Detect Internet Explorer 11 X-Git-Tag: 1.31.0-rc.0~19212^2 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=92f06b4afb80bf5547673504478c25eae94edeba;p=lhc%2Fweb%2Fwiklou.git jquery.client: Detect Internet Explorer 11 It only admits it's using Trident, the browser name is not in the UA. Side-effects: detects Trident's version for IE10 as well, detect WOW64 as Windows. Also minor code consistency changes. Bug: 50873 Change-Id: I79d65548e90d2c98c4e1d3253ac432801f48b4ba --- diff --git a/resources/jquery/jquery.client.js b/resources/jquery/jquery.client.js index 42e76eb819..5a95dc5b13 100644 --- a/resources/jquery/jquery.client.js +++ b/resources/jquery/jquery.client.js @@ -82,15 +82,15 @@ // Tanslations for conforming browser names nameTranslations = [], // Names of known layout engines - layouts = ['gecko', 'konqueror', 'msie', 'opera', 'webkit'], + layouts = ['gecko', 'konqueror', 'msie', 'trident', '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'], + layoutVersions = ['applewebkit', 'gecko', 'trident'], // Names of known operating systems - platforms = ['win', 'mac', 'linux', 'sunos', 'solaris', 'iphone'], + platforms = ['win', 'wow64', 'mac', 'linux', 'sunos', 'solaris', 'iphone'], // Translations for conforming operating system names - platformTranslations = [ ['sunos', 'solaris'] ], + platformTranslations = [ ['sunos', 'solaris'], ['wow64', 'win'] ], /* Methods */ @@ -162,6 +162,13 @@ version = match[1]; } } + // And IE 11's lies about being not being IE + if ( layout === 'trident' && layoutversion >= 7 && ( match = ua.match( /\brv[ :\/]([0-9\.]*)/ ) ) ) { + if ( match[1] ) { + name = 'msie'; + version = match[1]; + } + } versionNumber = parseFloat( version, 10 ) || 0.0; diff --git a/tests/qunit/suites/resources/jquery/jquery.client.test.js b/tests/qunit/suites/resources/jquery/jquery.client.test.js index 4163e9ee11..4c7c302222 100644 --- a/tests/qunit/suites/resources/jquery/jquery.client.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.client.test.js @@ -34,7 +34,7 @@ profile: { name: 'msie', layout: 'trident', - layoutVersion: 'unknown', // should be able to report 6? + layoutVersion: 6, platform: 'win', version: '10.0', versionBase: '10', @@ -45,6 +45,60 @@ rtl: true } }, + // Internet Explorer 11 + 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv 11.0) like Gecko': { + title: 'Internet Explorer 11', + platform: 'Win32', + profile: { + name: 'msie', + layout: 'trident', + layoutVersion: 7, + platform: 'win', + version: '11.0', + versionBase: '11', + versionNumber: 11 + }, + wikiEditor: { + ltr: true, + rtl: true + } + }, + // Internet Explorer 11 - Windows 8.1 x64 Modern UI + 'Mozilla/5.0 (Windows NT 6.3; Win64; x64; Trident/7.0; rv:11.0) like Gecko': { + title: 'Internet Explorer 11', + platform: 'Win64', + profile: { + name: 'msie', + layout: 'trident', + layoutVersion: 7, + platform: 'win', + version: '11.0', + versionBase: '11', + versionNumber: 11 + }, + wikiEditor: { + ltr: true, + rtl: true + } + }, + // Internet Explorer 11 - Windows 8.1 x64 desktop UI + 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko': { + title: 'Internet Explorer 11', + platform: 'WOW64', + profile: { + name: 'msie', + layout: 'trident', + layoutVersion: 7, + platform: 'win', + version: '11.0', + versionBase: '11', + versionNumber: 11 + }, + 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': {