Skip to content

Commit 9de0d95

Browse files
committed
maint: Remove IE related code paths.
1 parent a9ba471 commit 9de0d95

File tree

8 files changed

+8
-100
lines changed

8 files changed

+8
-100
lines changed

src/core/store.test.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,13 @@ describe("Core / store", function () {
99
it("localStorage accessor", function () {
1010
var storage = store.local("mypattern");
1111
expect(storage.prefix).toBe("mypattern");
12-
try {
13-
expect(storage.backend).toBe(window.localStorage);
14-
} catch (e) {
15-
// IE8 throws an exception if you try to do something as
16-
// simple as window.localStorage===window.localStorage
17-
}
12+
expect(storage.backend).toBe(window.localStorage);
1813
});
1914

2015
it("sessionStorage accessor", function () {
2116
var storage = store.session("mypattern");
2217
expect(storage.prefix).toBe("mypattern");
23-
try {
24-
expect(storage.backend).toBe(window.sessionStorage);
25-
} catch (e) {
26-
// IE8 throws an exception if you try to do something as
27-
// simple as window.localStorage===window.localStorage
28-
}
18+
expect(storage.backend).toBe(window.sessionStorage);
2919
});
3020
});
3121

src/core/utils.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,6 @@ const _MS_PER_DAY = 1000 * 60 * 60 * 24; // Milliseconds per day.
55

66
$.fn.safeClone = function () {
77
var $clone = this.clone();
8-
// IE 9-11 BUG : Placeholder text becomes actual value after deep clone on textarea
9-
// https://connect.microsoft.com/IE/feedback/details/781612/placeholder-text-becomes-actual-value-after-deep-clone-on-textarea
10-
// Ref:
11-
// https://github.com/Patternslib/Patterns/issues/412
12-
// https://github.com/Patternslib/Patterns/pull/410
13-
if (window.document.documentMode) {
14-
$clone.findInclusive(":input[placeholder]").each(function (i, item) {
15-
var $item = $(item);
16-
if ($item.attr("placeholder") === $item.val()) {
17-
$item.val("");
18-
}
19-
});
20-
}
218
return $clone;
229
};
2310

