File tree Expand file tree Collapse file tree 5 files changed +13
-7
lines changed
tests/validator/samples/contenteditable-dynamic Expand file tree Collapse file tree 5 files changed +13
-7
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " svelte " : patch
3
+ ---
4
+
5
+ fix: allow boolean ` contenteditable ` attribute
Original file line number Diff line number Diff line change @@ -371,10 +371,6 @@ const errors = {
371
371
// message:
372
372
// "'contenteditable' attribute is required for textContent, innerHTML and innerText two-way bindings"
373
373
// },
374
- // dynamic_contenteditable_attribute: {
375
- // code: 'dynamic-contenteditable-attribute',
376
- // message: "'contenteditable' attribute cannot be dynamic if element uses two-way binding"
377
- // },
378
374
// textarea_duplicate_value: {
379
375
// code: 'textarea-duplicate-value',
380
376
// message:
Original file line number Diff line number Diff line change @@ -475,7 +475,7 @@ const validation = {
475
475
) ;
476
476
if ( ! contenteditable ) {
477
477
error ( node , 'missing-contenteditable-attribute' ) ;
478
- } else if ( ! is_text_attribute ( contenteditable ) ) {
478
+ } else if ( ! is_text_attribute ( contenteditable ) && contenteditable . value !== true ) {
479
479
error ( contenteditable , 'dynamic-contenteditable-attribute' ) ;
480
480
}
481
481
}
Original file line number Diff line number Diff line change 3
3
"code" : " dynamic-contenteditable-attribute" ,
4
4
"message" : " 'contenteditable' attribute cannot be dynamic if element uses two-way binding" ,
5
5
"start" : {
6
- "line" : 6 ,
6
+ "line" : 11 ,
7
7
"column" : 8
8
8
},
9
9
"end" : {
10
- "line" : 6 ,
10
+ "line" : 11 ,
11
11
"column" : 32
12
12
}
13
13
}
Original file line number Diff line number Diff line change 3
3
4
4
let toggle = false ;
5
5
</script >
6
+ <!-- ok -->
7
+ <editor contenteditable ="true" bind:innerHTML ={name }></editor >
8
+ <editor contenteditable ="" bind:innerHTML ={name }></editor >
9
+ <editor contenteditable bind:innerHTML ={name }></editor >
10
+ <!-- error -->
6
11
<editor contenteditable ={toggle } bind:innerHTML ={name }></editor >
You can’t perform that action at this time.
0 commit comments