jsf.js_next_gen 4.0.0-RC.3 → 4.0.0-RC.30

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 (183) hide show
  1. package/dist/docs/assets/main.js +56 -52
  2. package/dist/docs/assets/style.css +23 -0
  3. package/dist/window/faces-development.js +2860 -2999
  4. package/dist/window/faces-development.js.br +0 -0
  5. package/dist/window/faces-development.js.gz +0 -0
  6. package/dist/window/faces-development.js.map +1 -1
  7. package/dist/window/faces.js +1 -1
  8. package/dist/window/faces.js.LICENSE.txt +0 -2
  9. package/dist/window/faces.js.br +0 -0
  10. package/dist/window/faces.js.gz +0 -0
  11. package/dist/window/faces.js.map +1 -1
  12. package/dist/window/jsf-development.js +2865 -3004
  13. package/dist/window/jsf-development.js.br +0 -0
  14. package/dist/window/jsf-development.js.gz +0 -0
  15. package/dist/window/jsf-development.js.map +1 -1
  16. package/dist/window/jsf.js +1 -1
  17. package/dist/window/jsf.js.LICENSE.txt +0 -2
  18. package/dist/window/jsf.js.br +0 -0
  19. package/dist/window/jsf.js.gz +0 -0
  20. package/dist/window/jsf.js.map +1 -1
  21. package/package.json +16 -16
  22. package/src/main/test.xml +23 -0
  23. package/src/main/typescript/@types/definitions/index.d.ts +12 -7
  24. package/src/main/typescript/api/_api.ts +4 -3
  25. package/src/main/typescript/impl/AjaxImpl.ts +125 -41
  26. package/src/main/typescript/impl/core/Const.ts +52 -41
  27. package/src/main/typescript/impl/util/Assertions.ts +16 -8
  28. package/src/main/typescript/impl/util/ExtDomQuery.ts +12 -4
  29. package/src/main/typescript/impl/util/HiddenInputBuilder.ts +89 -0
  30. package/src/main/typescript/impl/util/Lang.ts +9 -11
  31. package/src/main/typescript/impl/util/URLCodec.ts +71 -0
  32. package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -10
  33. package/src/main/typescript/impl/xhrCore/EventData.ts +2 -2
  34. package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +15 -1
  35. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +69 -24
  36. package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +4 -4
  37. package/src/main/typescript/impl/xhrCore/Response.ts +55 -38
  38. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +173 -98
  39. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +64 -158
  40. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +36 -21
  41. package/src/main/typescript/myfaces/OamSubmit.ts +29 -13
  42. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +1 -1
  43. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +72 -0
  44. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
  45. package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -3
  46. package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -3
  47. package/src/main/typescript/test/xhrCore/EventTests.spec.ts +1 -1
  48. package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +2 -0
  49. package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +203 -0
  50. package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +177 -0
  51. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +128 -15
  52. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +70 -3
  53. package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +39 -3
  54. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +372 -34
  55. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +43 -9
  56. package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +67 -49
  57. package/src/main/typescript/test.xml +6 -0
  58. package/src/main/typescript/tsconfig.json +2 -2
  59. package/src/test/resources/jsf-development.js +1 -1
  60. package/src/tmp/test.html +12 -88
  61. package/target/api/_api.js +16 -29
  62. package/target/api/_api.js.map +1 -1
  63. package/target/api/faces.js +4 -4
  64. package/target/api/faces.js.map +1 -1
  65. package/target/api/jsf.js +9 -9
  66. package/target/api/jsf.js.map +1 -1
  67. package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
  68. package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
  69. package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
  70. package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
  71. package/target/impl/AjaxImpl.js +155 -89
  72. package/target/impl/AjaxImpl.js.map +1 -1
  73. package/target/impl/PushImpl.js +45 -48
  74. package/target/impl/PushImpl.js.map +1 -1
  75. package/target/impl/core/Const.js +52 -40
  76. package/target/impl/core/Const.js.map +1 -1
  77. package/target/impl/core/Context.js +10 -0
  78. package/target/impl/core/Context.js.map +1 -0
  79. package/target/impl/core/ImplTypes.js +9 -14
  80. package/target/impl/core/ImplTypes.js.map +1 -1
  81. package/target/impl/i18n/Messages.js +3 -4
  82. package/target/impl/i18n/Messages.js.map +1 -1
  83. package/target/impl/util/Assertions.js +20 -24
  84. package/target/impl/util/Assertions.js.map +1 -1
  85. package/target/impl/util/AsyncQueue.js +28 -36
  86. package/target/impl/util/AsyncQueue.js.map +1 -1
  87. package/target/impl/util/ExtDomQuery.js +153 -221
  88. package/target/impl/util/ExtDomQuery.js.map +1 -1
  89. package/target/impl/util/HiddenElementBuilder.js +7 -0
  90. package/target/impl/util/HiddenElementBuilder.js.map +1 -0
  91. package/target/impl/util/HiddenInputBuilder.js +79 -0
  92. package/target/impl/util/HiddenInputBuilder.js.map +1 -0
  93. package/target/impl/util/Lang.js +23 -32
  94. package/target/impl/util/Lang.js.map +1 -1
  95. package/target/impl/util/URLCodec.js +69 -0
  96. package/target/impl/util/URLCodec.js.map +1 -0
  97. package/target/impl/xhrCore/ErrorData.js +41 -64
  98. package/target/impl/xhrCore/ErrorData.js.map +1 -1
  99. package/target/impl/xhrCore/EventData.js +10 -13
  100. package/target/impl/xhrCore/EventData.js.map +1 -1
  101. package/target/impl/xhrCore/RequestContext.js +11 -0
  102. package/target/impl/xhrCore/RequestContext.js.map +1 -0
  103. package/target/impl/xhrCore/RequestDataResolver.js +71 -27
  104. package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
  105. package/target/impl/xhrCore/ResonseDataResolver.js +16 -16
  106. package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
  107. package/target/impl/xhrCore/Response.js +43 -28
  108. package/target/impl/xhrCore/Response.js.map +1 -1
  109. package/target/impl/xhrCore/ResponseProcessor.js +217 -162
  110. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  111. package/target/impl/xhrCore/XhrFormData.js +77 -199
  112. package/target/impl/xhrCore/XhrFormData.js.map +1 -1
  113. package/target/impl/xhrCore/XhrRequest.js +102 -103
  114. package/target/impl/xhrCore/XhrRequest.js.map +1 -1
  115. package/target/myfaces/OamSubmit.js +33 -24
  116. package/target/myfaces/OamSubmit.js.map +1 -1
  117. package/target/test/frameworkBase/LangTest.spec.js +46 -32
  118. package/target/test/frameworkBase/LangTest.spec.js.map +1 -1
  119. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +238 -228
  120. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  121. package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js +45 -31
  122. package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +1 -1
  123. package/target/test/frameworkBase/_ext/monadish/MappingProbes.js +24 -33
  124. package/target/test/frameworkBase/_ext/monadish/MappingProbes.js.map +1 -1
  125. package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js +8 -8
  126. package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +1 -1
  127. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +31 -31
  128. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
  129. package/target/test/frameworkBase/_ext/monadish/StreamTest.spec.js +50 -48
  130. package/target/test/frameworkBase/_ext/monadish/StreamTest.spec.js.map +1 -1
  131. package/target/test/frameworkBase/_ext/shared/StandardInits.js +310 -132
  132. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  133. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +235 -22
  134. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  135. package/target/test/impl/ImplTest.spec.js +32 -59
  136. package/target/test/impl/ImplTest.spec.js.map +1 -1
  137. package/target/test/impl/ImplTest_23.spec.js +32 -59
  138. package/target/test/impl/ImplTest_23.spec.js.map +1 -1
  139. package/target/test/impl/SeparatorCharsTest.spec.js +17 -17
  140. package/target/test/impl/SeparatorCharsTest.spec.js.map +1 -1
  141. package/target/test/myfaces/OamSubmit.spec.js +25 -25
  142. package/target/test/myfaces/OamSubmit.spec.js.map +1 -1
  143. package/target/test/queue/AsynchronousProbe.js +23 -29
  144. package/target/test/queue/AsynchronousProbe.js.map +1 -1
  145. package/target/test/queue/AsynchronousQueueTest.spec.js +39 -70
  146. package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
  147. package/target/test/xhrCore/EventTests.spec.js +43 -74
  148. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  149. package/target/test/xhrCore/FakeWebsocket.js +14 -16
  150. package/target/test/xhrCore/FakeWebsocket.js.map +1 -1
  151. package/target/test/xhrCore/FileUploadTest.spec.js +47 -77
  152. package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
  153. package/target/test/xhrCore/NamespacesRequestTest.spec.js +204 -0
  154. package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
  155. package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
  156. package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
  157. package/target/test/xhrCore/RequestParamsTest.spec.js +143 -72
  158. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  159. package/target/test/xhrCore/RequestTest.spec.js +173 -149
  160. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  161. package/target/test/xhrCore/RequestTest_23.spec.js +127 -142
  162. package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
  163. package/target/test/xhrCore/ResponseTest.spec.js +415 -100
  164. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  165. package/target/test/xhrCore/ResponseTest23.spec.js +152 -91
  166. package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
  167. package/target/test/xhrCore/ShadowDomTest.spec.js +30 -61
  168. package/target/test/xhrCore/ShadowDomTest.spec.js.map +1 -1
  169. package/target/test/xhrCore/WebsocketTest.js +60 -93
  170. package/target/test/xhrCore/WebsocketTest.js.map +1 -1
  171. package/target/test/xhrCore/XhrFormDataTest.spec.js +79 -30
  172. package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
  173. package/target/test-classes/.gz +0 -0
  174. package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
  175. package/target/test-classes/fileuploadtest.html +24 -0
  176. package/target/test-classes/jsf-development.js +3559 -0
  177. package/target/test-classes/jsf-development.js.br +0 -0
  178. package/target/test-classes/jsf-development.js.gz +0 -0
  179. package/target/test-classes/jsf-development.js.map +1 -0
  180. package/target/test-classes/jsf.js +3 -0
  181. package/target/test-classes/jsf.js.br +0 -0
  182. package/target/test-classes/jsf.js.gz +0 -0
  183. package/tmp.xml +36 -0
