Skip to content

Commit

Permalink
breaking: Remove remaining IE support code.
Browse files Browse the repository at this point in the history
  • Loading branch information
thet committed Sep 27, 2022
1 parent 72c393a commit 927b3be
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions src/pat/inject/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,39 +416,14 @@ const inject = {
return $target;
},

stopBubblingFromRemovedElement($el, cfgs, ev) {
/* IE8 fix. Stop event from propagating IF $el will be removed
* from the DOM. With pat-inject, often $el is the target that
* will itself be replaced with injected content.
*
* IE8 cannot handle events bubbling up from an element removed
* from the DOM.
*
* See: http://stackoverflow.com/questions/7114368/why-is-jquery-remove-throwing-attr-exception-in-ie8
*/
for (const cfg of cfgs) {
const sel = cfg.target;
if ($el.parents(sel).addBack(sel) && !ev.isPropagationStopped()) {
ev.stopPropagation();
return;
}
}
},

_performInjection(target, $el, $source, cfg, trigger, title) {
/* Called after the XHR has succeeded and we have a new $source
* element to inject.
*/
if (cfg.sourceMod === "content") {
$source = $source.contents();
}
let $src;
// $source.clone() does not work with shived elements in IE8
if (document.all && document.querySelector && !document.addEventListener) {
$src = $source.map((idx, el) => $(el.outerHTML)[0]);
} else {
$src = $source.safeClone();
}
const $src = $source.safeClone();

$src.findInclusive("img").on("load", (e) => {
$(e.currentTarget).trigger("pat-inject-content-loaded");
Expand Down Expand Up @@ -491,7 +466,6 @@ const inject = {
*/
$injected
.filter((idx, el_) => {
// setting data on textnode fails in IE8
return el_.nodeType !== TEXT_NODE;
})
.data("pat-injected", { origin: cfg.url });
Expand Down Expand Up @@ -591,7 +565,6 @@ const inject = {
$.each(cfgs[0].hooks || [], (idx, hook) =>
$el.trigger("pat-inject-hook-" + hook)
);
this.stopBubblingFromRemovedElement($el, cfgs, ev);
const sources$ = await this.callTypeHandler(cfgs[0].dataType, "sources", $el, [
cfgs,
data,
Expand Down

0 comments on commit 927b3be

Please sign in to comment.