Skip to content

Commit 0c15615

Browse files
committed
pat-inject: Code modernization: Remove dependency on jquery-ext.
1 parent 7f5242d commit 0c15615

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/pat/inject/inject.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import "../../core/jquery-ext"; // for findInclusive
21
import "../../core/polyfills"; // SubmitEvent.submitter for Safari < 15.4 and jsDOM
32
import $ from "jquery";
43
import ajax from "../ajax/ajax";
@@ -459,9 +458,11 @@ const inject = {
459458
}
460459
let $src;
461460
$src = $source.safeClone();
462-
$src.findInclusive("img").on("load", (e) => {
463-
$(e.currentTarget).trigger("pat-inject-content-loaded");
464-
});
461+
for (const img of dom.querySelectorAllAndMe($src[0], "img")) {
462+
$(img).on("load", (e) => {
463+
$(e.currentTarget).trigger("pat-inject-content-loaded");
464+
});
465+
}
465466

466467
const $injected = cfg.$injected || $src;
467468
// Now the injection actually happens.
@@ -527,7 +528,7 @@ const inject = {
527528
// 2) getting the element to scroll to (if not "top")
528529
const scroll_target = ["top", "target"].includes(cfg.scroll)
529530
? cfg.$target[0]
530-
: $injected.findInclusive(cfg.scroll)[0];
531+
: dom.querySelectorAllAndMe($injected[0], cfg.scroll);
531532

532533
const scroll_container = dom.find_scroll_container(
533534
scroll_target,

0 commit comments

Comments
 (0)