jsf.js_next_gen 4.0.0-RC.10 → 4.0.0-RC.11

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.
@@ -1082,7 +1082,40 @@ class DomQuery {
1082
1082
  return new DomQuery(func());
1083
1083
  }
1084
1084
  }
1085
- parents(selector) {
1085
+ /**
1086
+ * find all parents in the hierarchy for which the selector matches
1087
+ * @param selector
1088
+ */
1089
+ allParents(selector) {
1090
+ let parent = this.parent();
1091
+ let ret = [];
1092
+ while (parent.isPresent()) {
1093
+ if (parent.matchesSelector(selector)) {
1094
+ ret.push(parent);
1095
+ }
1096
+ parent = parent.parent();
1097
+ }
1098
+ return new DomQuery(...ret);
1099
+ }
1100
+ /**
1101
+ * finds the first parent in the hierarchy for which the selector matches
1102
+ * @param selector
1103
+ */
1104
+ firstParent(selector) {
1105
+ let parent = this.parent();
1106
+ while (parent.isPresent()) {
1107
+ if (parent.matchesSelector(selector)) {
1108
+ return parent;
1109
+ }
1110
+ parent = parent.parent();
1111
+ }
1112
+ return DomQuery.absent;
1113
+ }
1114
+ /**
1115
+ * fetches all parents as long as the filter criterium matches
1116
+ * @param selector
1117
+ */
1118
+ parentsWhileMatch(selector) {
1086
1119
  const retArr = [];
1087
1120
  let parent = this.parent().filter(item => item.matchesSelector(selector));
1088
1121
  while (parent.isPresent()) {
@@ -1094,7 +1127,7 @@ class DomQuery {
1094
1127
  parent() {
1095
1128
  let ret = [];
1096
1129
  this.eachElem((item) => {
1097
- let parent = item.parentNode || item.host;
1130
+ let parent = item.parentNode || item.host || item.shadowRoot;
1098
1131
  if (parent && ret.indexOf(parent) == -1) {
1099
1132
  ret.push(parent);
1100
1133
  }
@@ -6002,7 +6035,7 @@ var ExtLang;
6002
6035
  */
6003
6036
  function getForm(elem, event) {
6004
6037
  let queryElem = new mona_dish_1.DQ(elem);
6005
- let eventTarget = new mona_dish_1.DQ((0, RequestDataResolver_1.getEventTarget)(event));
6038
+ let eventTarget = (event) ? new mona_dish_1.DQ((0, RequestDataResolver_1.getEventTarget)(event)) : mona_dish_1.DomQuery.absent;
6006
6039
  if (queryElem.isTag(Const_1.TAG_FORM)) {
6007
6040
  return queryElem;
6008
6041
  }
@@ -6014,9 +6047,9 @@ var ExtLang;
6014
6047
  return foundForm;
6015
6048
  }
6016
6049
  }
6017
- let form = queryElem.parents(Const_1.TAG_FORM)
6050
+ let form = queryElem.firstParent(Const_1.TAG_FORM)
6018
6051
  .orElseLazy(() => queryElem.byTagName(Const_1.TAG_FORM, true))
6019
- .orElseLazy(() => eventTarget.parents(Const_1.TAG_FORM))
6052
+ .orElseLazy(() => eventTarget.firstParent(Const_1.TAG_FORM))
6020
6053
  .orElseLazy(() => eventTarget.byTagName(Const_1.TAG_FORM))
6021
6054
  .first();
6022
6055
  assertFormExists(form);
@@ -6455,7 +6488,7 @@ exports.resolveSourceElement = resolveSourceElement;
6455
6488
  function resolveSourceForm(internalContext, elem) {
6456
6489
  let sourceFormId = internalContext.getIf(Const_1.CTX_PARAM_SRC_FRM_ID);
6457
6490
  let sourceForm = new mona_dish_2.DQ(sourceFormId.isPresent() ? document.forms[sourceFormId.value] : null);
6458
- sourceForm = sourceForm.orElseLazy(() => elem.parents(Const_1.TAG_FORM))
6491
+ sourceForm = sourceForm.orElseLazy(() => elem.firstParent(Const_1.TAG_FORM))
6459
6492
  .orElseLazy(() => elem.querySelectorAll(Const_1.TAG_FORM))
6460
6493
  .orElseLazy(() => mona_dish_2.DQ.querySelectorAll(Const_1.TAG_FORM));
6461
6494
  return sourceForm;
@@ -6810,7 +6843,7 @@ class ResponseProcessor {
6810
6843
  */
6811
6844
  update(node, cdataBlock) {
6812
6845
  let result = ExtDomQuery_1.ExtDomQuery.byId(node.id.value, true).outerHTML(cdataBlock, false, false);
6813
- let sourceForm = result === null || result === void 0 ? void 0 : result.parents(Const_1.TAG_FORM).orElseLazy(() => result.byTagName(Const_1.TAG_FORM, true));
6846
+ let sourceForm = result === null || result === void 0 ? void 0 : result.firstParent(Const_1.TAG_FORM).orElseLazy(() => result.byTagName(Const_1.TAG_FORM, true));
6814
6847
  if (sourceForm) {
6815
6848
  this.storeForPostProcessing(sourceForm, result);
6816
6849
  }
@@ -7094,7 +7127,7 @@ class ResponseProcessor {
7094
7127
  //either the form directly is in execute or render or one of its children or one of its parents
7095
7128
  return affectedForm.matchesSelector(nameOrIdSelector) ||
7096
7129
  affectedForm.querySelectorAll(nameOrIdSelector).isPresent() ||
7097
- affectedForm.parents(nameOrIdSelector).isPresent();
7130
+ affectedForm.firstParent(nameOrIdSelector).isPresent();
7098
7131
  }).first().isPresent();
7099
7132
  }
7100
7133
  /**
Binary file
Binary file