jsf.js_next_gen 4.0.0-beta-23 → 4.0.1-alpha.0

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.
Files changed (214) hide show
  1. package/.nyc_output/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
  2. package/.nyc_output/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
  3. package/.nyc_output/processinfo/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
  4. package/.nyc_output/processinfo/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
  5. package/.nyc_output/processinfo/index.json +1 -1
  6. package/README.md +13 -21
  7. package/dist/docs/assets/main.js +56 -52
  8. package/dist/docs/assets/search.js +1 -1
  9. package/dist/docs/assets/style.css +23 -0
  10. package/dist/docs/functions/faces.ajax.addOnError.html +2 -0
  11. package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -0
  12. package/dist/docs/functions/faces.push.close.html +4 -2
  13. package/dist/docs/functions/faces.push.init.html +19 -7
  14. package/dist/docs/functions/faces.push.open.html +4 -2
  15. package/dist/docs/functions/myfaces.ab.html +9 -4
  16. package/dist/docs/functions/myfaces.onDomReady.html +72 -0
  17. package/dist/docs/index.html +16 -18
  18. package/dist/docs/modules/myfaces.html +3 -1
  19. package/dist/docs/variables/myfaces.oam.html +2 -1
  20. package/dist/window/faces-development.js +2846 -2085
  21. package/dist/window/faces-development.js.br +0 -0
  22. package/dist/window/faces-development.js.gz +0 -0
  23. package/dist/window/faces-development.js.map +1 -1
  24. package/dist/window/faces.js +1 -1
  25. package/dist/window/faces.js.LICENSE.txt +17 -2
  26. package/dist/window/faces.js.br +0 -0
  27. package/dist/window/faces.js.gz +0 -0
  28. package/dist/window/faces.js.map +1 -1
  29. package/dist/window/jsf-development.js +2856 -2084
  30. package/dist/window/jsf-development.js.br +0 -0
  31. package/dist/window/jsf-development.js.gz +0 -0
  32. package/dist/window/jsf-development.js.map +1 -1
  33. package/dist/window/jsf.js +1 -1
  34. package/dist/window/jsf.js.LICENSE.txt +17 -2
  35. package/dist/window/jsf.js.br +0 -0
  36. package/dist/window/jsf.js.gz +0 -0
  37. package/dist/window/jsf.js.map +1 -1
  38. package/package.json +19 -18
  39. package/plans for 4.0.1.txt +8 -0
  40. package/src/main/test.xml +23 -0
  41. package/src/main/typescript/@types/definitions/index.d.ts +19 -2
  42. package/src/main/typescript/api/_api.ts +68 -25
  43. package/src/main/typescript/api/jsf.ts +18 -0
  44. package/src/main/typescript/impl/AjaxImpl.ts +204 -100
  45. package/src/main/typescript/impl/PushImpl.ts +63 -38
  46. package/src/main/typescript/impl/core/Const.ts +56 -40
  47. package/src/main/typescript/impl/util/Assertions.ts +16 -8
  48. package/src/main/typescript/impl/util/AsyncRunnable.ts +85 -10
  49. package/src/main/typescript/impl/util/ExtDomQuery.ts +65 -54
  50. package/src/main/typescript/impl/util/FileUtils.ts +108 -0
  51. package/src/main/typescript/impl/util/HiddenInputBuilder.ts +93 -0
  52. package/src/main/typescript/impl/util/Lang.ts +91 -35
  53. package/src/main/typescript/impl/util/XhrQueueController.ts +112 -0
  54. package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -10
  55. package/src/main/typescript/impl/xhrCore/EventData.ts +3 -3
  56. package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +25 -11
  57. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +78 -32
  58. package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +10 -10
  59. package/src/main/typescript/impl/xhrCore/Response.ts +66 -49
  60. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +211 -138
  61. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +92 -166
  62. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +111 -120
  63. package/src/main/typescript/myfaces/OamSubmit.ts +30 -14
  64. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +163 -27
  65. package/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.ts +4 -4
  66. package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/blank.css +0 -0
  67. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +921 -0
  68. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +108 -0
  69. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +111 -3
  70. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
  71. package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/jakarta.faces.resource/faces.js.jsf +0 -0
  72. package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -3
  73. package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -7
  74. package/src/main/typescript/test/myfaces/OnLoadSpec.ts +52 -0
  75. package/src/main/typescript/test/queue/AsynchronousProbe.ts +5 -5
  76. package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +4 -3
  77. package/src/main/typescript/test/xhrCore/EventTests.spec.ts +28 -22
  78. package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +5 -2
  79. package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +203 -0
  80. package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +177 -0
  81. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +158 -17
  82. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +320 -15
  83. package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +45 -4
  84. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +374 -35
  85. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +43 -9
  86. package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +109 -0
  87. package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +67 -49
  88. package/src/main/typescript/test.xml +6 -0
  89. package/src/main/typescript/tsconfig.json +1 -1
  90. package/src/test/resources/jsf-development.js +1 -1
  91. package/src/tmp/test.html +12 -88
  92. package/target/api/_api.js +63 -21
  93. package/target/api/_api.js.map +1 -1
  94. package/target/api/jsf.js +11 -0
  95. package/target/api/jsf.js.map +1 -1
  96. package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
  97. package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
  98. package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
  99. package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
  100. package/target/impl/AjaxImpl.js +177 -81
  101. package/target/impl/AjaxImpl.js.map +1 -1
  102. package/target/impl/PushImpl.js +66 -35
  103. package/target/impl/PushImpl.js.map +1 -1
  104. package/target/impl/core/Const.js +54 -39
  105. package/target/impl/core/Const.js.map +1 -1
  106. package/target/impl/core/Context.js +10 -0
  107. package/target/impl/core/Context.js.map +1 -0
  108. package/target/impl/util/Assertions.js +12 -7
  109. package/target/impl/util/Assertions.js.map +1 -1
  110. package/target/impl/util/AsyncQueue.js.map +1 -1
  111. package/target/impl/util/AsyncRunnable.js +60 -0
  112. package/target/impl/util/AsyncRunnable.js.map +1 -1
  113. package/target/impl/util/ExtDomQuery.js +66 -48
  114. package/target/impl/util/ExtDomQuery.js.map +1 -1
  115. package/target/impl/util/FileUtils.js +97 -0
  116. package/target/impl/util/FileUtils.js.map +1 -0
  117. package/target/impl/util/HiddenElementBuilder.js +7 -0
  118. package/target/impl/util/HiddenElementBuilder.js.map +1 -0
  119. package/target/impl/util/HiddenInputBuilder.js +83 -0
  120. package/target/impl/util/HiddenInputBuilder.js.map +1 -0
  121. package/target/{types/index.js → impl/util/IAsyncRunnable.js} +11 -2
  122. package/target/impl/util/IAsyncRunnable.js.map +1 -0
  123. package/target/impl/util/Lang.js +81 -31
  124. package/target/impl/util/Lang.js.map +1 -1
  125. package/target/impl/util/URLCodec.js +77 -0
  126. package/target/impl/util/URLCodec.js.map +1 -0
  127. package/target/impl/util/XhrQueueController.js +107 -0
  128. package/target/impl/util/XhrQueueController.js.map +1 -0
  129. package/target/impl/xhrCore/ErrorData.js +10 -8
  130. package/target/impl/xhrCore/ErrorData.js.map +1 -1
  131. package/target/impl/xhrCore/EventData.js +2 -2
  132. package/target/impl/xhrCore/EventData.js.map +1 -1
  133. package/target/impl/xhrCore/RequestContext.js +11 -0
  134. package/target/impl/xhrCore/RequestContext.js.map +1 -0
  135. package/target/impl/xhrCore/RequestDataResolver.js +70 -23
  136. package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
  137. package/target/impl/xhrCore/ResonseDataResolver.js +9 -9
  138. package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
  139. package/target/impl/xhrCore/Response.js +44 -29
  140. package/target/impl/xhrCore/Response.js.map +1 -1
  141. package/target/impl/xhrCore/ResponseProcessor.js +187 -119
  142. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  143. package/target/impl/xhrCore/XhrFormData.js +82 -156
  144. package/target/impl/xhrCore/XhrFormData.js.map +1 -1
  145. package/target/impl/xhrCore/XhrQueHandler.js +11 -0
  146. package/target/impl/xhrCore/XhrQueHandler.js.map +1 -0
  147. package/target/impl/xhrCore/XhrQueueController.js +62 -0
  148. package/target/impl/xhrCore/XhrQueueController.js.map +1 -0
  149. package/target/impl/xhrCore/XhrRequest.js +94 -106
  150. package/target/impl/xhrCore/XhrRequest.js.map +1 -1
  151. package/target/myfaces/OamSubmit.js +25 -14
  152. package/target/myfaces/OamSubmit.js.map +1 -1
  153. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +124 -23
  154. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  155. package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js +76 -0
  156. package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js.map +1 -0
  157. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +4 -4
  158. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
  159. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +925 -0
  160. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +1 -0
  161. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +112 -0
  162. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +1 -0
  163. package/target/test/frameworkBase/_ext/shared/StandardInits.js +103 -3
  164. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  165. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +37 -1
  166. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  167. package/target/test/impl/ImplTest.spec.js +2 -2
  168. package/target/test/impl/ImplTest.spec.js.map +1 -1
  169. package/target/test/impl/ImplTest_23.spec.js +2 -2
  170. package/target/test/impl/ImplTest_23.spec.js.map +1 -1
  171. package/target/test/myfaces/OnLoadSpec.js +57 -0
  172. package/target/test/myfaces/OnLoadSpec.js.map +1 -0
  173. package/target/test/queue/AsynchronousQueueTest.spec.js +3 -3
  174. package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
  175. package/target/test/xhrCore/EventTests.spec.js +26 -19
  176. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  177. package/target/test/xhrCore/FileUploadTest.spec.js +2 -1
  178. package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
  179. package/target/test/xhrCore/NamespacesRequestTest.spec.js +204 -0
  180. package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
  181. package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
  182. package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
  183. package/target/test/xhrCore/RequestParamsTest.spec.js +142 -10
  184. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  185. package/target/test/xhrCore/RequestTest.spec.js +288 -11
  186. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  187. package/target/test/xhrCore/RequestTest_23.spec.js +40 -2
  188. package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
  189. package/target/test/xhrCore/ResponseTest.spec.js +315 -24
  190. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  191. package/target/test/xhrCore/ResponseTest23.spec.js +38 -8
  192. package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
  193. package/target/test/xhrCore/TobagoFileUploadTest.spec.js +128 -0
  194. package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -0
  195. package/target/test/xhrCore/XhrFormDataTest.spec.js +57 -34
  196. package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
  197. package/target/test-classes/.gz +0 -0
  198. package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
  199. package/target/test-classes/fileuploadtest.html +24 -0
  200. package/target/test-classes/jsf-development.js +3559 -0
  201. package/target/test-classes/jsf-development.js.br +0 -0
  202. package/target/test-classes/jsf-development.js.gz +0 -0
  203. package/target/test-classes/jsf-development.js.map +1 -0
  204. package/target/test-classes/jsf.js +3 -0
  205. package/target/test-classes/jsf.js.br +0 -0
  206. package/target/test-classes/jsf.js.gz +0 -0
  207. package/tmp.xml +36 -0
  208. package/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
  209. package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
  210. package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
  211. package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
  212. package/src/main/typescript/impl/util/AsyncQueue.ts +0 -133
  213. package/src/main/typescript/test/frameworkBase/_ext/monadish/StreamTest.spec.ts +0 -231
  214. package/target/types/index.js.map +0 -1
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import {Config, DomQuery, DQ, Lang, Stream, XMLQuery} from "mona-dish";
17
+ import {Config, DomQuery, DomQueryCollector, DQ, DQ$, Lang, XMLQuery} from "mona-dish";
18
18
  import {Implementation} from "../AjaxImpl";
