rytm-webflow 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rytm-webflow",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "rytm webflow pack - ASwap, ShowUp",
5
5
  "main": "scripts/index.js",
6
6
  "scripts": {
@@ -384,7 +384,7 @@ class ASwapDispatcher extends EventDispatcher {
384
384
  isFormElementValid(f) {
385
385
  let result = false
386
386
  if (f) {
387
- if (!f.classList.contains(this.noSwapClassName)) {
387
+ if (f.matches(this.formsSelector) && !f.classList.contains(this.noSwapClassName)) {
388
388
  result = true
389
389
  }
390
390
  }
@@ -424,25 +424,23 @@ class ASwapDispatcher extends EventDispatcher {
424
424
  }
425
425
  }
426
426
  onDocumentSubmit(e) {
427
- e.preventDefault();
428
- if (e.target.tagName !== 'FORM') {
429
- return;
430
- }
431
- const f = e.target
432
- if (this.isFormElementValid(f)) {
433
- const useCache = !f.classList.contains(this.noCacheClassName);
434
- const url = f.getAttribute("action");
435
- if (url.indexOf('://') < 0) {
436
- e.preventDefault()
437
- this.currentTrigger = f
438
- const method = f.getAttribute('method') ? f.getAttribute('method') : 'get'
439
- const dataStr = new URLSearchParams(new FormData(f)).toString()
440
- const requestUrl = method == 'get' ? (url + '?' + dataStr) : url
441
- this.submit(requestUrl, dataStr, method, false, useCache)
442
- }
427
+ if (e.target.tagName == 'FORM') {
428
+ const f = e.target
429
+ if (this.isFormElementValid(f)) {
430
+ e.preventDefault();
431
+ const useCache = !f.classList.contains(this.noCacheClassName);
432
+ const url = f.getAttribute("action");
433
+ if (url.indexOf('://') < 0) {
434
+ e.preventDefault()
435
+ this.currentTrigger = f
436
+ const method = f.getAttribute('method') ? f.getAttribute('method') : 'get'
437
+ const dataStr = new URLSearchParams(new FormData(f)).toString()
438
+ const requestUrl = method == 'get' ? (url + '?' + dataStr) : url
439
+ this.submit(requestUrl, dataStr, method, false, useCache)
440
+ }
443
441
 
442
+ }
444
443
  }
445
-
446
444
  }
447
445
  /**
448
446
  * add event listeners