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

73 lines
1.7 KiB

/* generated by Svelte vX.Y.Z */
import { append, assign, createElement, createText, detachNode, init, insert, proto } from "svelte/shared.js";
function create_main_fragment(component, ctx) {
var select, option, text, option_1, text_1, select_value_value;
return {
c() {
select = createElement("select");
option = createElement("option");
text = createText("1");
option_1 = createElement("option");
text_1 = createText("2");
option.__value = "1";
option.value = option.__value;
option_1.__value = "2";
option_1.value = option_1.__value;
},
m(target, anchor) {
insert(target, select, anchor);
append(select, option);
append(option, text);
append(select, option_1);
append(option_1, text_1);
select_value_value = ctx.current;
for (var i = 0; i < select.options.length; i += 1) {
var option_2 = select.options[i];
if (option_2.__value === select_value_value) {
option_2.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_2 = select.options[i];
if (option_2.__value === select_value_value) {
option_2.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;