Skip to content

Commit 27fb575

Browse files
committed
fix(core registry): Always put pat-validation first in the pattern execution chain.
1 parent b01819a commit 27fb575

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/core/registry.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,10 @@ const registry = {
128128
},
129129

130130
orderPatterns(patterns) {
131-
// XXX: Bit of a hack. We need the validation pattern to be
132-
// parsed and initiated before the inject pattern. So we make
133-
// sure here, that it appears first. Not sure what would be
134-
// the best solution. Perhaps some kind of way to register
135-
// patterns "before" or "after" other patterns.
136-
if (patterns.includes("validation") && patterns.includes("inject")) {
131+
// Always add pat-validation as first pattern, so that it can prevent
132+
// other patterns from reacting to submit events if form validation
133+
// fails.
134+
if (patterns.includes("validation")) {
137135
patterns.splice(patterns.indexOf("validation"), 1);
138136
patterns.unshift("validation");
139137
}

0 commit comments

Comments
 (0)