Skip to content

Commit bb8ce9d

Browse files
committed
maint(pat-ajax): Improve the default function from the url argument to not use jQuery.
1 parent 099da3c commit bb8ce9d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/pat/ajax/ajax.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@ const log = logging.getLogger("pat.ajax");
1414
export const parser = new Parser("ajax");
1515
parser.addArgument("accept", "text/html");
1616
parser.addArgument("url", function ($el) {
17-
var val = $el.is("a") ? $el.attr("href") : $el.is("form") ? $el.attr("action") : "";
18-
return (val || "").split("#")[0];
17+
const el = $el[0];
18+
const value =
19+
el.tagName === "A"
20+
? el.getAttribute("href")
21+
: el.tagName === "FORM"
22+
? el.getAttribute("action")
23+
: "";
24+
return (value || "").split("#")[0];
1925
});
2026
parser.addArgument("browser-cache", "no-cache", ["cache", "no-cache"]); // Cache ajax requests
2127

0 commit comments

Comments
 (0)