File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
test/server-side-rendering/samples/attribute-escaped-quotes Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,8 @@ export function create_ssr_component(fn) {
177
177
178
178
export function add_attribute ( name , value , boolean ) {
179
179
if ( value == null || ( boolean && ! value ) ) return '' ;
180
- return ` ${ name } ${ value === true && boolean_attributes . has ( name ) ? '' : `=${ typeof value === 'string' ? JSON . stringify ( escape ( value ) ) : `"${ value } "` } ` } ` ;
180
+ const assignment = ( boolean && value === true ) ? '' : `="${ escape_attribute_value ( value . toString ( ) ) } "` ;
181
+ return ` ${ name } ${ assignment } ` ;
181
182
}
182
183
183
184
export function add_classes ( classes ) {
Original file line number Diff line number Diff line change 1
1
< div
2
- foo =""></div><script>alert(42)</script> "
3
- > </ div >
2
+ foo =""></div>\<script>alert(42)</script> "
3
+ bar =""></div>\<script>alert(42)</script> "
4
+ > </ div >
Original file line number Diff line number Diff line change 1
1
<script >
2
- export let foo = ' "></div><script>alert(42)</' + ' script>' ;
2
+ export let foo = ' "></div>\\ <script>alert(42)</' + ' script>' ;
3
+ export let bar = { toString : () => ' "></div>\\ <script>alert(42)<\/ script>' };
3
4
</script >
4
5
5
- <div foo ={foo }></div >
6
+ <div foo ={foo } bar ={ bar } ></div >
You can’t perform that action at this time.
0 commit comments