jsf.js_next_gen 4.0.0-beta-14 → 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 +17 -14
- 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 +17 -14
- 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 +3 -3
|
@@ -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(() => {
|
|
Binary file
|
|
Binary file
|