|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import { effect } from '../../../reactivity/effects.js';
|
|
|
|
|
import { effect, teardown } from '../../../reactivity/effects.js';
|
|
|
|
|
import { listen_to_event_and_reset_event } from './shared.js';
|
|
|
|
|
import { is } from '../../../proxy.js';
|
|
|
|
|
import { is_array } from '../../../../shared/utils.js';
|
|
|
|
@ -54,11 +54,9 @@ export function select_option(select, value, mounting) {
|
|
|
|
|
* @param {HTMLSelectElement} select
|
|
|
|
|
*/
|
|
|
|
|
export function init_select(select) {
|
|
|
|
|
queue_micro_task(() => {
|
|
|
|
|
var observer = new MutationObserver(() => {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
var value = select.__value;
|
|
|
|
|
select_option(select, value);
|
|
|
|
|
select_option(select, select.__value);
|
|
|
|
|
// Deliberately don't update the potential binding value,
|
|
|
|
|
// the model should be preserved unless explicitly changed
|
|
|
|
|
});
|
|
|
|
@ -74,9 +72,8 @@ export function init_select(select) {
|
|
|
|
|
attributeFilter: ['value']
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
teardown(() => {
|
|
|
|
|
observer.disconnect();
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -128,7 +125,6 @@ export function bind_select_value(select, get, set = get) {
|
|
|
|
|
mounting = false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// don't pass get_value, we already initialize it in the effect above
|
|
|
|
|
init_select(select);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|