@@ -20,23 +20,23 @@ import {ResponseProcessor} from "./ResponseProcessor";
20
20
  import {IResponseProcessor} from "./IResponseProcessor";
21
21
  import {
22
22
  $nsp,
23
- CMD_ATTRIBUTES,
24
- CMD_CHANGES,
25
- CMD_DELETE,
26
- CMD_ERROR,
27
- CMD_EVAL,
28
- CMD_EXTENSION,
29
- CMD_INSERT,
30
- CMD_REDIRECT,
31
- CMD_UPDATE, P_RESOURCE,
23
+ XML_TAG_ATTRIBUTES,
24
+ XML_TAG_CHANGES,
25
+ XML_TAG_DELETE,
26
+ XML_TAG_ERROR,
27
+ XML_TAG_EVAL,
28
+ XML_TAG_EXTENSION,
29
+ XML_TAG_INSERT,
30
+ XML_TAG_REDIRECT,
31
+ XML_TAG_UPDATE, P_RESOURCE,
32
32
  P_VIEWBODY,
33
33
  P_VIEWHEAD,
34
34
  P_VIEWROOT,
35
- PARTIAL_ID,
36
- RESP_PARTIAL,
35
+ NAMING_CONTAINER_ID,
36
+ XML_TAG_PARTIAL_RESP,
37
37
  RESPONSE_XML,
38
- TAG_AFTER,
39
- TAG_BEFORE
38
+ XML_TAG_AFTER,
39
+ XML_TAG_BEFORE, NAMED_VIEWROOT, XML_ATTR_NAMED_VIEWROOT, P_VIEWSTATE, $faces
40
40
  } from "../core/Const";
