1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> |
---|
2 | <html><head> |
---|
3 | <title> getSelection and selected TABLEs </title> |
---|
4 | </head> |
---|
5 | <body> |
---|
6 | |
---|
7 | <p>FAILED (This TC requires JavaScript enabled)</p> |
---|
8 | <iframe></iframe> |
---|
9 | |
---|
10 | <script type="text/javascript"> |
---|
11 | |
---|
12 | var props = [ 'commonAncestorContainer', 'startContainer', 'startOffset', 'endContainer', 'endOffset', 'collapsed' ]; |
---|
13 | |
---|
14 | function test(){ |
---|
15 | var log=document.getElementsByTagName('p')[0].firstChild; |
---|
16 | var doc = document.getElementsByTagName('iframe')[0].contentDocument; |
---|
17 | var win = document.getElementsByTagName('iframe')[0].contentWindow; |
---|
18 | doc.designMode='on'; |
---|
19 | doc.body.innerHTML='<table border="1"><tr><td>this is filler text</td><td>this is filler text</td></tr></table>'; |
---|
20 | log.data='Click on double border of paragraph below. The outer border should turn dashed in Opera or get resize-boxes in Firefox. Then hover this text to see selection properties'; |
---|
21 | log.parentNode.onmouseover=function(){ |
---|
22 | var rng=win.getSelection().getRangeAt(0); |
---|
23 | var str=''; |
---|
24 | for( var i=0,p;p=props[i];i++ ){ |
---|
25 | str+=' '+p+': '+rng[p]; |
---|
26 | } |
---|
27 | log.data=str; |
---|
28 | } |
---|
29 | } |
---|
30 | window.onload=test; |
---|
31 | </script> |
---|
32 | |
---|
33 | </body></html> |
---|