Skip to content

Commit 4056cfc

Browse files
committed
Remove IE9/IE10 workarounds
1 parent 14acd45 commit 4056cfc

24 files changed

Lines changed: 100 additions & 331 deletions

File tree

src/vs/base/browser/browser.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,9 @@ export function onDidChangeFullscreen(callback: () => void): IDisposable {
114114

115115
const userAgent = navigator.userAgent;
116116

117-
// DOCUMENTED FOR FUTURE REFERENCE:
118-
// When running IE11 in IE10 document mode, the code below will identify the browser as being IE10,
119-
// which is correct because IE11 in IE10 document mode will reimplement all the bugs of IE10
120-
export const isIE11 = (userAgent.indexOf('Trident') >= 0 && userAgent.indexOf('MSIE') < 0);
121-
export const isIE10 = (userAgent.indexOf('MSIE 10') >= 0);
122-
export const isIE9 = (userAgent.indexOf('MSIE 9') >= 0);
123-
export const isIE11orEarlier = isIE11 || isIE10 || isIE9;
124-
export const isIE10orEarlier = isIE10 || isIE9;
125-
export const isIE10orLater = isIE11 || isIE10;
117+
export const isIE = (userAgent.indexOf('Trident') >= 0);
126118
export const isEdge = (userAgent.indexOf('Edge/') >= 0);
127-
export const isEdgeOrIE = isEdge || isIE11 || isIE10 || isIE9;
119+
export const isEdgeOrIE = isIE || isEdge;
128120

129121
export const isOpera = (userAgent.indexOf('Opera') >= 0);
130122
export const isFirefox = (userAgent.indexOf('Firefox') >= 0);
@@ -133,7 +125,7 @@ export const isChrome = (userAgent.indexOf('Chrome') >= 0);
133125
export const isSafari = (userAgent.indexOf('Chrome') === -1) && (userAgent.indexOf('Safari') >= 0);
134126
export const isIPad = (userAgent.indexOf('iPad') >= 0);
135127

136-
export const canUseTranslate3d = !isIE9 && !isFirefox;
128+
export const canUseTranslate3d = !isFirefox;
137129

138130
export const enableEmptySelectionClipboard = isWebKit;
139131

@@ -167,7 +159,7 @@ export function hasCSSAnimationSupport() {
167159

168160
export function supportsExecCommand(command: string): boolean {
169161
return (
170-
(isIE11orEarlier || Platform.isNative)
162+
(isIE || Platform.isNative)
171163
&& document.queryCommandSupported(command)
172164
);
173165
}

src/vs/base/browser/dom.ts

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -176,58 +176,36 @@ export function toggleClass(node: HTMLElement, className: string, shouldHaveIt?:
176176
}
177177
}
178178

179-
class DomListener extends Disposable {
179+
class DomListener implements IDisposable {
180180

181-
private _usedAddEventListener: boolean;
182-
private _wrapHandler: (e: any) => void;
183-
private _node: any;
184-
private _type: string;
185-
private _useCapture: boolean;
186-
187-
constructor(node: Element | Window | Document, type: string, handler: (e: any) => void, useCapture?: boolean) {
188-
super();
181+
private _handler: (e: any) => void;
182+
private _node: Element | Window | Document;
183+
private readonly _type: string;
184+
private readonly _useCapture: boolean;
189185

186+
constructor(node: Element | Window | Document, type: string, handler: (e: any) => void, useCapture: boolean) {
190187
this._node = node;
191188
this._type = type;
189+
this._handler = handler;
192190
this._useCapture = (useCapture || false);
193-
194-
this._wrapHandler = (e) => {
195-
e = e || window.event;
196-
handler(e);
197-
};
198-
199-
if (typeof this._node.addEventListener === 'function') {
200-
this._usedAddEventListener = true;
201-
this._node.addEventListener(this._type, this._wrapHandler, this._useCapture);
202-
} else {
203-
this._usedAddEventListener = false;
204-
this._node.attachEvent('on' + this._type, this._wrapHandler);
205-
}
191+
this._node.addEventListener(this._type, this._handler, this._useCapture);
206192
}
207193

208194
public dispose(): void {
209-
if (!this._wrapHandler) {
195+
if (!this._handler) {
210196
// Already disposed
211197
return;
212198
}
213199

214-
if (this._usedAddEventListener) {
215-
this._node.removeEventListener(this._type, this._wrapHandler, this._useCapture);
216-
} else {
217-
this._node.detachEvent('on' + this._type, this._wrapHandler);
218-
}
200+
this._node.removeEventListener(this._type, this._handler, this._useCapture);
219201

220202
// Prevent leakers from holding on to the dom or handler func
221203
this._node = null;
222-
this._wrapHandler = null;
204+
this._handler = null;
223205
}
224206
}
225207

226-
export function addDisposableListener(node: Element, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;
227-
export function addDisposableListener(node: Element | Window, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;
228-
export function addDisposableListener(node: Window, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;
229-
export function addDisposableListener(node: Document, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable;
230-
export function addDisposableListener(node: any, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable {
208+
export function addDisposableListener(node: Element | Window | Document, type: string, handler: (event: any) => void, useCapture?: boolean): IDisposable {
231209
return new DomListener(node, type, handler, useCapture);
232210
}
233211

@@ -444,9 +422,9 @@ class AnimationFrameQueueItem implements IDisposable {
444422
};
445423
})();
446424

447-
/// <summary>
448-
/// Add a throttled listener. `handler` is fired at most every 16ms or with the next animation frame (if browser supports it).
449-
/// </summary>
425+
/**
426+
* Add a throttled listener. `handler` is fired at most every 16ms or with the next animation frame (if browser supports it).
427+
*/
450428
export interface IEventMerger<R> {
451429
(lastEvent: R, currentEvent: Event): R;
452430
}

src/vs/base/browser/keyboardEvent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ let KEY_CODE_MAP: { [keyCode: number]: KeyCode } = {};
128128

129129
KEY_CODE_MAP[226] = KeyCode.OEM_102;
130130

131-
if (browser.isIE11orEarlier) {
131+
if (browser.isIE) {
132132
KEY_CODE_MAP[91] = KeyCode.Meta;
133133
} else if (browser.isFirefox) {
134134
KEY_CODE_MAP[59] = KeyCode.US_SEMICOLON;

src/vs/base/browser/ui/inputbox/inputBox.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,11 @@ export class InputBox extends Widget {
125125
this.onfocus(this.input, () => this.onFocus());
126126

127127
// Add placeholder shim for IE because IE decides to hide the placeholder on focus (we dont want that!)
128-
if (this.placeholder && Bal.isIE11orEarlier) {
128+
if (this.placeholder && Bal.isIE) {
129129
this.onclick(this.input, (e) => {
130130
dom.EventHelper.stop(e, true);
131131
this.input.focus();
132132
});
133-
134-
if (Bal.isIE9) {
135-
this.onkeyup(this.input, () => this.onValueChange());
136-
}
137133
}
138134

139135
setTimeout(() => this.updateMirror(), 0);

src/vs/base/browser/ui/menu/menu.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@
104104
animation: fadeIn 0.083s linear;
105105
}
106106

107-
.ie.ie9 .context-view.monaco-menu-container {
108-
box-shadow: 0 2px 8px 2px #A8A8A8;
109-
}
110-
111107
.context-view.monaco-menu-container :focus {
112108
outline: 0;
113109
}

src/vs/base/common/diff/diff.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,10 @@ class DiffChangeHelper {
196196
return this.m_changes;
197197
}
198198

199+
/**
200+
* Retrieves all of the changes marked by the class in the reverse order
201+
*/
199202
public getReverseChanges(): DiffChange[] {
200-
/// <summary>
201-
/// Retrieves all of the changes marked by the class in the reverse order
202-
/// </summary>
203203
if (this.m_originalCount > 0 || this.m_modifiedCount > 0) {
204204
// Finish up on whatever is left
205205
this.MarkNextChange();

src/vs/base/parts/quickopen/browser/quickOpenWidget.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'vs/css!./quickopen';
88
import nls = require('vs/nls');
99
import { TPromise } from 'vs/base/common/winjs.base';
1010
import platform = require('vs/base/common/platform');
11-
import browser = require('vs/base/browser/browser');
1211
import { EventType } from 'vs/base/common/events';
1312
import types = require('vs/base/common/types');
1413
import errors = require('vs/base/common/errors');
@@ -182,11 +181,6 @@ export class QuickOpenWidget implements IModelProvider {
182181
this.elementSelected(focus, e, shouldOpenInBackground ? Mode.OPEN_IN_BACKGROUND : Mode.OPEN);
183182
}
184183
}
185-
186-
// Bug in IE 9: onInput is not fired for Backspace or Delete keys
187-
else if (browser.isIE9 && (keyboardEvent.keyCode === KeyCode.Backspace || keyboardEvent.keyCode === KeyCode.Delete)) {
188-
this.onType();
189-
}
190184
});
191185

192186
DOM.addDisposableListener(this.inputBox.inputElement, DOM.EventType.INPUT, (e: Event) => {
@@ -301,7 +295,6 @@ export class QuickOpenWidget implements IModelProvider {
301295

302296
// Widget Attributes
303297
.addClass('quick-open-widget')
304-
.addClass((browser.isIE10orEarlier) ? ' no-shadow' : '')
305298
.build(this.container);
306299

307300
// Support layout

src/vs/base/parts/quickopen/browser/quickopen.css

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,11 @@
107107
box-shadow: 0 5px 8px #A8A8A8;
108108
}
109109

110-
.quick-open-widget.no-shadow {
111-
box-shadow: none;
112-
border: 1px solid #E6E6E6;
113-
}
114-
115110
.vs-dark .quick-open-widget {
116111
background-color: #252526;
117112
box-shadow: 0 5px 8px #000;
118113
}
119114

120-
.vs-dark .quick-open-widget.no-shadow {
121-
box-shadow: none;
122-
border: 1px solid #000;
123-
}
124-
125115
.vs-dark .quick-open-widget input {
126116
background-color: #3C3C3C;
127117
color: inherit;

src/vs/base/parts/tree/browser/treeView.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ export class TreeView extends HeightMap {
495495
this.emit('scroll', e); // TODO@Joao: is anyone interested in this event?
496496
});
497497

498-
if (Browser.isIE11orEarlier) {
498+
if (Browser.isIE) {
499499
this.wrapper.style.msTouchAction = 'none';
500500
this.wrapper.style.msContentZooming = 'none';
501501
} else {
@@ -519,7 +519,7 @@ export class TreeView extends HeightMap {
519519
this.viewListeners.push(DOM.addDisposableListener(this.wrapper, Touch.EventType.Tap, (e) => this.onTap(e)));
520520
this.viewListeners.push(DOM.addDisposableListener(this.wrapper, Touch.EventType.Change, (e) => this.onTouchChange(e)));
521521

522-
if (Browser.isIE11orEarlier) {
522+
if (Browser.isIE) {
523523
this.viewListeners.push(DOM.addDisposableListener(this.wrapper, 'MSPointerDown', (e) => this.onMsPointerDown(e)));
524524
this.viewListeners.push(DOM.addDisposableListener(this.wrapper, 'MSGestureTap', (e) => this.onMsGestureTap(e)));
525525

@@ -1116,7 +1116,7 @@ export class TreeView extends HeightMap {
11161116
return;
11171117
}
11181118

1119-
if (Browser.isIE10orLater && Date.now() - this.lastClickTimeStamp < 300) {
1119+
if (Browser.isIE && Date.now() - this.lastClickTimeStamp < 300) {
11201120
// IE10+ doesn't set the detail property correctly. While IE10 simply
11211121
// counts the number of clicks, IE11 reports always 1. To align with
11221122
// other browser, we set the value to 2 if clicks events come in a 300ms

src/vs/base/test/browser/browser.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ suite('Browsers', () => {
1313
assert(!(isWindows && isMacintosh));
1414

1515
let isOpera = browser.isOpera || navigator.userAgent.indexOf('OPR') >= 0;
16-
let isIE11orEarlier = browser.isIE11orEarlier;
16+
let isIE = browser.isIE;
1717
let isFirefox = browser.isFirefox;
1818
let isWebKit = browser.isWebKit;
1919
let isChrome = browser.isChrome;
@@ -25,7 +25,7 @@ suite('Browsers', () => {
2525
if (isOpera) {
2626
browserCount++;
2727
}
28-
if (isIE11orEarlier) {
28+
if (isIE) {
2929
browserCount++;
3030
}
3131
if (isFirefox) {

0 commit comments

Comments
 (0)