41
41
  import {resolveContexts, resolveResponseXML} from "./ResonseDataResolver";
42
42
  import {ExtConfig} from "../util/ExtDomQuery";
@@ -67,7 +67,7 @@ export module Response {
67
67
  internalContext.assign(RESPONSE_XML).value = responseXML;
68
68
 
69
69
  // we now process the partial tags, or in none given raise an error
70
- responseXML.querySelectorAll(RESP_PARTIAL)
70
+ responseXML.querySelectorAll(XML_TAG_PARTIAL_RESP)
71
71
  .each(item => processPartialTag(<XMLQuery>item, responseProcessor, internalContext));
72
72
 
73
73
  // We now process the viewStates, client windows and the elements to be evaluated are delayed.
@@ -76,6 +76,7 @@ export module Response {
76
76
  // doing any evaluations even on embedded scripts.
77
77
  // Usually this does not matter, the client window comes in almost last always anyway
78
78
  // we maybe drop this deferred assignment in the future, but myfaces did it until now.
79
+ responseProcessor.updateNamedViewRootState();
79
80
  responseProcessor.fixViewStates();
80
81
  responseProcessor.fixClientWindow();
81
82
  responseProcessor.globalEval();
@@ -86,35 +87,51 @@ export module Response {
86
87
  /**
87
88
  * highest node partial-response from there the main operations are triggered
88
89
  */
89
- function processPartialTag(node: XMLQuery, responseProcessor: IResponseProcessor, internalContext) {
90
+ function processPartialTag(node: XMLQuery, responseProcessor: IResponseProcessor, internalContext) {
90
91
 
91
- internalContext.assign(PARTIAL_ID).value = node.id;
92
- const SEL_SUB_TAGS = [CMD_ERROR, CMD_REDIRECT, CMD_CHANGES].join(",");
92
+
93
+ /*
94
+ https://javaee.github.io/javaserverfaces/docs/2.2/javadocs/web-partialresponse.html#ns_xsd
95
+ The "partial-response" element is the root of the partial response information hierarchy,
96
+ and contains nested elements for all possible elements that can exist in the response.
97
+ This element must have an "id" attribute whose value is the return from calling getContainerClientId()
98
+ on the UIViewRoot to which this response pertains.
99
+ */
100
+ // we can determine whether we are in a naming container scenario by checking whether the passed view id is present in the page
101
+ // under or in body as identifier
102
+
103
+ let partialId:string = node?.id?.value;
104
+ internalContext.assignIf(!!partialId, NAMING_CONTAINER_ID).value = partialId; // second case mojarra
105
+
106
+ // there must be at least one container viewstate element resembling the viewroot that we know
107
+ // this is named
108
+ responseProcessor.updateNamedViewRootState();
109
+
110
+ const SEL_SUB_TAGS = [XML_TAG_ERROR, XML_TAG_REDIRECT, XML_TAG_CHANGES].join(",");
93
111
 
94
112
  // now we can process the main operations
95
113
  node.querySelectorAll(SEL_SUB_TAGS).each((node: XMLQuery) => {
96
114
  switch (node.tagName.value) {
97
- case CMD_ERROR:
115
+ case XML_TAG_ERROR:
98
116
  responseProcessor.error(node);
99
117
  break;
100
- case CMD_REDIRECT:
118
+ case XML_TAG_REDIRECT:
101
119
  responseProcessor.redirect(node);
102
120
  break;
103
- case CMD_CHANGES:
121
+ case XML_TAG_CHANGES:
104
122
  processChangesTag(node, responseProcessor);
105
123
  break;
106
124
  }
107
125
  });
108
-
109
126
  }
110
127
 
111
128
  let processInsert = function (responseProcessor: IResponseProcessor, node: XMLQuery) {
112
- // path1 insert after as child tags
113
- if(node.querySelectorAll([TAG_BEFORE, TAG_AFTER].join(",")).length) {
114
- responseProcessor.insertWithSubTags(node);
115
- } else { // insert before after with id
116
- responseProcessor.insert(node);
117
- }
129
+ // path1 insert after as child tags
130
+ if(node.querySelectorAll([XML_TAG_BEFORE, XML_TAG_AFTER].join(",")).length) {
131
+ responseProcessor.insertWithSubTags(node);
132
+ } else { // insert before after with id
133
+ responseProcessor.insert(node);
134
+ }
118
135
 
119
136
  };
120
137
 
@@ -124,32 +141,32 @@ export module Response {
124
141
  * @param node
125
142
  * @param responseProcessor
126
143
  */
127
- function processChangesTag(node: XMLQuery, responseProcessor: IResponseProcessor): boolean {
128
- const ALLOWED_TAGS = [CMD_UPDATE, CMD_EVAL, CMD_INSERT, CMD_DELETE, CMD_ATTRIBUTES, CMD_EXTENSION].join(", ");
144
+ function processChangesTag(node: XMLQuery, responseProcessor: IResponseProcessor): boolean {
145
+ const ALLOWED_TAGS = [XML_TAG_UPDATE, XML_TAG_EVAL, XML_TAG_INSERT, XML_TAG_DELETE, XML_TAG_ATTRIBUTES, XML_TAG_EXTENSION].join(", ");
129
146
  node.querySelectorAll(ALLOWED_TAGS).each(
130
147
  (node: XMLQuery) => {
131
148
  switch (node.tagName.value) {
132
- case CMD_UPDATE:
149
+ case XML_TAG_UPDATE:
133
150
  processUpdateTag(node, responseProcessor);
134
151
  break;
135
152
 
136
- case CMD_EVAL:
153
+ case XML_TAG_EVAL:
137
154
  responseProcessor.eval(node);
138
155
  break;
139
156
 
140
- case CMD_INSERT:
157
+ case XML_TAG_INSERT:
141
158
  processInsert(responseProcessor, node);
142
159
  break;
143
160
 
144
- case CMD_DELETE:
161
+ case XML_TAG_DELETE:
145
162
  responseProcessor.delete(node);
146
163
  break;
147
164
 
148
- case CMD_ATTRIBUTES:
165
+ case XML_TAG_ATTRIBUTES:
149
166
  responseProcessor.attributes(node);
150
167
  break;
151
168
 
152
- case CMD_EXTENSION:
169
+ case XML_TAG_EXTENSION:
153
170
  break;
154
171
  }
155
172
  }
@@ -177,8 +194,8 @@ export module Response {
177
194
  * @param node
178
195
  * @param responseProcessor
179
196
  */
180
- function processUpdateTag(node: XMLQuery, responseProcessor: IResponseProcessor) {
181
- // early state storing, if no state we perform a normal update cycle
197
+ function processUpdateTag(node: XMLQuery, responseProcessor: IResponseProcessor) {
198
+ // early state storing, if no state we perform a normal update cycle
182
199
  if (!storeState(responseProcessor, node)) {
183
200
  handleElementUpdate(node, responseProcessor);
184
201
  }
@@ -190,7 +207,7 @@ export module Response {
190
207
  * @param node
191
208
  * @param responseProcessor
192
209
  */
193
- function handleElementUpdate(node: XMLQuery, responseProcessor: IResponseProcessor) {
210
+ function handleElementUpdate(node: XMLQuery, responseProcessor: IResponseProcessor) {
194
211
  let cdataBlock = node.cDATAAsString;
195
212
  switch (node.id.value) {
196
213
  case $nsp(P_VIEWROOT) :
@@ -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, LazyStream, Stream, 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,40 @@ 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,
46
+ ON_EVENT,
47
+ P_CLIENT_WINDOW,
48
+ P_EXECUTE,
40
49
  P_PARTIAL_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";
57
- import trim = Lang.trim;
58
65
  import {ExtConfig, ExtDomQuery} from "../util/ExtDomQuery";
66
+ import {HiddenInputBuilder} from "../util/HiddenInputBuilder";
67
+ import trim = Lang.trim;
59
68
 
60
69
 
61
70
  /**
@@ -82,31 +91,38 @@ export class ResponseProcessor implements IResponseProcessor {
82
91
  * the data incoming must represent the html representation of the head itself one way or the other
83
92
  */
84
93
  replaceHead(shadowDocument: XMLQuery | DQ) {
85
- let shadowHead = shadowDocument.querySelectorAll(TAG_HEAD);
94
+ const shadowHead = shadowDocument.querySelectorAll(HTML_TAG_HEAD);
86
95
  if (!shadowHead.isPresent()) {
87
96
  return;
88
97
  }
98
+ const head = ExtDomQuery.querySelectorAll(HTML_TAG_HEAD);
99
+ // full replace we delete everything
100
+ head.childNodes.delete();
101
+ this.addToHead(shadowHead);
102
+ //we copy the attributes as well (just in case myfaces introduces the id in head)
103
+ head.copyAttrs(shadowHead);
104
+ }
89
105
 
90
- let oldHead = ExtDomQuery.querySelectorAll(TAG_HEAD);
91
-
92
- //delete all to avoid script and style overlays
93
- oldHead.querySelectorAll(SEL_SCRIPTS_STYLES).delete();
106
+ addToHead(shadowHead: XMLQuery | DQ) {
107
+ const mappedHeadData = new ExtDomQuery(shadowHead);
108
+ const scriptTags = [HTML_TAG_SCRIPT];
109
+ const nonExecutables = mappedHeadData.filter(item => scriptTags.indexOf(item.tagName.orElse("").value) == -1);
110
+ nonExecutables.runHeadInserts(true);
94
111
 
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
112
  //incoming either the outer head tag or its children
100
- //shadowHead = (shadowHead.tagName.value === "HEAD") ? shadowHead.childNodes : shadowHead;
101
- //this.addToHead(shadowHead);
113
+ const nodesToAdd = (shadowHead.tagName.value === "HEAD") ? shadowHead.childNodes : shadowHead;
114
+ // this is stored for "post" processing
115
+ // after the rest of the "physical build up", head before body
116
+ const scriptElements = nodesToAdd.stream
117
+ .filter(item => scriptTags.indexOf(item.tagName.orElse("").value) != -1).collect(new DomQueryCollector());
118
+
119
+ this.addToHeadDeferred(scriptElements);
102
120
  }
103
121
 
104
- addToHead(newElements: XMLQuery | DQ) {
122
+ addToHeadDeferred(newElements: XMLQuery | DQ) {
105
123
  this.internalContext.assign(DEFERRED_HEAD_INSERTS).value.push(newElements);
106
124
  }
107
125
 
108
-
109
-
110
126
  /**
111
127
  * replaces the body in the expected manner
112
128
  * which means the entire body content is refreshed
@@ -117,21 +133,20 @@ export class ResponseProcessor implements IResponseProcessor {
117
133
  */
118
134
  replaceBody(shadowDocument: XMLQuery | DQ) {
119
135
 
120
- let shadowBody = shadowDocument.querySelectorAll(TAG_BODY);
136
+ const shadowBody = shadowDocument.querySelectorAll(HTML_TAG_BODY);
121
137
  if (!shadowBody.isPresent()) {
122
138
  return;
123
139
  }
124
140
 
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);
141
+ const shadowInnerHTML: string = <string>shadowBody.innerHTML;
142
+ const resultingBody = <DQ>ExtDomQuery.querySelectorAll(HTML_TAG_BODY);
143
+ const updateForms = resultingBody.querySelectorAll(HTML_TAG_FORM);
129
144
 
130
145
  // main difference, we cannot replace the body itself, but only its content
131
146
  // we need a separate step for post-processing the incoming
132
147
  // attributes, like classes, styles etc...
133
- resultingBody.copyAttrs(shadowBody);
134
-
148
+ (resultingBody.html(shadowInnerHTML) as DQ).copyAttrs(shadowBody);
149
+ this.externalContext.assign($nsp(P_RENDER_OVERRIDE)).value = "@all";
135
150
  this.storeForPostProcessing(updateForms, resultingBody);
136
151
  }
137
152
 
@@ -158,18 +173,18 @@ export class ResponseProcessor implements IResponseProcessor {
158
173
  * <error>
159
174
  */
160
175
 
161
- let mergedErrorData = new ExtConfig({});
176
+ const mergedErrorData = new ExtConfig({});
162
177
  mergedErrorData.assign(SOURCE).value = this.externalContext.getIf(P_PARTIAL_SOURCE).get(0).value;
163
178
  mergedErrorData.assign(ERROR_NAME).value = node.querySelectorAll(ERROR_NAME).textContent(EMPTY_STR);
164
179
  mergedErrorData.assign(ERROR_MESSAGE).value = node.querySelectorAll(ERROR_MESSAGE).cDATAAsString;
165
180
 
166
- let hasResponseXML = this.internalContext.get(RESPONSE_XML).isPresent();
181
+ const hasResponseXML = this.internalContext.get(RESPONSE_XML).isPresent();
167
182
 
168
183
  //we now store the response xml also in the error data for further details
169
184
  mergedErrorData.assignIf(hasResponseXML, RESPONSE_XML).value = this.internalContext.getIf(RESPONSE_XML).value.get(0).value;
170
185
 
171
186
  // error post-processing and enrichment (standard messages from keys)
172
- let errorData = ErrorData.fromServerError(mergedErrorData);
187
+ const errorData = ErrorData.fromServerError(mergedErrorData);
173
188
 
174
189
  // we now trigger an internally stored onError function which might be an attached to the context
175
190
  // either we do not have an internal on error, or an on error has been based via params from the outside.
@@ -187,7 +202,7 @@ export class ResponseProcessor implements IResponseProcessor {
187
202
  redirect(node: XMLQuery) {
188
203
  Assertions.assertUrlExists(node);
189
204
 
190
- let redirectUrl = trim(node.attr(ATTR_URL).value);
205
+ const redirectUrl = trim(node.attr(ATTR_URL).value);
191
206
  if (redirectUrl != EMPTY_STR) {
192
207
  window.location.href = redirectUrl;
193
208
  }
@@ -199,8 +214,8 @@ export class ResponseProcessor implements IResponseProcessor {
199
214
  * @param cdataBlock the cdata block with the new html code
200
215
  */
201
216
  update(node: XMLQuery, cdataBlock: string) {
202
- let result = ExtDomQuery.byId(node.id.value, true).outerHTML(cdataBlock, false, false);
203
- let sourceForm = result?.parents(TAG_FORM).orElseLazy(() => result.byTagName(TAG_FORM, true));
217
+ const result = ExtDomQuery.byId(node.id.value, true).outerHTML(cdataBlock, false, false);
218
+ const sourceForm = result?.firstParent(HTML_TAG_FORM).orElseLazy(() => result.byTagName(HTML_TAG_FORM, true));
204
219
  if (sourceForm) {
205
220
  this.storeForPostProcessing(sourceForm, result);
206
221
  }
@@ -220,9 +235,9 @@ export class ResponseProcessor implements IResponseProcessor {
220
235
  * @param node
221
236
  */
222
237
  attributes(node: XMLQuery) {
223
- let elem = DQ.byId(node.id.value, true);
238
+ const elem = DQ.byId(node.id.value, true);
224
239
 
225
- node.byTagName(TAG_ATTR).each((item: XMLQuery) => {
240
+ node.byTagName(XML_TAG_ATTR).each((item: XMLQuery) => {
226
241
  elem.attr(item.attr(ATTR_NAME).value).value = item.attr(ATTR_VALUE).value;
227
242
  });
228
243
  }
@@ -243,17 +258,16 @@ export class ResponseProcessor implements IResponseProcessor {
243
258
  insert(node: XMLQuery) {
244
259
  //let insertId = node.id; //not used atm
245
260
 
246
- let before = node.attr(TAG_BEFORE);
247
- let after = node.attr(TAG_AFTER);
248
-
249
- let insertNodes = DQ.fromMarkup(<any>node.cDATAAsString);
261
+ const before = node.attr(XML_TAG_BEFORE);
262
+ const after = node.attr(XML_TAG_AFTER);
263
+ const insertNodes = DQ.fromMarkup(<any>node.cDATAAsString);
250
264
 
251
265
  if (before.isPresent()) {
252
266
  DQ.byId(before.value, true).insertBefore(insertNodes);
253
267
  this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);
254
268
  }
255
269
  if (after.isPresent()) {
256
- let domQuery = DQ.byId(after.value, true);
270
+ const domQuery = DQ.byId(after.value, true);
257
271
  domQuery.insertAfter(insertNodes);
258
272
 
259
273
  this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);
@@ -266,12 +280,12 @@ export class ResponseProcessor implements IResponseProcessor {
266
280
  * @param node the node hosting the insert data
267
281
  */
268
282
  insertWithSubTags(node: XMLQuery) {
269
- let before = node.querySelectorAll(TAG_BEFORE);
270
- let after = node.querySelectorAll(TAG_AFTER);
283
+ const before = node.querySelectorAll(XML_TAG_BEFORE);
284
+ const after = node.querySelectorAll(XML_TAG_AFTER);
271
285
 
272
286
  before.each(item => {
273
- let insertId = item.attr(ATTR_ID);
274
- let insertNodes = DQ.fromMarkup(<any>item.cDATAAsString);
287
+ const insertId = item.attr(ATTR_ID);
288
+ const insertNodes = DQ.fromMarkup(<any>item.cDATAAsString);
275
289
  if (insertId.isPresent()) {
276
290
  DQ.byId(insertId.value, true).insertBefore(insertNodes);
277
291
  this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);
@@ -279,8 +293,8 @@ export class ResponseProcessor implements IResponseProcessor {
279
293
  });
280
294
 
281
295
  after.each(item => {
282
- let insertId = item.attr(ATTR_ID);
283
- let insertNodes = DQ.fromMarkup(<any>item.cDATAAsString);
296
+ const insertId = item.attr(ATTR_ID);
297
+ const insertNodes = DQ.fromMarkup(<any>item.cDATAAsString);
284
298
  if (insertId.isPresent()) {
285
299
  DQ.byId(insertId.value, true).insertAfter(insertNodes);
286
300
  this.internalContext.assign(UPDATE_ELEMS).value.push(insertNodes);
@@ -295,7 +309,7 @@ export class ResponseProcessor implements IResponseProcessor {
295
309
  */
296
310
  processViewState(node: XMLQuery): boolean {
297
311
  if (ResponseProcessor.isViewStateNode(node)) {
298
- let state = node.cDATAAsString;
312
+ const state = node.cDATAAsString;
299
313
  this.internalContext.assign(APPLIED_VST, node.id.value).value = new StateHolder($nsp(node.id.value), state);
300
314
  return true;
301
315
  }
@@ -304,7 +318,7 @@ export class ResponseProcessor implements IResponseProcessor {
304
318
 
305
319
  processClientWindow(node: XMLQuery): boolean {
306
320
  if (ResponseProcessor.isClientWindowNode(node)) {
307
- let state = node.cDATAAsString;
321
+ const state = node.cDATAAsString;
308
322
  this.internalContext.assign(APPLIED_CLIENT_WINDOW, node.id.value).value = new StateHolder($nsp(node.id.value), state);
309
323
  return true;
310
324
  }
@@ -333,40 +347,54 @@ export class ResponseProcessor implements IResponseProcessor {
333
347
  */
334
348
  fixViewStates() {
335
349
  Stream.ofAssoc<StateHolder>(this.internalContext.getIf(APPLIED_VST).orElse({}).value)
336
- .each((item: Array<any>) => {
337
- let value: StateHolder = item[1];
338
- let nameSpace = DQ.byId(value.nameSpace, true).orElse(document.body);
339
- let affectedForms = nameSpace.byTagName(TAG_FORM);
340
- let affectedForms2 = nameSpace.filter(item => item.tagName.orElse(EMPTY_STR).value.toLowerCase() == TAG_FORM);
350
+ .each(([, value]) => {
351
+ const namingContainerId = this.internalContext.getIf(NAMING_CONTAINER_ID);
352
+ const namedViewRoot = !!this.internalContext.getIf(NAMED_VIEWROOT).value
353
+ const affectedForms = this.getContainerForms(namingContainerId)
354
+ .filter(affectedForm => this.isInExecuteOrRender(affectedForm));
341
355
 
342
- this.appendViewStateToForms(new DomQuery(affectedForms, affectedForms2), value.value);
356
+ this.appendViewStateToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse("").value);
343
357
  });
344
358
  }
345
359
 
360
+
361
+
346
362
  /**
347
363
  * same as with view states before applies the incoming client windows as last step after the rest of the processing
348
364
  * is done.
349
365
  */
350
366
  fixClientWindow() {
351
367
  Stream.ofAssoc<StateHolder>(this.internalContext.getIf(APPLIED_CLIENT_WINDOW).orElse({}).value)
352
- .each((item: Array<any>) => {
353
- let value: StateHolder = item[1];
354
- let nameSpace = DQ.byId(value.nameSpace, true).orElse(document.body);
355
- let affectedForms = nameSpace.byTagName(TAG_FORM);
356
- let affectedForms2 = nameSpace.filter(item => item.tagName.orElse(EMPTY_STR).value.toLowerCase() == TAG_FORM);
368
+ .each(([, value]) => {
369
+ const namingContainerId = this.internalContext.getIf(NAMING_CONTAINER_ID);
370
+ const namedViewRoot = !!this.internalContext.getIf(NAMED_VIEWROOT).value;
371
+ const affectedForms = this.getContainerForms(namingContainerId)
372
+ .filter(affectedForm => this.isInExecuteOrRender(affectedForm));
357
373
 
358
- this.appendClientWindowToForms(new DomQuery(affectedForms, affectedForms2), value.value);
374
+ this.appendClientWindowToForms(affectedForms, namedViewRoot, value.value, namingContainerId.orElse("").value);
359
375
  });
360
376
  }
361
377
 
378
+ updateNamedViewRootState() {
379
+ let partialId = this.internalContext.getIf(NAMING_CONTAINER_ID);
380
+ let namedViewRoot = this.internalContext.getIf(NAMED_VIEWROOT);
381
+ if(partialId.isPresent() &&
382
+ (namedViewRoot.isAbsent() ||
383
+ !namedViewRoot.value)) {
384
+ const SEP = $faces().separatorchar;
385
+ this.internalContext.assign(NAMED_VIEWROOT).value = (!!document.getElementById(partialId.value)) || DQ$(`input[name*='${$nsp(P_VIEWSTATE)}']`)
386
+ .filter(node => node.attr("name").value.indexOf(partialId.value + SEP) == 0).length > 0;
387
+ }
388
+ }
389
+
362
390
  /**
363
391
  * all processing done we can close the request and send the appropriate events
364
392
  */
365
393
  done() {
366
- let eventData = EventData.createFromRequest(this.request.value, this.externalContext, SUCCESS);
394
+ const eventData = EventData.createFromRequest(this.request.value, this.externalContext, SUCCESS);
367
395
 
368
396
  //because some frameworks might decorate them over the context in the response
369
- let eventHandler = this.externalContext.getIf(ON_EVENT).orElseLazy(() => this.internalContext.getIf(ON_EVENT).value).orElse(EMPTY_FUNC).value;
397
+ const eventHandler = this.externalContext.getIf(ON_EVENT).orElseLazy(() => this.internalContext.getIf(ON_EVENT).value).orElse(EMPTY_FUNC).value;
370
398
  Implementation.sendEvent(eventData, eventHandler);
371
399
  }
372
400
 
@@ -375,9 +403,10 @@ export class ResponseProcessor implements IResponseProcessor {
375
403
  *
376
404
  * @param forms the forms to append the viewState to
377
405
  * @param viewState the final viewState
406
+ * @param namingContainerId
378
407
  */
379
- private appendViewStateToForms(forms: DQ, viewState: string) {
380
- this.assignState(forms, $nsp(SEL_VIEWSTATE_ELEM), viewState);
408
+ private appendViewStateToForms(forms: DQ, namedViewRoot: boolean, viewState: string, namingContainerId = "") {
409
+ this.assignState(forms, $nsp(SEL_VIEWSTATE_ELEM), namedViewRoot, viewState, namingContainerId);
381
410
  }
382
411
 
383
412
 
@@ -386,9 +415,10 @@ export class ResponseProcessor implements IResponseProcessor {
386
415
  *
387
416
  * @param forms the forms to append the viewState to
388
417
  * @param clientWindow the final viewState
418
+ * @param namingContainerId
389
419
  */
390
- private appendClientWindowToForms(forms: DQ, clientWindow: string) {
391
- this.assignState(forms, $nsp(SEL_CLIENT_WINDOW_ELEM), clientWindow);
420
+ private appendClientWindowToForms(forms: DQ, namedViewRoot: boolean, clientWindow: string, namingContainerId = "") {
421
+ this.assignState(forms, $nsp(SEL_CLIENT_WINDOW_ELEM), namedViewRoot, clientWindow, namingContainerId);
392
422
  }
393
423
 
394
424
  /**
@@ -396,31 +426,32 @@ export class ResponseProcessor implements IResponseProcessor {
396
426
  *
397
427
  * @param forms the forms to append or change to
398
428
  * @param selector the selector for the state
429
+ * @param namedViewRoot if set to true, the name is also prefixed
399
430
  * @param state the state itself which needs to be assigned
400
431
  *
432
+ * @param namingContainerId
401
433
  * @private
402
434
  */
403
- private assignState(forms: DQ, selector: string, state: string) {
404
- forms.each((form: DQ) => {
405
- let stateHolders = form.querySelectorAll(selector)
406
- .orElseLazy(() => ResponseProcessor.newViewStateElement(form));
407
-
408
- stateHolders.attr("value").value = state;
435
+ private assignState(forms: DQ, selector: string, namedViewRoot: boolean, state: string, namingContainerId: string) {
436
+ /**
437
+ * creates the viewState or client window id element
438
+ * @param form
439
+ */
440
+ const createAndAppendHiddenInput = (form: DomQuery) => {
441
+ return new HiddenInputBuilder(selector)
442
+ .withNamingContainerId(namingContainerId)
443
+ .withParent(form)
444
+ .withNamedViewRoot(namedViewRoot)
445
+ .build();
446
+ };
447
+
448
+ forms.each(form => {
449
+ const hiddenInput = form.querySelectorAll(selector)
450
+ .orElseLazy(() => createAndAppendHiddenInput(form));
451
+ hiddenInput.val = state;
409
452
  });
410
453
  }
411
454
 
412
- /**
413
- * Helper to Create a new JSF ViewState Element
414
- *
415
- * @param parent, the parent node to attach the viewState element to
416
- * (usually a form node)
417
- */
418
- private static newViewStateElement(parent: DQ): DQ {
419
- let newViewState = DQ.fromMarkup($nsp(HTML_VIEWSTATE));
420
- newViewState.appendTo(parent);
421
- return newViewState;
422
- }
423
-
424
455
  /**
425
456
  * Stores certain aspects of the dom for later post-processing
426
457
  *
@@ -457,10 +488,10 @@ export class ResponseProcessor implements IResponseProcessor {
457
488
  * @returns if it is a viewState node
458
489
  */
459
490
  private static isViewStateNode(node: XMLQuery): boolean {
460
- let separatorChar = (window?.faces ?? window?.jsf).separatorchar;
491
+ const SEP = $faces().separatorchar;
461
492
  return "undefined" != typeof node?.id?.value && (node?.id?.value == $nsp(P_VIEWSTATE) ||
462
- node?.id?.value?.indexOf([separatorChar, $nsp(P_VIEWSTATE)].join(EMPTY_STR)) != -1 ||
463
- node?.id?.value?.indexOf([$nsp(P_VIEWSTATE), separatorChar].join(EMPTY_STR)) != -1);
493
+ node?.id?.value?.indexOf([SEP, $nsp(P_VIEWSTATE)].join(EMPTY_STR)) != -1 ||
494
+ node?.id?.value?.indexOf([$nsp(P_VIEWSTATE), SEP].join(EMPTY_STR)) != -1);
464
495
  }
465
496
 
466
497
  /**
@@ -470,15 +501,59 @@ export class ResponseProcessor implements IResponseProcessor {
470
501
  * @returns true of it ii
471
502
  */
472
503
  private static isClientWindowNode(node: XMLQuery): boolean {
473
- let separatorChar = (window?.faces ?? window?.jsf).separatorchar;
504
+ const SEP = $faces().separatorchar;
474
505
  return "undefined" != typeof node?.id?.value && (node?.id?.value == $nsp(P_CLIENT_WINDOW) ||
475
- node?.id?.value?.indexOf([separatorChar, $nsp(P_CLIENT_WINDOW)].join(EMPTY_STR)) != -1 ||
476
- node?.id?.value?.indexOf([$nsp(P_CLIENT_WINDOW), separatorChar].join(EMPTY_STR)) != -1);
506
+ node?.id?.value?.indexOf([SEP, $nsp(P_CLIENT_WINDOW)].join(EMPTY_STR)) != -1 ||
507
+ node?.id?.value?.indexOf([$nsp(P_CLIENT_WINDOW), SEP].join(EMPTY_STR)) != -1);
477
508
  }
478
509
 
479
510
  private triggerOnError(errorData: ErrorData) {
480
- this.externalContext.getIf(ON_ERROR).orElse(this.internalContext.getIf(ON_ERROR).value).orElse(EMPTY_FUNC).value(errorData);
511
+ this.externalContext.getIf(ON_ERROR).orElseLazy(() => this.internalContext.getIf(ON_ERROR).value).orElse(EMPTY_FUNC).value(errorData);
512
+ }
513
+
514
+ /**
515
+ * filters the forms according to being member of the "execute" or "render" cycle
516
+ * @param affectedForm
517
+ * @private
518
+ */
519
+ private isInExecuteOrRender(affectedForm) {
520
+ const executes = this.externalContext.getIf($nsp(P_EXECUTE)).orElse("@none").value.split(/\s+/gi);
521
+ const renders = this.externalContext.getIf(P_RENDER_OVERRIDE)
522
+ .orElseLazy(() => this.externalContext.getIf($nsp(P_RENDER)).value)
523
+ .orElse(IDENT_NONE).value.split(/\s+/gi);
524
+ const executeAndRenders = executes.concat(...renders);
525
+ return LazyStream.of(...executeAndRenders).filter(nameOrId => {
526
+ if ([IDENT_ALL, IDENT_NONE].indexOf(nameOrId) != -1) {
527
+ return true;
528
+ }
529
+
530
+ const NAME_OR_ID = this.getNameOrIdSelector(nameOrId);
531
+ //either the form directly is in execute or render or one of its children or one of its parents
532
+ return affectedForm.matchesSelector(NAME_OR_ID) ||
533
+ affectedForm.querySelectorAll(NAME_OR_ID).isPresent() ||
534
+ affectedForm.firstParent(NAME_OR_ID).isPresent();
535
+ }).first().isPresent();
481
536
  }
482
537
 
538
+ /**
539
+ * gets all forms under a single naming container id
540
+ * @param namingContainerId
541
+ * @private
542
+ */
543
+ private getContainerForms(namingContainerId: Config) {
544
+ if (namingContainerId.isPresent()) {
545
+ //naming container mode, all forms under naming container id must be processed
546
+ return DQ$(this.getNameOrIdSelector(namingContainerId.value))
547
+ // missing condition if the naming container is not present we have to
548
+ // use the body as fallback
549
+ .orElseLazy(() => DQ.byTagName(HTML_TAG_BODY))
550
+ .byTagName(HTML_TAG_FORM, true);
551
+ } else {
552
+ return DQ.byTagName(HTML_TAG_FORM);
553
+ }
554
+ }
483
555
 
556
+ private getNameOrIdSelector(nameOrId) {
557
+ return `[id='${nameOrId}'], [name='${nameOrId}']`;
558
+ }
484
559
  }