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

86 lines
1.8 KiB

/* generated by Svelte vX.Y.Z */
import { SvelteComponent as SvelteComponent_1, append, createElement, detachNode, flush, init, insert, noop, safe_not_equal } from "svelte/internal";
6 years ago
function create_fragment($$, 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;
}
}
}
},
i: noop,
o: noop,
d(detach) {
if (detach) {
detachNode(select);
}
}
};
}
function instance($$self, $$props, $$invalidate) {
let { current } = $$props;
6 years ago
$$self.$set = $$props => {
if ('current' in $$props) $$invalidate('current', current = $$props.current);
};
return { current };
}
class SvelteComponent extends SvelteComponent_1 {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal);
}
get current() {
return this.$$.ctx.current;
}
set current(current) {
this.$set({ current });
flush();
}
}
export default SvelteComponent;