diff --git a/documentation/docs/02-template-syntax/08-bindings.md b/documentation/docs/02-template-syntax/08-bindings.md index 73b49cdd0e..0855911599 100644 --- a/documentation/docs/02-template-syntax/08-bindings.md +++ b/documentation/docs/02-template-syntax/08-bindings.md @@ -42,25 +42,30 @@ Numeric input values are coerced; even though `input.value` is a string as far a ``` -On `` elements with `type="file"`, you can use `bind:files` to get the [`FileList` of selected files](https://developer.mozilla.org/en-US/docs/Web/API/FileList). It is readonly. +On `` elements with `type="file"`, you can use `bind:files` to get the [`FileList` of selected files](https://developer.mozilla.org/en-US/docs/Web/API/FileList). When you want to update the files programmatically, you always need to use a `FileList` object. ```svelte + + + ``` -If you're using `bind:` directives together with `on:` directives, the order that they're defined in affects the value of the bound variable when the event handler is called. +If you're using `bind:` directives together with `on` event attributes, the binding will always fire before the event attribute. ```svelte - console.log('Old value:', value)} - bind:value - on:input={() => console.log('New value:', value)} -/> + console.log('New value:', value)} bind:value /> ``` Here we were binding to the value of a text input, which uses the `input` event. Bindings on other elements may use different events such as `change`.