19
19
  import {Assertions} from "../util/Assertions";
20
20
  import {IResponseProcessor} from "./IResponseProcessor";
@@ -23,6 +23,7 @@ import {StateHolder} from "../core/ImplTypes";
23
23
  import {EventData} from "./EventData";
24
24
 
25
25
  import {
26
+ $faces,
26
27
  $nsp,
27
28
  APPLIED_CLIENT_WINDOW,
28
29
  APPLIED_VST,
@@ -30,32 +31,42 @@ import {
30
31
  ATTR_NAME,
31
32
  ATTR_URL,
32
33
  ATTR_VALUE,
34
+ DEFERRED_HEAD_INSERTS,
33
35
  EMPTY_FUNC,
34
36
  EMPTY_STR,
35
37
  ERROR_MESSAGE,
36
38
  ERROR_NAME,
37
- HTML_VIEWSTATE,
39
+ HTML_TAG_BODY,
40
+ HTML_TAG_FORM,
41
+ HTML_TAG_HEAD,
42
+ HTML_TAG_LINK,
43
+ HTML_TAG_SCRIPT,
44
+ HTML_TAG_STYLE, IDENT_ALL, IDENT_NONE, NAMED_VIEWROOT,
38
45
  ON_ERROR,
39
- ON_EVENT, P_CLIENT_WINDOW,
40
- P_PARTIAL_SOURCE,
46
+ ON_EVENT,
47
+ P_CLIENT_WINDOW,
48
+ P_EXECUTE,
49
+ P_AJAX_SOURCE,
50
+ P_RENDER,
51
+ P_RENDER_OVERRIDE,
41
52
  P_VIEWSTATE,
42
- RESPONSE_XML, SEL_CLIENT_WINDOW_ELEM,
43
- SEL_SCRIPTS_STYLES,
53
+ NAMING_CONTAINER_ID,
54
+ RESPONSE_XML,
55
+ SEL_CLIENT_WINDOW_ELEM,
44
56
  SEL_VIEWSTATE_ELEM,
45
57
  SOURCE,
46
58
  SUCCESS,
47
- TAG_AFTER,
48
- TAG_ATTR,
49
- TAG_BEFORE,
50
- TAG_BODY,
51
- TAG_FORM,
52
- TAG_HEAD,
53
59
  UPDATE_ELEMS,
54
60
  UPDATE_FORMS,
55
- DEFERRED_HEAD_INSERTS
61
+ XML_TAG_AFTER,
62
+ XML_TAG_ATTR,
63
+ XML_TAG_BEFORE
56
64
  } from "../core/Const";
65
+ import {ExtConfig, ExtDomQuery} from "../util/ExtDomQuery";
66
+ import {HiddenInputBuilder} from "../util/HiddenInputBuilder";
57
67
  import trim = Lang.trim;
58
- import {ExtConfig, ExtDomquery} from "../util/ExtDomQuery";
68
+ import {ExtLang} from "../util/Lang";
69
+ import ofAssoc = ExtLang.ofAssoc;
59
70
 
60
71
 
61
72
  /**
@@ -82,31 +93,38 @@ export class ResponseProcessor implements IResponseProcessor {
82
93
  * the data incoming must represent the html representation of the head itself one way or the other
83
94
  */
84
95
  replaceHead(shadowDocument: XMLQuery | DQ) {
85
- let shadowHead = shadowDocument.querySelectorAll(TAG_HEAD);
96
+ const shadowHead = shadowDocument.querySelectorAll(HTML_TAG_HEAD);
86
97
  if (!shadowHead.isPresent()) {
87
98
  return;
88
99
  }
100
+ const head = ExtDomQuery.querySelectorAll(HTML_TAG_HEAD);
101
+ // full replace we delete everything
102
+ head.childNodes.delete();
103
+ this.addToHead(shadowHead);
104
+ //we copy the attributes as well (just in case myfaces introduces the id in head)
105
+ head.copyAttrs(shadowHead);
106
+ }
89
107
 
90
- let oldHead = ExtDomquery.querySelectorAll(TAG_HEAD);
108
+ addToHead(shadowHead: XMLQuery | DQ) {
109
+ const mappedHeadData = new ExtDomQuery(shadowHead);
110
+ const scriptTags = [HTML_TAG_SCRIPT];
111
+ const nonExecutables = mappedHeadData.filter(item => scriptTags.indexOf(item.tagName.orElse("").value) == -1);
112
+ nonExecutables.runHeadInserts(true);
91
113
 
92
- //delete all to avoid script and style overlays
93
- oldHead.querySelectorAll(SEL_SCRIPTS_STYLES).delete();
114
+ //incoming either the outer head tag or its children
115
+ const nodesToAdd = (shadowHead.tagName.value === "HEAD") ? shadowHead.childNodes : shadowHead;
116
+ // this is stored for "post" processing
117
+ // after the rest of the "physical build up", head before body
118
+ const scriptElements = nodesToAdd.stream
119
+ .filter(item => scriptTags.indexOf(item.tagName.orElse("").value) != -1).collect(new DomQueryCollector());
94
120
 
95
- // we cannot replace new elements in the head, but we can eval the elements
96
- // eval means the scripts will get attached (eval script attach method)
97
- // but this is done by DomQuery not in this code
98
- this.storeForEval(shadowHead);
99
- //incoming either the outer head tag or its childs
100
- //shadowHead = (shadowHead.tagName.value === "HEAD") ? shadowHead.childNodes : shadowHead;
101
- //this.addToHead(shadowHead);
121
+ this.addToHeadDeferred(scriptElements);
102
122
  }
103
123
 
104
- addToHead(newElements: XMLQuery | DQ) {
124
+ addToHeadDeferred(newElements: XMLQuery | DQ) {
105
125
  this.internalContext.assign(DEFERRED_HEAD_INSERTS).value.push(newElements);
106
126
  }
107
127
 
108
-
109
-
110
128
  /**
111
129
  * replaces the body in the expected manner
112
130
  * which means the entire body content is refreshed
@@ -117,30 +135,30 @@ export class ResponseProcessor implements IResponseProcessor {
117
135
  */
118
136
  replaceBody(shadowDocument: XMLQuery | DQ) {
119
137
 
120
- let shadowBody = shadowDocument.querySelectorAll(TAG_BODY);
138
+ const shadowBody = shadowDocument.querySelectorAll(HTML_TAG_BODY);
121
139
  if (!shadowBody.isPresent()) {
122
140
  return;
123
141
  }
124
142
 
125
- let shadowInnerHTML: string = <string>shadowBody.html().value;
126
-
127
- let resultingBody = <DQ>ExtDomquery.querySelectorAll(TAG_BODY).html(shadowInnerHTML);
128
- let updateForms = resultingBody.querySelectorAll(TAG_FORM);
143
+ const shadowInnerHTML: string = <string>shadowBody.innerHTML;
144
+ const resultingBody = <DQ>ExtDomQuery.querySelectorAll(HTML_TAG_BODY);
145
+ const updateForms = resultingBody.querySelectorAll(HTML_TAG_FORM);
129
146
 
130
147
  // main difference, we cannot replace the body itself, but only its content
131
- // we need a separate step for post processing the incoming attributes, like classes, styles etc...
132
- resultingBody.copyAttrs(shadowBody);
133
-
148
+ // we need a separate step for post-processing the incoming
149
+ // attributes, like classes, styles etc...
150
+ (resultingBody.html(shadowInnerHTML) as DQ).copyAttrs(shadowBody);
151
+ this.externalContext.assign($nsp(P_RENDER_OVERRIDE)).value = "@all";
134
152
  this.storeForPostProcessing(updateForms, resultingBody);
135
153
  }
136
154
 
137
155
  /**
138
- * Leaf Tag eval... process whatever is in the evals cdata block
156
+ * Leaf Tag eval... process whatever is in the eval cdata block
139
157
  *
140
158
  * @param node the node to eval
141
159
  */
142
160
  eval(node: XMLQuery) {
143
- ExtDomquery.globalEval(node.cDATAAsString);
161
+ ExtDomQuery.globalEval(node.cDATAAsString);
144
162
  }
145
163
 
146
164
  /**
@@ -157,22 +175,22 @@ export class ResponseProcessor implements IResponseProcessor {
157
175
  * <error>
158
176
  */
159
177
 
160
- let mergedErrorData = new ExtConfig({});
161
- mergedErrorData.assign(SOURCE).value = this.externalContext.getIf(P_PARTIAL_SOURCE).get(0).value;
178
+ const mergedErrorData = new ExtConfig({});
179
+ mergedErrorData.assign(SOURCE).value = this.externalContext.getIf(P_AJAX_SOURCE).get(0).value;
162
180
  mergedErrorData.assign(ERROR_NAME).value = node.querySelectorAll(ERROR_NAME).textContent(EMPTY_STR);
163
181
  mergedErrorData.assign(ERROR_MESSAGE).value = node.querySelectorAll(ERROR_MESSAGE).cDATAAsString;
164
182
 
165
- let hasResponseXML = this.internalContext.get(RESPONSE_XML).isPresent();
183
+ const hasResponseXML = this.internalContext.get(RESPONSE_XML).isPresent();
166
184
 
167
185
  //we now store the response xml also in the error data for further details
168
186
  mergedErrorData.assignIf(hasResponseXML, RESPONSE_XML).value = this.internalContext.getIf(RESPONSE_XML).value.get(0).value;
169
187
 
170
- // error post processing and enrichment (standard messages from keys)
171
- let errorData = ErrorData.fromServerError(mergedErrorData);
188
+ // error post-processing and enrichment (standard messages from keys)
189
+ const errorData = ErrorData.fromServerError(mergedErrorData);
172
190
 
173
- // we now trigger an internally stored onError function which might be a attached to the context
174
- // either we haven an internal on error, or an on error has been bassed via params from the outside
175
- // in both cases they are attached to our contexts
191
+ // we now trigger an internally stored onError function which might be an attached to the context
192
+ // either we do not have an internal on error, or an on error has been based via params from the outside.
193
+ // In both cases they are attached to our contexts
176
194
 
177
195
  this.triggerOnError(errorData);
178
196
  Implementation.sendError(errorData);
@@ -186,7 +204,7 @@ export class ResponseProcessor implements IResponseProcessor {
186
204
  redirect(node: XMLQuery) {
187
205
  Assertions.assertUrlExists(node);
188
206
 
189
- let redirectUrl = trim(node.attr(ATTR_URL).value);
207
+ const redirectUrl = trim(node.attr(ATTR_URL).value);
190
208
  if (redirectUrl != EMPTY_STR) {
191
209
  window.location.href = redirectUrl;
192
210
  }
@@ -198,15 +216,15 @@ export class ResponseProcessor implements IResponseProcessor {
198
216
  * @param cdataBlock the cdata block with the new html code
199
217
  */
200
218
  update(node: XMLQuery, cdataBlock: string) {
201
- let result = ExtDomquery.byId(node.id.value, true).outerHTML(cdataBlock, false, false);
202
- let sourceForm = result?.parents(TAG_FORM).orElseLazy(() => result.byTagName(TAG_FORM, true));
219
+ const result = ExtDomQuery.byId(node.id.value, true).outerHTML(cdataBlock, false, false);
220
+ const sourceForm = result?.firstParent(HTML_TAG_FORM).orElseLazy(() => result.byTagName(HTML_TAG_FORM, true));
203
221
  if (sourceForm) {
204
222
  this.storeForPostProcessing(sourceForm, result);
205
223
  }
206
224
  }
207
225
 
208
226
  /**
209
- * Delete handler, simply deleetes the node referenced by the xml data
227
+ * Delete handler, simply deletes the node referenced by the xml data
210
228
  * @param node
211
229
  */
212
230
  delete(node: XMLQuery) {
@@ -219,9 +237,9 @@ export class ResponseProcessor implements IResponseProcessor {
219
237
  * @param node
220
238
  */
221
239
  attributes(node: XMLQuery) {
222
- let elem = DQ.byId(node.id.value, true);
240
+ const elem = DQ.byId(node.id.value, true);
223
241
 
224
- node.byTagName(TAG_ATTR).each((item: XMLQuery) => {
242
+ node.byTagName(XML_TAG_ATTR).each((item: XMLQuery) => {
225
243
  elem.attr(item.attr(ATTR_NAME).value).value = item.attr(ATTR_VALUE).value;
226
244
  });
227
245
  }
@@ -242,17 +260,16 @@ export class ResponseProcessor implements IResponseProcessor {
242
260
  insert(node: XMLQuery) {
243
261
  //let insertId = node.id; //not used atm
244
262
 
245
- let before = node.attr(TAG_BEFORE);
246
- let after = node.attr(TAG_AFTER);
247
-
248
- let insertNodes = DQ.fromMarkup(<any>node.cDATAAsString);
263
+ const before = node.attr(XML_TAG_BEFORE);
264
+ const after = node.attr(XML_TAG_AFTER);
265
+ const insertNodes = DQ.fromMarkup(<any>node.cDATAAsString);
249
266
 
250
267
  if (before.isPresent()) {
251
268
  DQ.byId(before.value, true).insertBefore(insertNodes);
252
269
  this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);
253
270
  }
254
271
  if (after.isPresent()) {
255
- let domQuery = DQ.byId(after.value, true);
272
+ const domQuery = DQ.byId(after.value, true);
256
273
  domQuery.insertAfter(insertNodes);
257
274
 
258
275
  this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);
@@ -264,13 +281,13 @@ export class ResponseProcessor implements IResponseProcessor {
264
281
  *
265
282
  * @param node the node hosting the insert data
266
283
  */
267
- insertWithSubtags(node: XMLQuery) {
268
- let before = node.querySelectorAll(TAG_BEFORE);
269
- let after = node.querySelectorAll(TAG_AFTER);
284
+ insertWithSubTags(node: XMLQuery) {
285
+ const before = node.querySelectorAll(XML_TAG_BEFORE);
286
+ const after = node.querySelectorAll(XML_TAG_AFTER);
270
287
 
271
288
  before.each(item => {
272
- let insertId = item.attr(ATTR_ID);
273
- let insertNodes = DQ.fromMarkup(<any>item.cDATAAsString);
289
+ const insertId = item.attr(ATTR_ID);
290
+ const insertNodes = DQ.fromMarkup(<any>item.cDATAAsString);
274
291
  if (insertId.isPresent()) {
275
292
  DQ.byId(insertId.value, true).insertBefore(insertNodes);
276
293
  this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);
@@ -278,8 +295,8 @@ export class ResponseProcessor implements IResponseProcessor {
278
295
  });
279
296
 
280
297
  after.each(item => {
281
- let insertId = item.attr(ATTR_ID);
282
- let insertNodes = DQ.fromMarkup(<any>item.cDATAAsString);
298
+ const insertId = item.attr(ATTR_ID);
299
+ const insertNodes = DQ.fromMarkup(<any>item.cDATAAsString);
283
300
  if (insertId.isPresent()) {
284
301
  DQ.byId(insertId.value, true).insertAfter(insertNodes);
285
302
  this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);
@@ -289,12 +306,12 @@ export class ResponseProcessor implements IResponseProcessor {
289
306
 
290
307
  /**
291
308
  * Process the viewState update, update the affected
292
- * forms with their respective new viewstate values
309
+ * forms with their respective new viewState values
293
310
  *
294
311
  */
295
312
  processViewState(node: XMLQuery): boolean {
296
313
  if (ResponseProcessor.isViewStateNode(node)) {
297
- let state = node.cDATAAsString;
314
+ const state = node.cDATAAsString;
298
315
  this.internalContext.assign(APPLIED_VST, node.id.value).value = new StateHolder($nsp(node.id.value), state);
299
316
  return true;
300
317
  }
@@ -303,7 +320,7 @@ export class ResponseProcessor implements IResponseProcessor {
303
320
 
304
321
  processClientWindow(node: XMLQuery): boolean {
305
322
  if (ResponseProcessor.isClientWindowNode(node)) {
306
- let state = node.cDATAAsString;
323
+ const state = node.cDATAAsString;
307
324
  this.internalContext.assign(APPLIED_CLIENT_WINDOW, node.id.value).value = new StateHolder($nsp(node.id.value), state);
308
325
  return true;
309
326
  }
@@ -314,11 +331,11 @@ export class ResponseProcessor implements IResponseProcessor {
314
331
  */
315
332
  globalEval() {
316
333
  // phase one, if we have head inserts, we build up those before going into the script eval phase
317
- let insertHeadElems = new ExtDomquery(...this.internalContext.getIf(DEFERRED_HEAD_INSERTS).value);
334
+ let insertHeadElems = new ExtDomQuery(...this.internalContext.getIf(DEFERRED_HEAD_INSERTS).value);
318
335
  insertHeadElems.runHeadInserts(true);
319
336
 
320
337
  // phase 2 we run a script eval on all updated elements in the body
321
- let updateElems = new ExtDomquery(...this.internalContext.getIf(UPDATE_ELEMS).value);
338
+ let updateElems = new ExtDomQuery(...this.internalContext.getIf(UPDATE_ELEMS).value);
322
339
  updateElems.runCss();
323
340
  // phase 3, we do the same for the css
324
341
  updateElems.runScripts();
@@ -331,63 +348,79 @@ export class ResponseProcessor implements IResponseProcessor {
331
348
  * as last lifecycle step, before going into the next request.
332
349
  */
333
350
  fixViewStates() {
334
- Stream.ofAssoc<StateHolder>(this.internalContext.getIf(APPLIED_VST).orElse({}).value)
335
- .each((item: Array<any>) => {
336
- let value: StateHolder = item[1];
337
- let nameSpace = DQ.byId(value.nameSpace, true).orElse(document.body);
338
- let affectedForms = nameSpace.byTagName(TAG_FORM);
339
- let affectedForms2 = nameSpace.filter(item => item.tagName.orElse(EMPTY_STR).value.toLowerCase() == TAG_FORM);
340
-
341
- this.appendViewStateToForms(new DomQuery(affectedForms, affectedForms2), value.value);
342
- });
351
+ ofAssoc(this.internalContext.getIf(APPLIED_VST).orElse({}).value)
352
+ .forEach(([, value]) => {
353
+ const namingContainerId = this.internalContext.getIf(NAMING_CONTAINER_ID);
354
+ const namedViewRoot = !!this.internalContext.getIf(NAMED_VIEWROOT).value
355
+ const affectedForms = this.getContainerForms(namingContainerId)
356
+ .filter(affectedForm => this.isInExecuteOrRender(affectedForm));
357
+
358
+ this.appendViewStateToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse("").value);
359
+ })
343
360
  }
344
361
 
362
+
363
+
345
364
  /**
346
365
  * same as with view states before applies the incoming client windows as last step after the rest of the processing
347
366
  * is done.
348
367
  */
349
368
  fixClientWindow() {
350
- Stream.ofAssoc<StateHolder>(this.internalContext.getIf(APPLIED_CLIENT_WINDOW).orElse({}).value)
351
- .each((item: Array<any>) => {
352
- let value: StateHolder = item[1];
353
- let nameSpace = DQ.byId(value.nameSpace, true).orElse(document.body);
354
- let affectedForms = nameSpace.byTagName(TAG_FORM);
355
- let affectedForms2 = nameSpace.filter(item => item.tagName.orElse(EMPTY_STR).value.toLowerCase() == TAG_FORM);
356
-
357
- this.appendClientWindowToForms(new DomQuery(affectedForms, affectedForms2), value.value);
369
+ ofAssoc(this.internalContext.getIf(APPLIED_CLIENT_WINDOW).orElse({}).value)
370
+ .forEach(([, value]) => {
371
+ const namingContainerId = this.internalContext.getIf(NAMING_CONTAINER_ID);
372
+ const namedViewRoot = !!this.internalContext.getIf(NAMED_VIEWROOT).value;
373
+ const affectedForms = this.getContainerForms(namingContainerId)
374
+ .filter(affectedForm => this.isInExecuteOrRender(affectedForm));
375
+
376
+ this.appendClientWindowToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse("").value);
358
377
  });
359
378
  }
360
379
 
380
+ updateNamedViewRootState() {
381
+ let partialId = this.internalContext.getIf(NAMING_CONTAINER_ID);
382
+ let namedViewRoot = this.internalContext.getIf(NAMED_VIEWROOT);
383
+ if(partialId.isPresent() &&
384
+ (namedViewRoot.isAbsent() ||
385
+ !namedViewRoot.value)) {
386
+ const SEP = $faces().separatorchar;
387
+ this.internalContext.assign(NAMED_VIEWROOT).value = (!!document.getElementById(partialId.value)) || DQ$(`input[name*='${$nsp(P_VIEWSTATE)}']`)
388
+ .filter(node => node.attr("name").value.indexOf(partialId.value + SEP) == 0).length > 0;
389
+ }
390
+ }
391
+
361
392
  /**
362
393
  * all processing done we can close the request and send the appropriate events
363
394
  */
364
395
  done() {
365
- let eventData = EventData.createFromRequest(this.request.value, this.externalContext, SUCCESS);
396
+ const eventData = EventData.createFromRequest(this.request.value, this.externalContext, SUCCESS);
366
397
 
367
398
  //because some frameworks might decorate them over the context in the response
368
- let eventHandler = this.externalContext.getIf(ON_EVENT).orElseLazy(() => this.internalContext.getIf(ON_EVENT).value).orElse(EMPTY_FUNC).value;
399
+ const eventHandler = this.externalContext.getIf(ON_EVENT).orElseLazy(() => this.internalContext.getIf(ON_EVENT).value).orElse(EMPTY_FUNC).value;
369
400
  Implementation.sendEvent(eventData, eventHandler);
370
401
  }
371
402
 
372
403
  /**
373
- * proper viewstate -> form assignment
404
+ * proper viewState -> form assignment
374
405
  *
375
- * @param forms the forms to append the viewstate to
376
- * @param viewState the final viewstate
406
+ * @param forms the forms to append the viewState to
407
+ * @param viewState the final viewState
408
+ * @param namingContainerId
377
409
  */
378
- private appendViewStateToForms(forms: DQ, viewState: string) {
379
- this.assignState(forms, $nsp(SEL_VIEWSTATE_ELEM), viewState);
410
+ private appendViewStateToForms(forms: DQ, namedViewRoot: boolean, viewState: string, namingContainerId = "") {
411
+ this.assignState(forms, $nsp(SEL_VIEWSTATE_ELEM), namedViewRoot, viewState, namingContainerId);
380
412
  }
381
413
 
382
414
 
383
415
  /**
384
- * proper clientwindow -> form assignment
416
+ * proper clientWindow -> form assignment
385
417
  *
386
- * @param forms the forms to append the viewstate to
387
- * @param clientWindow the final viewstate
418
+ * @param forms the forms to append the viewState to
419
+ * @param clientWindow the final viewState
420
+ * @param namingContainerId
388
421
  */
389
- private appendClientWindowToForms(forms: DQ, clientWindow: string) {
390
- this.assignState(forms, $nsp(SEL_CLIENT_WINDOW_ELEM), clientWindow);
422
+ private appendClientWindowToForms(forms: DQ, namedViewRoot: boolean, clientWindow: string, namingContainerId = "") {
423
+ this.assignState(forms, $nsp(SEL_CLIENT_WINDOW_ELEM), namedViewRoot, clientWindow, namingContainerId);
391
424
  }
392
425
 
393
426
  /**
@@ -395,44 +428,45 @@ export class ResponseProcessor implements IResponseProcessor {
395
428
  *
396
429
  * @param forms the forms to append or change to
397
430
  * @param selector the selector for the state
431
+ * @param namedViewRoot if set to true, the name is also prefixed
398
432
  * @param state the state itself which needs to be assigned
399
433
  *
434
+ * @param namingContainerId
400
435
  * @private
401
436
  */
402
- private assignState(forms: DQ, selector: string, state: string) {
403
- forms.each((form: DQ) => {
404
- let stateHolders = form.querySelectorAll(selector)
405
- .orElseLazy(() => ResponseProcessor.newViewStateElement(form));
406
-
407
- stateHolders.attr("value").value = state;
437
+ private assignState(forms: DQ, selector: string, namedViewRoot: boolean, state: string, namingContainerId: string) {
438
+ /**
439
+ * creates the viewState or client window id element
440
+ * @param form
441
+ */
442
+ const createAndAppendHiddenInput = (form: DomQuery) => {
443
+ return new HiddenInputBuilder(selector)
444
+ .withNamingContainerId(namingContainerId)
445
+ .withParent(form)
446
+ .withNamedViewRoot(namedViewRoot)
447
+ .build();
448
+ };
449
+
450
+ forms.each(form => {
451
+ const hiddenInput = form.querySelectorAll(selector)
452
+ .orElseLazy(() => createAndAppendHiddenInput(form));
453
+ hiddenInput.val = state;
408
454
  });
409
455
  }
410
456
 
411
457
  /**
412
- * Helper to Create a new JSF ViewState Element
413
- *
414
- * @param parent, the parent node to attach the viewstate element to
415
- * (usually a form node)
416
- */
417
- private static newViewStateElement(parent: DQ): DQ {
418
- let newViewState = DQ.fromMarkup($nsp(HTML_VIEWSTATE));
419
- newViewState.appendTo(parent);
420
- return newViewState;
421
- }
422
-
423
- /**
424
- * Stores certain aspects of the dom for later post processing
458
+ * Stores certain aspects of the dom for later post-processing
425
459
  *
426
460
  * @param updateForms the update forms which should receive standardized internal jsf data
427
- * @param toBeEvaled the resulting elements which should be evaled
461
+ * @param toBeEvaluated the resulting elements which should be evaluated
428
462
  */
429
- private storeForPostProcessing(updateForms: DQ, toBeEvaled: DQ) {
463
+ private storeForPostProcessing(updateForms: DQ, toBeEvaluated: DQ) {
430
464
  this.storeForUpdate(updateForms);
431
- this.storeForEval(toBeEvaled);
465
+ this.storeForEval(toBeEvaluated);
432
466
  }
433
467
 
434
468
  /**
435
- * helper to store a given form for the update post processing (viewstate)
469
+ * helper to store a given form for the update post-processing (viewState)
436
470
  *
437
471
  * @param updateForms the dom query object pointing to the forms which need to be updated
438
472
  */
@@ -443,28 +477,23 @@ export class ResponseProcessor implements IResponseProcessor {
443
477
  /**
444
478
  * same for eval (js and css)
445
479
  *
446
- * @param toBeEvaled
480
+ * @param toBeEvaluated
447
481
  */
448
- private storeForEval(toBeEvaled: DQ) {
449
- this.internalContext.assign(UPDATE_ELEMS).value.push(toBeEvaled);
450
- }
451
-
452
- // head eval is always sticky
453
- private storeForHeadEval(toBeEvaled: DQ, sticky) {
454
- this.internalContext.assign(DEFERRED_HEAD_INSERTS).value.push(toBeEvaled);
482
+ private storeForEval(toBeEvaluated: DQ) {
483
+ this.internalContext.assign(UPDATE_ELEMS).value.push(toBeEvaluated);
455
484
  }
456
485
 
457
486
  /**
458
- * check whether a given XMLQuery node is an explicit viewstate node
487
+ * check whether a given XMLQuery node is an explicit viewState node
459
488
  *
460
489
  * @param node the node to check
461
- * @returns true of it ii
490
+ * @returns if it is a viewState node
462
491
  */
463
492
  private static isViewStateNode(node: XMLQuery): boolean {
464
- let separatorChar = (window?.faces ?? window?.jsf).separatorchar;
493
+ const SEP = $faces().separatorchar;
465
494
  return "undefined" != typeof node?.id?.value && (node?.id?.value == $nsp(P_VIEWSTATE) ||
466
- node?.id?.value?.indexOf([separatorChar, $nsp(P_VIEWSTATE)].join(EMPTY_STR)) != -1 ||
467
- node?.id?.value?.indexOf([$nsp(P_VIEWSTATE), separatorChar].join(EMPTY_STR)) != -1);
495
+ node?.id?.value?.indexOf([SEP, $nsp(P_VIEWSTATE)].join(EMPTY_STR)) != -1 ||
496
+ node?.id?.value?.indexOf([$nsp(P_VIEWSTATE), SEP].join(EMPTY_STR)) != -1);
468
497
  }
469
498
 
470
499
  /**
@@ -474,15 +503,59 @@ export class ResponseProcessor implements IResponseProcessor {
474
503
  * @returns true of it ii
475
504
  */
476
505
  private static isClientWindowNode(node: XMLQuery): boolean {
477
- let separatorChar = (window?.faces ?? window?.jsf).separatorchar;
506
+ const SEP = $faces().separatorchar;
478
507
  return "undefined" != typeof node?.id?.value && (node?.id?.value == $nsp(P_CLIENT_WINDOW) ||
479
- node?.id?.value?.indexOf([separatorChar, $nsp(P_CLIENT_WINDOW)].join(EMPTY_STR)) != -1 ||
480
- node?.id?.value?.indexOf([$nsp(P_CLIENT_WINDOW), separatorChar].join(EMPTY_STR)) != -1);
508
+ node?.id?.value?.indexOf([SEP, $nsp(P_CLIENT_WINDOW)].join(EMPTY_STR)) != -1 ||
509
+ node?.id?.value?.indexOf([$nsp(P_CLIENT_WINDOW), SEP].join(EMPTY_STR)) != -1);
481
510
  }
482
511
 
483
512
  private triggerOnError(errorData: ErrorData) {
484
- this.externalContext.getIf(ON_ERROR).orElse(this.internalContext.getIf(ON_ERROR).value).orElse(EMPTY_FUNC).value(errorData);
513
+ this.externalContext.getIf(ON_ERROR).orElseLazy(() => this.internalContext.getIf(ON_ERROR).value).orElse(EMPTY_FUNC).value(errorData);
514
+ }
515
+
516
+ /**
517
+ * filters the forms according to being member of the "execute" or "render" cycle
518
+ * @param affectedForm
519
+ * @private
520
+ */
521
+ private isInExecuteOrRender(affectedForm) {
522
+ const executes = this.externalContext.getIf($nsp(P_EXECUTE)).orElse("@none").value.split(/\s+/gi);
523
+ const renders = this.externalContext.getIf(P_RENDER_OVERRIDE)
524
+ .orElseLazy(() => this.externalContext.getIf($nsp(P_RENDER)).value)
525
+ .orElse(IDENT_NONE).value.split(/\s+/gi);
526
+ const executeAndRenders = executes.concat(...renders);
527
+ return [...executeAndRenders].filter(nameOrId => {
528
+ if ([IDENT_ALL, IDENT_NONE].indexOf(nameOrId) != -1) {
529
+ return true;
530
+ }
531
+
532
+ const NAME_OR_ID = this.getNameOrIdSelector(nameOrId);
533
+ //either the form directly is in execute or render or one of its children or one of its parents
534
+ return affectedForm.matchesSelector(NAME_OR_ID) ||
535
+ affectedForm.querySelectorAll(NAME_OR_ID).isPresent() ||
536
+ affectedForm.firstParent(NAME_OR_ID).isPresent();
537
+ }).length > 0;
485
538
  }
486
539
 
540
+ /**
541
+ * gets all forms under a single naming container id
542
+ * @param namingContainerId
543
+ * @private
544
+ */
545
+ private getContainerForms(namingContainerId: Config) {
546
+ if (namingContainerId.isPresent()) {
547
+ //naming container mode, all forms under naming container id must be processed
548
+ return DQ$(this.getNameOrIdSelector(namingContainerId.value))
549
+ // missing condition if the naming container is not present we have to
550
+ // use the body as fallback
551
+ .orElseLazy(() => DQ.byTagName(HTML_TAG_BODY))
552
+ .byTagName(HTML_TAG_FORM, true);
553
+ } else {
554
+ return DQ.byTagName(HTML_TAG_FORM);
555
+ }
556
+ }
487
557
 
558
+ private getNameOrIdSelector(nameOrId) {
559
+ return `[id='${nameOrId}'], [name='${nameOrId}']`;
560
+ }
488
561
  }