Skip to content

Commit 9a55aa3

Browse files
committed
pat-inject: Code modernization: Remove dependency on jquery-ext.
1 parent d5f69c2 commit 9a55aa3

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";
@@ -461,9 +460,11 @@ const inject = {
461460
}
462461
let $src;
463462
$src = $source.safeClone();
464-
$src.findInclusive("img").on("load", (e) => {
465-
$(e.currentTarget).trigger("pat-inject-content-loaded");
466-
});
463+
for (const img of dom.querySelectorAllAndMe($src[0], "img")) {
464+
$(img).on("load", (e) => {
465+
$(e.currentTarget).trigger("pat-inject-content-loaded");
466+
});
467+
}
467468

468469
const $injected = cfg.$injected || $src;
469470
// Now the injection actually happens.
@@ -529,7 +530,7 @@ const inject = {
529530
// 2) getting the element to scroll to (if not "top")
530531
const scroll_target = ["top", "target"].includes(cfg.scroll)
531532
? cfg.$target[0]
532-
: $injected.findInclusive(cfg.scroll)[0];
533+
: dom.querySelectorAllAndMe($injected[0], cfg.scroll);
533534

534535
const scroll_container = dom.find_scroll_container(
535536
scroll_target,

0 commit comments

Comments
 (0)