You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/js/samples/select-dynamic-value/expected.js

71 lines
1.6 KiB

/* generated by Svelte vX.Y.Z */
import { append, assign, createElement, detachNode, init, insert, proto } from "svelte/shared.js";
function create_main_fragment(component, ctx) {
var select, option0, option1, select_value_value;
return {
c() {
select = createElement("select");
option0 = createElement("option");
option0.textContent = "1";
option1 = createElement("option");
option1.textContent = "2";
option0.__value = "1";
option0.value = option0.__value;
option1.__value = "2";
option1.value = option1.__value;
},
m(target, anchor) {
insert(target, select, anchor);
append(select, option0);
append(select, option1);
select_value_value = ctx.current;
for (var i = 0; i < select.options.length; i += 1) {
var option = select.options[i];
if (option.__value === select_value_value) {
option.selected = true;
break;
}
}
},
p(changed, ctx) {
if ((changed.current) && select_value_value !== (select_value_value = ctx.current)) {
for (var i = 0; i < select.options.length; i += 1) {
var option = select.options[i];
if (option.__value === select_value_value) {
option.selected = true;
break;
}
}
}
},
d(detach) {
if (detach) {
detachNode(select);
}
}
};
}
function SvelteComponent(options) {
init(this, options);
this._state = assign({}, options.data);
this._intro = true;
this._fragment = create_main_fragment(this, this._state);
if (options.target) {
this._fragment.c();
this._mount(options.target, options.anchor);
}
}
assign(SvelteComponent.prototype, proto);
export default SvelteComponent;