jsf.js_next_gen 4.0.0-beta-13 → 4.0.0-beta-15
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/dist/docs/assets/style.css +34 -2
- package/dist/docs/functions/faces.ajax.addOnError.html +5 -3
- package/dist/docs/functions/faces.ajax.addOnEvent.html +5 -3
- package/dist/docs/functions/faces.ajax.request.html +5 -3
- package/dist/docs/functions/faces.ajax.response.html +5 -3
- package/dist/docs/functions/faces.getClientWindow.html +5 -3
- package/dist/docs/functions/faces.getProjectStage.html +5 -3
- package/dist/docs/functions/faces.getViewState.html +5 -3
- package/dist/docs/functions/faces.push.close.html +5 -3
- package/dist/docs/functions/faces.push.init.html +5 -3
- package/dist/docs/functions/faces.push.open.html +5 -3
- package/dist/docs/functions/faces.util.chain.html +5 -3
- package/dist/docs/functions/myfaces.ab.html +5 -3
- package/dist/docs/index.html +5 -3
- package/dist/docs/modules/faces.ajax.html +5 -3
- package/dist/docs/modules/faces.html +5 -3
- package/dist/docs/modules/faces.push.html +5 -3
- package/dist/docs/modules/faces.util.html +5 -3
- package/dist/docs/modules/myfaces.html +5 -3
- package/dist/docs/modules.html +5 -3
- package/dist/docs/variables/faces.contextpath.html +5 -3
- package/dist/docs/variables/faces.implversion.html +5 -3
- package/dist/docs/variables/faces.separatorchar.html +5 -3
- package/dist/docs/variables/faces.specversion.html +5 -3
- package/dist/docs/variables/myfaces.oam.html +5 -3
- package/dist/window/faces-development.js +23 -19
- package/dist/window/faces-development.js.br +0 -0
- package/dist/window/faces-development.js.gz +0 -0
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.br +0 -0
- package/dist/window/faces.js.gz +0 -0
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +23 -19
- package/dist/window/jsf-development.js.br +0 -0
- package/dist/window/jsf-development.js.gz +0 -0
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +6 -6
|
@@ -62,27 +62,28 @@ var Submittables;
|
|
|
62
62
|
Submittables["CHECKBOX"] = "checkbox";
|
|
63
63
|
})(Submittables || (Submittables = {}));
|
|
64
64
|
/**
|
|
65
|
-
* helper to fix a common problem that a system has to wait until a certain condition is reached
|
|
66
|
-
*
|
|
67
|
-
* @param root the root
|
|
68
|
-
* @param condition the condition lambda to be
|
|
65
|
+
* helper to fix a common problem that a system has to wait, until a certain condition is reached.
|
|
66
|
+
* Depending on the browser this uses either the Mutation Observer or a semi compatible interval as fallback.
|
|
67
|
+
* @param root the root DomQuery element to start from
|
|
68
|
+
* @param condition the condition lambda to be fulfilled
|
|
69
69
|
* @param options options for the search
|
|
70
70
|
*/
|
|
71
71
|
function waitUntilDom(root, condition, options = { attributes: true, childList: true, subtree: true, timeout: 500, interval: 100 }) {
|
|
72
72
|
return new Promise((success, error) => {
|
|
73
|
+
let observer = null;
|
|
73
74
|
const MUT_ERROR = new Error("Mutation observer timeout");
|
|
74
75
|
//we do the same but for now ignore the options on the dom query
|
|
75
76
|
//we cannot use absent here, because the condition might search for an absent element
|
|
76
77
|
function findElement(root, condition) {
|
|
77
78
|
let found = null;
|
|
78
|
-
if (condition(root)) {
|
|
79
|
+
if (!!condition(root)) {
|
|
79
80
|
return root;
|
|
80
81
|
}
|
|
81
82
|
if (options.childList) {
|
|
82
|
-
found = (condition(root)) ? root : root.childNodes.
|
|
83
|
+
found = (condition(root)) ? root : root.childNodes.filter(item => condition(item)).first().value.value;
|
|
83
84
|
}
|
|
84
85
|
else if (options.subtree) {
|
|
85
|
-
found = (condition(root)) ? root : root.querySelectorAll(" * ").
|
|
86
|
+
found = (condition(root)) ? root : root.querySelectorAll(" * ").filter(item => condition(item)).first().value.value;
|
|
86
87
|
}
|
|
87
88
|
else {
|
|
88
89
|
found = (condition(root)) ? root : null;
|
|
@@ -90,22 +91,24 @@ function waitUntilDom(root, condition, options = { attributes: true, childList:
|
|
|
90
91
|
return found;
|
|
91
92
|
}
|
|
92
93
|
let foundElement = root;
|
|
93
|
-
if ((foundElement = findElement(foundElement, condition))
|
|
94
|
+
if (!!(foundElement = findElement(foundElement, condition))) {
|
|
94
95
|
success(new DomQuery(foundElement));
|
|
95
96
|
return;
|
|
96
97
|
}
|
|
97
98
|
if ('undefined' != typeof MutationObserver) {
|
|
98
99
|
const mutTimeout = setTimeout(() => {
|
|
100
|
+
observer.disconnect();
|
|
99
101
|
return error(MUT_ERROR);
|
|
100
102
|
}, options.timeout);
|
|
101
103
|
const callback = (mutationList) => {
|
|
102
|
-
const found = new DomQuery(mutationList.map((mut) => mut.target)).
|
|
103
|
-
if (found) {
|
|
104
|
+
const found = new DomQuery(mutationList.map((mut) => mut.target)).filter(item => condition(item)).first();
|
|
105
|
+
if (found.isPresent()) {
|
|
104
106
|
clearTimeout(mutTimeout);
|
|
105
|
-
|
|
107
|
+
observer.disconnect();
|
|
108
|
+
success(new DomQuery(found || root));
|
|
106
109
|
}
|
|
107
110
|
};
|
|
108
|
-
|
|
111
|
+
observer = new window.MutationObserver(callback);
|
|
109
112
|
// browsers might ignore it, but we cannot break the api in the case
|
|
110
113
|
// hence no timeout is passed
|
|
111
114
|
let observableOpts = Object.assign({}, options);
|
|
@@ -117,13 +120,13 @@ function waitUntilDom(root, condition, options = { attributes: true, childList:
|
|
|
117
120
|
else { //fallback for legacy browsers without mutation observer
|
|
118
121
|
let interval = setInterval(() => {
|
|
119
122
|
let found = findElement(root, condition);
|
|
120
|
-
if (found) {
|
|
123
|
+
if (!!found) {
|
|
121
124
|
if (timeout) {
|
|
122
125
|
clearTimeout(timeout);
|
|
123
126
|
clearInterval(interval);
|
|
124
127
|
interval = null;
|
|
125
|
-
success(found);
|
|
126
128
|
}
|
|
129
|
+
success(new DomQuery(found || root));
|
|
127
130
|
}
|
|
128
131
|
}, options.interval);
|
|
129
132
|
let timeout = setTimeout(() => {
|
|
@@ -1190,13 +1193,13 @@ class DomQuery {
|
|
|
1190
1193
|
* defaults to the standard jsf.js exclusion (we use this code for myfaces)
|
|
1191
1194
|
*/
|
|
1192
1195
|
runScripts(whilteListed = DEFAULT_WHITELIST) {
|
|
1193
|
-
const evalCollectedScripts = (
|
|
1194
|
-
if (
|
|
1196
|
+
const evalCollectedScripts = (scriptsToProcess) => {
|
|
1197
|
+
if (scriptsToProcess.length) {
|
|
1195
1198
|
//script source means we have to eval the existing
|
|
1196
1199
|
//scripts before running the include
|
|
1197
1200
|
//this.globalEval(finalScripts.join("\n"));
|
|
1198
1201
|
let joinedScripts = [];
|
|
1199
|
-
Stream_1.Stream.of(...
|
|
1202
|
+
Stream_1.Stream.of(...scriptsToProcess).each(item => {
|
|
1200
1203
|
if (!item.nonce) {
|
|
1201
1204
|
joinedScripts.push(item.evalText);
|
|
1202
1205
|
}
|
|
@@ -1212,8 +1215,9 @@ class DomQuery {
|
|
|
1212
1215
|
this.globalEval(joinedScripts.join("\n"));
|
|
1213
1216
|
joinedScripts.length = 0;
|
|
1214
1217
|
}
|
|
1215
|
-
|
|
1218
|
+
scriptsToProcess = [];
|
|
1216
1219
|
}
|
|
1220
|
+
return scriptsToProcess;
|
|
1217
1221
|
};
|
|
1218
1222
|
let finalScripts = [], equi = equalsIgnoreCase, execScrpt = (item) => {
|
|
1219
1223
|
var _a, _b, _c;
|
|
@@ -1234,7 +1238,7 @@ class DomQuery {
|
|
|
1234
1238
|
//if jsf.js is already registered we do not replace it anymore
|
|
1235
1239
|
if (whilteListed(src)) {
|
|
1236
1240
|
//we run the collected scripts before running, the include
|
|
1237
|
-
evalCollectedScripts(finalScripts);
|
|
1241
|
+
finalScripts = evalCollectedScripts(finalScripts);
|
|
1238
1242
|
(!!nonce) ? this.loadScriptEval(src, 0, "UTF-8", nonce) :
|
|
1239
1243
|
//if no nonce is set we do not pass any once
|
|
1240
1244
|
this.loadScriptEval(src, 0, "UTF-8");
|
|
Binary file
|
|
Binary file
|