Null and undefined `value` bindings should always be set to an empty string. This allows native browser validation of `required` fields to work as expected with placeholder options.
Placeholder options bound to null are necessary in forms where the field is conditionally required, and the bound value is posted to an API endpoint which requires it to be a nullable number or object rather than a string.
fixes#8312
fixes#6752
---------
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Tan Li Hau <tanhauhau@users.noreply.github.com>
Microdata are a strange set of attributes which are ONLY defined in markup, and have no relationship to the underlying Document Object Model node. As such programmatically defining an element and setting a property on it with a given Microdata attribute will not work:
https://codepen.io/iambrosius/full/jOvXBBG
One can read more about microdata here: https://developer.mozilla.org/en-US/docs/Web/HTML/Microdata
The fix is to remove itemscope being a boolean attribute, because that opts into a transformation as a DOM property, which is wrong.
Fixes#8417
The issue is that unpack_destructuring in each blocks, await blocks, and @const tags were making computed_props independently. This causes computed_props_# to conflict when each blocks were used with @const tags, or await blocks and @const tags, or consecutive @const tags together. Therefore, one solution is to use component.get_unique_name to, well, make unique names and never get conflicts.
- split logic up into "is this a contenteditable element" and depending on the outcome use either .wholeText or .data to check if an update is necessary
- add to puppeteer because jsdom does not support contenteditable
- one test is skipped it because it fails right now but helps test #5018
---------
Co-authored-by: suxin2017 <1107178482@qq.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Closes#3310
---------
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Resolves a second unintended regression introduced in #6170.
Follow-up to #8331, this time addressing the root issue so the correct select option won't be deselected in the first place when the initial bound value is undefined.
Fixes#8361
track all `#each` variables that could result in a change to the inputs and also update the `$$binding_groups` variable which holds the references to the inputs of each group accordingly.
Fixes#7633Fixes#6112Fixes#7884
Closes#4129
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Closes#5085
---------
Co-authored-by: Marcin Wicha <23581770+marcin-wicha@users.noreply.github.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
fixes#8026
1. replace the big entities list with entities that have a ; at the end where valid (there are some exceptions)
2. construct two regexes from that entities list: one for HTML where it's strictly matched, one for attributes where it tries to match browser behavior by also allowing = / digit / character afterwards
3. decode character references with one of these regexes depending on this is an attribute value or not
---------
Co-authored-by: Yuichiro Yamashita <xydybaseball@gmail.com>
Ensure innerHTML for template is done on template element
fixes#7315fixes#7319
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* feat: optimise svelte-element output code for static tag and static attribute
* Update src/compiler/compile/render_dom/wrappers/Element/index.ts
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* Update src/runtime/internal/dom.ts
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* Update src/compiler/compile/render_dom/wrappers/Element/index.ts
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
* fix logic
* fix pipeline errors
---------
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Fixes#7964
currently for a case where the parent type is ArrayPattern code needs to check if the elements are of direct type MemberExpression or Identifier, in the case of MemberExpression there will be an Identifier check for the Object of the MemberExpression.
---------
Co-authored-by: Yuichiro Yamashita <xydybaseball@gmail.com>
Fixes: #7578
When remounting a keyed input element (e.g. because the element order has changed) with spread properties, the input value gets undefined. This has happened because data_value is updated before remounting and it won't contain a value for input-value (because the value hasn't changed). When calling mount() an undefined value was assigned because of a missing check.
fixes#7948
- The assignment of the variable "previous_tag" was incorrectly positioned and could cause race condition when used with transitions.
- We need another variable to detect when we are in a transition to remove a node
---------
Co-authored-by: Yuichiro Yamashita <xydybaseball@gmail.com>
* add inert to attribute_lookup
* typed for preventing a repeat of the tragedy
* add tests
* revert unnecessary change
* add more test
---------
Co-authored-by: fcrozatier <frederic.crozatier@protonmail.com>
By passing an empty object literal as first argument to Object.assign we can avoid having objects spread as props on a component being mutated during SSR.
Fixes#8171
* [fix] static svelte:element not replaced with tag in production mode
* [fix] static svelte:element not replaced with tag in production mode
* add optimization of static <svelte:element> and fix a bug
Co-authored-by: Yuichiro Yamashita <xydybaseball@gmail.com>
* add test
* improve error message if this attribute of <svelte:component> is not SvelteComponent
* add more tests
* improve validation
* simplify test
Co-authored-by: Tan Li Hau <tanhauhau@users.noreply.github.com>