@schukai/monster 3.47.0 → 3.48.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.
package/package.json
CHANGED
package/source/dom/constants.mjs
CHANGED
|
@@ -59,7 +59,7 @@ export {
|
|
|
59
59
|
ATTRIBUTE_HIDDEN,
|
|
60
60
|
objectUpdaterLinkSymbol,
|
|
61
61
|
customElementUpdaterLinkSymbol,
|
|
62
|
-
|
|
62
|
+
initControlCallbackName,
|
|
63
63
|
ATTRIBUTE_SCRIPT_HOST,
|
|
64
64
|
ATTRIBUTE_OPTION_CALLBACK
|
|
65
65
|
};
|
|
@@ -127,7 +127,7 @@ const ATTRIBUTE_OPTION_CALLBACK = `${ATTRIBUTE_PREFIX}option-callback`;
|
|
|
127
127
|
* @since 3.48.0
|
|
128
128
|
* @type {string}
|
|
129
129
|
*/
|
|
130
|
-
const
|
|
130
|
+
const initControlCallbackName = `initCustomControlCallback`;
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* @memberOf Monster.DOM
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
ATTRIBUTE_OPTIONS_SELECTOR,
|
|
28
28
|
ATTRIBUTE_SCRIPT_HOST,
|
|
29
29
|
customElementUpdaterLinkSymbol,
|
|
30
|
-
|
|
30
|
+
initControlCallbackName
|
|
31
31
|
} from "./constants.mjs";
|
|
32
32
|
import {findDocumentTemplate, Template} from "./template.mjs";
|
|
33
33
|
import {addObjectWithUpdaterToElement} from "./updater.mjs";
|
|
@@ -728,7 +728,7 @@ function callControlCallback(callBackFunctionName, ...args) {
|
|
|
728
728
|
* This Function is called when the element is attached to the DOM.
|
|
729
729
|
*
|
|
730
730
|
* It looks for the attribute `data-monster-option-callback`. Is this attribute is not set, the default callback
|
|
731
|
-
* `
|
|
731
|
+
* `initCustomControlCallback` is called.
|
|
732
732
|
*
|
|
733
733
|
* The callback is searched in this element and in the host element. If the callback is found, it is called with the
|
|
734
734
|
* element as parameter.
|
|
@@ -740,7 +740,7 @@ function callControlCallback(callBackFunctionName, ...args) {
|
|
|
740
740
|
function initFromCallbackHost() {
|
|
741
741
|
const self = this;
|
|
742
742
|
|
|
743
|
-
let callBackFunctionName =
|
|
743
|
+
let callBackFunctionName = initControlCallbackName // default callback
|
|
744
744
|
if (self.hasAttribute(ATTRIBUTE_OPTION_CALLBACK)) {
|
|
745
745
|
callBackFunctionName = self.getAttribute(ATTRIBUTE_OPTION_CALLBACK);
|
|
746
746
|
}
|
package/source/types/version.mjs
CHANGED
|
@@ -102,13 +102,13 @@ describe('DOM', function () {
|
|
|
102
102
|
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
-
it('should found callback
|
|
105
|
+
it('should found callback initCustomControlCallback', function () {
|
|
106
106
|
|
|
107
107
|
let mocks = document.getElementById('mocks');
|
|
108
108
|
mocks.innerHTML = `<div id="call-back-host"></div><div id="container"></div>`;
|
|
109
109
|
|
|
110
110
|
const container = document.getElementById('call-back-host');
|
|
111
|
-
container.
|
|
111
|
+
container.initCustomControlCallback = function (control) {
|
|
112
112
|
control.setOption('test', 1);
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -120,14 +120,14 @@ describe('DOM', function () {
|
|
|
120
120
|
|
|
121
121
|
});
|
|
122
122
|
|
|
123
|
-
it('should found callback
|
|
123
|
+
it('should found callback initCustomControlCallback from self', function () {
|
|
124
124
|
|
|
125
125
|
let mocks = document.getElementById('mocks');
|
|
126
126
|
mocks.innerHTML = `<div id="call-back-host"></div><div id="container"></div>`;
|
|
127
127
|
|
|
128
128
|
let control = document.createElement(randomTagNumber);
|
|
129
129
|
expect(control.getOption('test')).is.eql(0);
|
|
130
|
-
control.
|
|
130
|
+
control.initCustomControlCallback = function (control) {
|
|
131
131
|
control.setOption('test', 2);
|
|
132
132
|
}
|
|
133
133
|
|
package/test/cases/monster.mjs
CHANGED