@glitchr/transparent 1.0.46 → 1.0.48

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/README.md CHANGED
@@ -1,2 +1 @@
1
1
  # TransparentJS
2
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glitchr/transparent",
3
- "version": "1.0.46",
3
+ "version": "1.0.48",
4
4
  "description": "Transparent SPA Application",
5
5
  "main": "src/index.js",
6
6
  "access": "public",
@@ -1453,20 +1453,25 @@
1453
1453
  if (form) {
1454
1454
 
1455
1455
  data = new FormData();
1456
- var formInput = $("form[name='"+form.name+"'] :input, [name^='"+form.name+"\[']");
1457
- formInput.each(function() {
1456
+ var formAmbiguity = $("form[name='"+form.name+"']").length > 1;
1457
+
1458
+ var formInput = undefined; // In case of form ambiguity (two form with same name, restrict the data to the target form, if not extends it to each element with standard name)
1459
+ if(formAmbiguity) formInput = $(form).find(":input, [name^='"+form.name+"\[']");
1460
+ else $("form[name='"+form.name+"'] :input, [name^='"+form.name+"\[']");
1461
+
1462
+ formInput.each(function() {
1458
1463
 
1459
- if(this.tagName == "BUTTON") {
1464
+ if(this.tagName == "BUTTON") {
1460
1465
 
1461
- if(this == e.target) data.append(this.name, this.value);
1466
+ if(this == e.target) data.append(this.name, this.value);
1462
1467
 
1463
- } else if(this.type == "file") {
1468
+ } else if(this.type == "file") {
1464
1469
 
1465
- for(var i = 0; i < this.files.length; i++)
1466
- data.append(this.name, this.files[i]);
1470
+ for(var i = 0; i < this.files.length; i++)
1471
+ data.append(this.name, this.files[i]);
1467
1472
 
1468
- } else data.append(this.name, this.value);
1469
- });
1473
+ } else data.append(this.name, this.value);
1474
+ });
1470
1475
 
1471
1476
  // Force page reload
1472
1477
  formSubmission = true; // mark as form submission