jsf.js_next_gen 4.0.3-beta.3 → 4.0.3-beta.5

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.
@@ -1945,7 +1945,7 @@ class DomQuery {
1945
1945
  // script execution order by relative pos in their dom tree
1946
1946
  scriptElements.asArray
1947
1947
  .flatMap(item => [...item.values])
1948
- .sort((node1, node2) => node1.compareDocumentPosition(node2) - 3) // preceding 2, following == 4)
1948
+ .sort((node1, node2) => node2.compareDocumentPosition(node1) - 3) // preceding 2, following == 4)
1949
1949
  .forEach(item => execScript(item));
1950
1950
  evalCollectedScripts(finalScripts);
1951
1951
  }
@@ -6508,12 +6508,18 @@ var ExtLang;
6508
6508
  return foundForm;
6509
6509
  }
6510
6510
  }
6511
+ //no direct form is found we look for parent/child relationships as fallback
6512
+ //(90% case)
6511
6513
  let form = queryElem.firstParent(Const_1.HTML_TAG_FORM)
6512
6514
  .orElseLazy(() => queryElem.byTagName(Const_1.HTML_TAG_FORM, true))
6513
6515
  .orElseLazy(() => eventTarget.firstParent(Const_1.HTML_TAG_FORM))
6514
6516
  .orElseLazy(() => eventTarget.byTagName(Const_1.HTML_TAG_FORM))
6515
6517
  .first();
6516
- assertFormExists(form);
6518
+ //either a form is found within parent child - nearest form (aka first)
6519
+ //or we look for a single form
6520
+ form = form.orElseLazy(() => mona_dish_1.DQ.byTagName(Const_1.HTML_TAG_FORM));
6521
+ //the end result must be a found form otherwise - Exception
6522
+ assertOnlyOneFormExists(form);
6517
6523
  return form;
6518
6524
  }
6519
6525
  ExtLang.getForm = getForm;
@@ -6586,12 +6592,12 @@ var ExtLang;
6586
6592
  }
6587
6593
  ExtLang.debounce = debounce;
6588
6594
  /**
6589
- * assert that the form exists and throw an exception in the case it does not
6595
+ * assert that the form exists and only one form exists and throw an exception in the case it does not
6590
6596
  *
6591
- * @param form the form to check for
6597
+ * @param forms the form to check for
6592
6598
  */
6593
- function assertFormExists(form) {
6594
- if (form.isAbsent()) {
6599
+ function assertOnlyOneFormExists(forms) {
6600
+ if (forms.isAbsent() || forms.length > 1) {
6595
6601
  throw makeException(new Error(), null, null, "Impl", "getForm", getMessage("ERR_FORM"));
6596
6602
  }
6597
6603
  }