| 1 | <!DOCTYPE html |
|---|
| 2 | PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|---|
| 3 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|---|
| 5 | <head> |
|---|
| 6 | <title>Firefox selection bug test</title> |
|---|
| 7 | </head> |
|---|
| 8 | <body> |
|---|
| 9 | <input id="hide_frame" type="button" onclick="hideFrame();" value="hide iframe"> |
|---|
| 10 | <input id="editor_selection" type="button" onclick="makeSelection();" value="make selection"> |
|---|
| 11 | <hr /> |
|---|
| 12 | <iframe id="wysiwyg" src="about:blank" onload="onFrameLoad();"></iframe> |
|---|
| 13 | <hr /> |
|---|
| 14 | <h1>Reproducing procedures:</h1> |
|---|
| 15 | <ol> |
|---|
| 16 | <li>After page load, click on "hide iframe" button to shade iframe from page;</li> |
|---|
| 17 | <li>Click on "make selection" button;</li> |
|---|
| 18 | <ul> |
|---|
| 19 | <li>Actual: JavaScript error occurs.</li> |
|---|
| 20 | </ul> |
|---|
| 21 | </ol> |
|---|
| 22 | <script> |
|---|
| 23 | var wysiwyg = document.getElementById("wysiwyg"); |
|---|
| 24 | |
|---|
| 25 | function onFrameLoad( evt ) |
|---|
| 26 | { |
|---|
| 27 | var doc = wysiwyg.contentWindow.document; |
|---|
| 28 | doc.write('<body contenteditable="true">some text</body>'); |
|---|
| 29 | doc.close(); |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | function makeSelection() |
|---|
| 33 | { |
|---|
| 34 | var sel = wysiwyg.contentWindow.getSelection(); |
|---|
| 35 | sel.removeAllRanges(); |
|---|
| 36 | } |
|---|
| 37 | function hideFrame() |
|---|
| 38 | { |
|---|
| 39 | wysiwyg.style.display = 'none'; |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | </script> |
|---|
| 43 | </body> |
|---|
| 44 | </html> |
|---|