mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-29 03:00:45 -04:00
* disable stylesheet on next tick to avoid FOUC * fix regex matching logic * Avoid regex and remove stylesheet's ownerNode after disabling * Use inline <style> as opposed to <link> tags when restyling for IE11 compatibility * Be more careful to avoid possibility of removal modifying styleSheets * Use inline <style> for IE; otherwise update the <link> * Update srcjs/output_binding_html.js Co-authored-by: Winston Chang <winston@stdout.org> * Update browser.js to correctly detect IE11 * remove redundant if statements Co-authored-by: Winston Chang <winston@stdout.org>
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
var browser = (function() {
|
|
|
|
var isQt = false;
|
|
// For easy handling of Qt quirks using CSS
|
|
if (/\bQt\//.test(window.navigator.userAgent)) {
|
|
$(document.documentElement).addClass('qt');
|
|
isQt = true;
|
|
}
|
|
|
|
// Enable special treatment for Qt 5 quirks on Linux
|
|
if (/\bQt\/5/.test(window.navigator.userAgent) &&
|
|
/Linux/.test(window.navigator.userAgent)) {
|
|
$(document.documentElement).addClass('qt5');
|
|
}
|
|
|
|
// Detect IE information
|
|
var ua = window.navigator.userAgent;
|
|
var isIE = /MSIE|Trident/.test(ua);
|
|
|
|
function getIEVersion() {
|
|
var msie = ua.indexOf('MSIE ');
|
|
if (isIE && msie > 0) {
|
|
// IE 10 or older => return version number
|
|
return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
|
|
}
|
|
var trident = ua.indexOf('Trident/');
|
|
if (trident > 0) {
|
|
// IE 11 => return version number
|
|
var rv = ua.indexOf('rv:');
|
|
return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
return {
|
|
isQt: isQt,
|
|
isIE: isIE,
|
|
IEVersion: getIEVersion()
|
|
};
|
|
|
|
})();
|