You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a low-level internal API change and does not affect most developers.
8
+
::: info 情報
9
+
これは、低レベルの内部 API の変更であり、ほとんどの開発者には影響しません。
10
10
:::
11
11
12
-
## Overview
12
+
## 概要
13
13
14
-
Here is a high level summary of the changes:
14
+
変更点の概要は次のとおりです:
15
15
16
-
-Drop the internal concept of enumerated attributes and treat those attributes the same as normal non-boolean attributes
17
-
-**BREAKING**: No longer removes attribute if the value is boolean `false`. Instead, it's set as attr="false". To remove the attribute, use `null`or`undefined`.
In 2.x, we had the following strategies for coercing `v-bind`values:
23
+
2.x では、`v-bind`の値を強制変換するために、以下のような戦略をとっていました:
24
24
25
-
-For some attribute/element pairs, Vue is always using the corresponding IDL attribute (property): [like `value` of `<input>`, `<select>`, `<progress>`, etc](https://github.com/vuejs/vue/blob/bad3c326a3f8b8e0d3bcf07917dc0adf97c32351/src/platforms/web/util/attrs.js#L11-L18).
-For "[boolean attributes](https://github.com/vuejs/vue/blob/bad3c326a3f8b8e0d3bcf07917dc0adf97c32351/src/platforms/web/util/attrs.js#L33-L40)" and [xlinks](https://github.com/vuejs/vue/blob/bad3c326a3f8b8e0d3bcf07917dc0adf97c32351/src/platforms/web/util/attrs.js#L44-L46), Vue removes them if they are "falsy" ([`undefined`, `null` or `false`](https://github.com/vuejs/vue/blob/bad3c326a3f8b8e0d3bcf07917dc0adf97c32351/src/platforms/web/util/attrs.js#L52-L54)) and adds them otherwise (see [here](https://github.com/vuejs/vue/blob/bad3c326a3f8b8e0d3bcf07917dc0adf97c32351/src/platforms/web/runtime/modules/attrs.js#L66-L77) and [here](https://github.com/vuejs/vue/blob/bad3c326a3f8b8e0d3bcf07917dc0adf97c32351/src/platforms/web/runtime/modules/attrs.js#L81-L85)).
-For "[enumerated attributes](https://github.com/vuejs/vue/blob/bad3c326a3f8b8e0d3bcf07917dc0adf97c32351/src/platforms/web/util/attrs.js#L20)" (currently `contenteditable`, `draggable` and `spellcheck`), Vue tries to [coerce](https://github.com/vuejs/vue/blob/bad3c326a3f8b8e0d3bcf07917dc0adf97c32351/src/platforms/web/util/attrs.js#L24-L31) them to string (with special treatment for `contenteditable` for now, to fix [vuejs/vue#9397](https://github.com/vuejs/vue/issues/9397)).
-For other attributes, we remove "falsy" values (`undefined`, `null`, or `false`) and set other values as-is (see [here](https://github.com/vuejs/vue/blob/bad3c326a3f8b8e0d3bcf07917dc0adf97c32351/src/platforms/web/runtime/modules/attrs.js#L92-L113)).
@@ -43,22 +43,22 @@ The following table describes how Vue coerce "enumerated attributes" differently
43
43
|`attr="foo"`|`foo="foo"`|`draggable="true"`|
44
44
|`attr`|`foo=""`|`draggable="true"`|
45
45
46
-
We can see from the table above, current implementation coerces `true`to`'true'`but removes the attribute if it's `false`. This also led to inconsistency and required users to manually coerce boolean values to string in very common use cases like `aria-*`attributes like `aria-selected`, `aria-hidden`, etc.
Coercion for boolean attributes is left untouched.
74
+
真偽値属性の強制変換についてはそのままです。
75
75
76
-
## Migration Strategy
76
+
## 移行手順
77
77
78
-
### Enumerated attributes
78
+
### 列挙型属性
79
79
80
-
The absence of an enumerated attribute and `attr="false"`may produce different IDL attribute values (which will reflect the actual state), described as follows:
Since we no longer coerce`null`to`'false'`for “enumerated properties” in 3.x, in the case of `contenteditable` and `spellcheck`, developers will need to change those `v-bind`expressions that used to resolve to `null` to resolve to `false`or`'false'`in order to maintain the same behavior as 2.x.
In 2.x, invalid values were coerced to `'true'`for enumerated attributes. This was usually unintended and unlikely to be relied upon on a large scale. In 3.x `true`or`'true'`should be explicitly specified.
0 commit comments