| 1 | <!DOCTYPE html> |
|---|
| 2 | <html> |
|---|
| 3 | <head> |
|---|
| 4 | <meta charset="utf-8"> |
|---|
| 5 | <title>Foo foo!</title> |
|---|
| 6 | <style> |
|---|
| 7 | textarea { |
|---|
| 8 | height: 50px; |
|---|
| 9 | display: block; |
|---|
| 10 | } |
|---|
| 11 | </style> |
|---|
| 12 | </head> |
|---|
| 13 | <body> |
|---|
| 14 | <script> |
|---|
| 15 | |
|---|
| 16 | var values = [ 'foo', 'f<o>o', 'f<o>o', 'f&oo', 'f<!--o-->o' ], |
|---|
| 17 | value, |
|---|
| 18 | div = document.createElement( 'div' ), |
|---|
| 19 | textarea; |
|---|
| 20 | |
|---|
| 21 | while ( ( value = values.shift() ) ) { |
|---|
| 22 | div.innerHTML = '<iframe>' + value + '</iframe>'; // Setting innerHTML on iframe throws error on IE8. |
|---|
| 23 | |
|---|
| 24 | textarea = document.createElement( 'textarea' ); |
|---|
| 25 | textarea.value = value + '\n=>\n' + div.firstChild.innerHTML; |
|---|
| 26 | document.body.appendChild( textarea ); |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | </script> |
|---|
| 30 | </body> |
|---|
| 31 | </html> |
|---|