@@ -14,12 +14,11 @@ HTMLHeadingElement.prototype.setValue = function (value, dispatch) {
14
14
15
15
// TODO: check if using a a switch case will provide better performance
16
16
const setValue = ( el , value , dispatch ) => {
17
+ let bubbles = el . hasAttribute ( "value-bubbles" ) ;
17
18
let valueDispatch = el . hasAttribute ( "value-dispatch" ) ;
18
- if (
19
- ( valueDispatch || valueDispatch === "" ) &&
20
- ( value === "$false" || value === undefined || value === null )
21
- ) {
22
- return dispatchEvents ( el , dispatch ) ;
19
+ if ( valueDispatch || valueDispatch === "" ) {
20
+ if ( value === "$false" || value === undefined || value === null )
21
+ return dispatchEvents ( el , bubbles , dispatch ) ;
23
22
}
24
23
25
24
if ( value === null || value === undefined ) return ;
@@ -102,7 +101,7 @@ const setValue = (el, value, dispatch) => {
102
101
103
102
el . value = value ;
104
103
}
105
- dispatchEvents ( el , dispatch ) ;
104
+ // dispatchEvents(el, bubbles , dispatch);
106
105
} else if ( el . tagName === "IMG" || el . tagName === "SOURCE" ) {
107
106
el . src = value ;
108
107
} else if ( el . tagName === "IFRAME" ) {
@@ -157,11 +156,9 @@ const setValue = (el, value, dispatch) => {
157
156
if ( el . hasAttribute ( "value" ) ) {
158
157
el . setAttribute ( "value" , value ) ;
159
158
}
160
-
161
- dispatchEvents ( el , dispatch ) ;
162
159
}
163
160
164
- if ( el . getAttribute ( "contenteditable" ) ) dispatchEvents ( el , dispatch ) ;
161
+ // if (el.getAttribute("contenteditable")) dispatchEvents(el, bubbles , dispatch);
165
162
166
163
if ( el . tagName == "HEAD" || el . tagName == "BODY" ) {
167
164
el . removeAttribute ( "array" ) ;
@@ -173,6 +170,8 @@ const setValue = (el, value, dispatch) => {
173
170
setScript ( script ) ;
174
171
}
175
172
}
173
+
174
+ dispatchEvents ( el , bubbles , dispatch ) ;
176
175
} ;
177
176
178
177
function setState ( el ) {
@@ -220,9 +219,9 @@ function __decryptPassword(str) {
220
219
return decode_str ;
221
220
}
222
221
223
- function dispatchEvents ( el , skip = true ) {
222
+ function dispatchEvents ( el , bubbles = true , skip = true ) {
224
223
let inputEvent = new CustomEvent ( "input" , {
225
- bubbles : true ,
224
+ bubbles,
226
225
detail : {
227
226
skip
228
227
}
@@ -235,7 +234,7 @@ function dispatchEvents(el, skip = true) {
235
234
el . dispatchEvent ( inputEvent ) ;
236
235
237
236
let changeEvent = new CustomEvent ( "change" , {
238
- bubbles : true ,
237
+ bubbles,
239
238
detail : {
240
239
skip
241
240
}
0 commit comments