src/lib/input-change-events.js

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,28 +57,10 @@ var _ = {
5757
}
5858
}
5959
if (isText || isNumber) {
60-
if ("oninput" in window) {
61-
$el.on("input." + namespace, function () {
62-
log.debug("translating input");
63-
$el.trigger("input-change");
64-
});
65-
} else {
66-
// this is the legacy code path for IE8
67-
// Work around buggy placeholder polyfill.
68-
if ($el.attr("placeholder")) {
69-
$el.on("keyup." + namespace, function () {
70-
log.debug("translating keyup");
71-
$el.trigger("input-change");
72-
});
73-
} else {
74-
$el.on("propertychange." + namespace, function (ev) {
75-
if (ev.originalEvent.propertyName === "value") {
76-
log.debug("translating propertychange");
77-
$el.trigger("input-change");
78-
}
79-
});
80-
}
81-
}
60+
$el.on("input." + namespace, function () {
61+
log.debug("translating input");
62+
$el.trigger("input-change");
63+
});
8264
} else {
8365
$el.on("change." + namespace, function () {
8466
log.debug("translating change");

src/pat/ajax/ajax.test.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ describe("pat-ajax", function () {
2727
});
2828
});
2929

30-
//
31-
// ATTENTION: These might fail on IE8 due to different code
32-
// path in jquery.form that does not use $.ajax
33-
//
3430
describe("form", function () {
3531
var $form, $button, spy_ajax;
3632

src/pat/auto-suggest/_auto-suggest.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Version: 3.4.3 Timestamp: Tue Sep 17 06:47:14 PDT 2013
1111
margin: 0;
1212
position: relative;
1313
display: inline-block;
14-
/* inline-block for ie7 */
1514
zoom: 1;
1615
*display: inline;
1716
vertical-align: middle;
@@ -421,9 +420,6 @@ disabled look for disabled choices in the results dropdown
421420
}
422421

423422
.select2-container-multi {
424-
.select2-choices {
425-
/*min-height: 26px;*/
426-
}
427423
&.select2-container-active .select2-choices {
428424
border: 1px solid #5897fb;
429425
outline: none;
@@ -440,7 +436,6 @@ disabled look for disabled choices in the results dropdown
440436
padding: 0 0 0 0.5em;
441437
white-space: nowrap;
442438
height: 1.6em;
443-
/*The following line is a patch to make IE8 show the actual input field that's within this LI element*/
444439
min-width: 200px;
445440
input {
446441
padding: 0;

src/pat/inject/inject.js

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -416,25 +416,6 @@ const inject = {
416416
return $target;
417417
},
418418

419-
stopBubblingFromRemovedElement($el, cfgs, ev) {
420-
/* IE8 fix. Stop event from propagating IF $el will be removed
421-
* from the DOM. With pat-inject, often $el is the target that
422-
* will itself be replaced with injected content.
423-
*
424-
* IE8 cannot handle events bubbling up from an element removed
425-
* from the DOM.
426-
*
427-
* See: http://stackoverflow.com/questions/7114368/why-is-jquery-remove-throwing-attr-exception-in-ie8
428-
*/
429-
for (const cfg of cfgs) {
430-
const sel = cfg.target;
431-
if ($el.parents(sel).addBack(sel) && !ev.isPropagationStopped()) {
432-
ev.stopPropagation();
433-
return;
434-
}
435-
}
436-
},
437-
438419
_performInjection(target, $el, $source, cfg, trigger, title) {
439420
/* Called after the XHR has succeeded and we have a new $source
440421
* element to inject.
@@ -443,13 +424,7 @@ const inject = {
443424
$source = $source.contents();
444425
}
445426
let $src;
446-
// $source.clone() does not work with shived elements in IE8
447-
if (document.all && document.querySelector && !document.addEventListener) {
448-
$src = $source.map((idx, el) => $(el.outerHTML)[0]);
449-
} else {
450-
$src = $source.safeClone();
451-
}
452-
427+
$src = $source.safeClone();
453428
$src.findInclusive("img").on("load", (e) => {
454429
$(e.currentTarget).trigger("pat-inject-content-loaded");
455430
});
@@ -491,7 +466,6 @@ const inject = {
491466
*/
492467
$injected
493468
.filter((idx, el_) => {
494-
// setting data on textnode fails in IE8
495469
return el_.nodeType !== TEXT_NODE;
496470
})
497471
.data("pat-injected", { origin: cfg.url });
@@ -591,7 +565,6 @@ const inject = {
591565
$.each(cfgs[0].hooks || [], (idx, hook) =>
592566
$el.trigger("pat-inject-hook-" + hook)
593567
);
594-
this.stopBubblingFromRemovedElement($el, cfgs, ev);
595568
const sources$ = await this.callTypeHandler(cfgs[0].dataType, "sources", $el, [
596569
cfgs,
597570
data,
@@ -973,15 +946,6 @@ const inject = {
973946
}
974947
}
975948

976-
// XXX: IE8 changes the order of attributes in html. The following
977-
// lines move data-pat-inject-rebase-src to src.
978-
$page.find("[data-pat-inject-rebase-src]").each((id, el_) => {
979-
const $el = $(el_);
980-
$el.attr("src", $el.attr("data-pat-inject-rebase-src")).removeAttr(
981-
"data-pat-inject-rebase-src"
982-
);
983-
});
984-
985949
return $page
986950
.html()
987951
.replace(/src="" data-pat-inject-rebase-/g, "")

src/pat/modal/modal.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,7 @@ export default Base.extend({
101101

102102
// Restore focus in case the active element was a child of $el and
103103
// the focus was lost during the wrapping.
104-
// Only if we have an activeElement, as IE10/11 can have undefined as activeElement
105-
if (document.activeElement) {
106-
document.activeElement.focus();
107-
}
104+
document.activeElement?.focus();
108105

109106
this._init_handlers();
110107
this.resize();

src/pat/sortable/sortable.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ export default Base.extend({
4949
},
5050

5151
addHandles: function () {
52-
/* Add handles and make them draggable for HTML5 and IE8/9
53-
* it has to be an "a" tag (or img) to make it draggable in IE8/9
54-
*/
5552
var $sortables_without_handles = this.$sortables.filter(function () {
5653
return $(this).find(".sortable-handle").length === 0;
5754
});

0 commit comments

Comments
 (0)