mirror of
				https://github.com/microsoft/playwright.git
				synced 2025-06-26 21:40:17 +00:00 
			
		
		
		
	fix(snapshot): properly save textarea content (#3835)
This commit is contained in:
		
							parent
							
								
									45542a5334
								
							
						
					
					
						commit
						bf9c4a35f6
					
				| @ -194,9 +194,9 @@ export function takeSnapshotInFrame(guid: string, removeNoScript: boolean): Snap | |||||||
|         builder.push(escapeAttribute(value)); |         builder.push(escapeAttribute(value)); | ||||||
|         builder.push('"'); |         builder.push('"'); | ||||||
|       } |       } | ||||||
|       if (nodeName === 'INPUT' || nodeName === 'TEXTAREA') { |       if (nodeName === 'INPUT') { | ||||||
|         builder.push(' value="'); |         builder.push(' value="'); | ||||||
|         builder.push(escapeAttribute((element as HTMLInputElement | HTMLTextAreaElement).value)); |         builder.push(escapeAttribute((element as HTMLInputElement).value)); | ||||||
|         builder.push('"'); |         builder.push('"'); | ||||||
|       } |       } | ||||||
|       if ((element as any).checked) |       if ((element as any).checked) | ||||||
| @ -237,8 +237,12 @@ export function takeSnapshotInFrame(guid: string, removeNoScript: boolean): Snap | |||||||
|       } |       } | ||||||
|       builder.push('>'); |       builder.push('>'); | ||||||
|     } |     } | ||||||
|  |     if (nodeName === 'TEXTAREA') { | ||||||
|  |       builder.push(escapeText((node as HTMLTextAreaElement).value)); | ||||||
|  |     } else { | ||||||
|       for (let child = node.firstChild; child; child = child.nextSibling) |       for (let child = node.firstChild; child; child = child.nextSibling) | ||||||
|         visit(child, builder); |         visit(child, builder); | ||||||
|  |     } | ||||||
|     if (node.nodeName === 'BODY' && chunks.size) { |     if (node.nodeName === 'BODY' && chunks.size) { | ||||||
|       builder.push('<script>'); |       builder.push('<script>'); | ||||||
|       const shadowChunks = Array.from(chunks).map(([chunkId, html]) => { |       const shadowChunks = Array.from(chunks).map(([chunkId, html]) => { | ||||||
|  | |||||||
| @ -7,11 +7,14 @@ | |||||||
|   } |   } | ||||||
| </style> | </style> | ||||||
| <div>hello, world!</div> | <div>hello, world!</div> | ||||||
|  | <textarea>Before edit</textarea> | ||||||
| <div class=root></div> | <div class=root></div> | ||||||
| <script> | <script> | ||||||
|   let shadow; |   let shadow; | ||||||
| 
 | 
 | ||||||
|   window.addEventListener('DOMContentLoaded', () => { |   window.addEventListener('DOMContentLoaded', () => { | ||||||
|  |     document.querySelector('textarea').value = 'After edit'; | ||||||
|  | 
 | ||||||
|     const root = document.querySelector('.root'); |     const root = document.querySelector('.root'); | ||||||
|     shadow = root.attachShadow({ mode: 'open' }); |     shadow = root.attachShadow({ mode: 'open' }); | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Dmitry Gozman
						Dmitry Gozman