Skip to content

Commit dc7c0ff

Browse files
committed
maint(pat subform): Modernize code.
1 parent 57c740a commit dc7c0ff

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/pat/subform/subform.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ export default Base.extend({
3232
},
3333

3434
scopedSubmit($el) {
35-
var $form = $el.parents("form"),
36-
$exclude = $form.find(":input").filter(function () {
37-
return !$(this).is($el.find("*"));
38-
});
35+
const $form = $el.parents("form");
36+
const $exclude = $form.find(":input").filter(function () {
37+
return !$(this).is($el.find("*"));
38+
});
3939
// make other controls "unsuccessful"
4040
log.debug("Hiding unwanted elements from submission.");
41-
var names = $exclude.map(function () {
42-
var name = $(this).attr("name");
41+
const names = $exclude.map(function () {
42+
const name = $(this).attr("name");
4343
return name ? name : 0;
4444
});
4545
$exclude.each(function () {
@@ -63,8 +63,8 @@ export default Base.extend({
6363

6464
submit(ev) {
6565
ev.stopPropagation();
66-
var $this = $(ev.target),
67-
$button = $this.find("button[type=submit][formaction]").first();
66+
const $this = $(ev.target);
67+
const $button = $this.find("button[type=submit][formaction]").first();
6868
if ($button.length) {
6969
$button.trigger("click");
7070
} else {
@@ -78,7 +78,7 @@ export default Base.extend({
7878
if (ev.keyCode != 13) {
7979
return;
8080
}
81-
var $subform = $(ev.target).parents(".pat-subform");
81+
const $subform = $(ev.target).parents(".pat-subform");
8282
if (!$subform.is(".pat-autosubmit")) {
8383
return;
8484
}
@@ -90,14 +90,14 @@ export default Base.extend({
9090
ev.stopPropagation();
9191
ajax.onClickSubmit(ev); // make sure the submitting button is sent with the form
9292

93-
var $button = $(ev.target),
94-
$sub = $button.parents(".pat-subform").first(),
95-
formaction = $button.attr("formaction");
93+
const $button = $(ev.target);
94+
const $sub = $button.parents(".pat-subform").first();
95+
const formaction = $button.attr("formaction");
9696

9797
if (formaction) {
9898
// override the default action and restore afterwards
9999
if ($sub.is(".pat-inject")) {
100-
var previousValue = $sub.data("pat-inject");
100+
const previousValue = $sub.data("pat-inject");
101101
$sub.data("pat-inject", inject.extractConfig($sub, { url: formaction }));
102102
this.scopedSubmit($sub);
103103
$sub.data("pat-inject", previousValue);

0 commit comments

Comments
 (0)