| 1 | <!DOCTYPE html> |
|---|
| 2 | <html> |
|---|
| 3 | <head> |
|---|
| 4 | <meta charset="utf-8"> |
|---|
| 5 | <title>Foo</title> |
|---|
| 6 | <style> |
|---|
| 7 | [contenteditable] { |
|---|
| 8 | padding: 5px; |
|---|
| 9 | border: solid 3px orange; |
|---|
| 10 | } |
|---|
| 11 | [contenteditable]:focus { |
|---|
| 12 | outline: solid 3px blue; |
|---|
| 13 | } |
|---|
| 14 | span::after { |
|---|
| 15 | content: '[' attr(class) ']'; |
|---|
| 16 | } |
|---|
| 17 | span { |
|---|
| 18 | background-color: yellow; |
|---|
| 19 | } |
|---|
| 20 | </style> |
|---|
| 21 | </head> |
|---|
| 22 | <body> |
|---|
| 23 | <ul> |
|---|
| 24 | <li>Focus editable element.</li> |
|---|
| 25 | <li>Press end to move caret after the CSS generated "[foo]" text.</li> |
|---|
| 26 | <li>Slowly press left arrow few times. Observe console</li> |
|---|
| 27 | <li>Permission denied error is logged: <code>Error: Permission denied to access property 'nodeType'</code></li> |
|---|
| 28 | </ul> |
|---|
| 29 | <div contenteditable="true"> |
|---|
| 30 | <p><span class="foo">xxx</span><br></p> |
|---|
| 31 | </div> |
|---|
| 32 | |
|---|
| 33 | <script> |
|---|
| 34 | var ed = document.getElementById( 'ed' ); |
|---|
| 35 | setInterval( function() { |
|---|
| 36 | var sel = window.getSelection(); |
|---|
| 37 | console.log( sel.anchorNode.nodeType ); |
|---|
| 38 | }, 1000 ); |
|---|
| 39 | </script> |
|---|
| 40 | </body> |
|---|
| 41 | </html> |
|---|