OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <style> | 3 <style> |
4 div.columns { | 4 div.columns { |
5 width: 200px; | 5 width: 200px; |
6 -webkit-columns: 2; | 6 -webkit-columns: 2; |
7 -webkit-column-gap: 0; | 7 -webkit-column-gap: 0; |
8 columns: 2; | 8 columns: 2; |
9 column-gap: 0; | 9 column-gap: 0; |
10 column-fill: auto; | 10 column-fill: auto; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 <div class="float" id="f5"> | 65 <div class="float" id="f5"> |
66 and one five line float | 66 and one five line float |
67 </div> | 67 </div> |
68 text runs here next to the float | 68 text runs here next to the float |
69 </div> | 69 </div> |
70 </div> | 70 </div> |
71 <pre id="result"></pre> | 71 <pre id="result"></pre> |
72 <script> | 72 <script> |
73 function floatOffset(float) | 73 function floatOffset(float) |
74 { | 74 { |
75 var range = document.createRange(); | 75 var selection = getSelection(); |
76 range.setStart(float, 0); | 76 selection.collapse(float, 0); |
77 range.setEnd(float, 0); | 77 selection.modify("extend", "forward", "word"); |
78 range.expand("word"); | 78 var rect = selection.getRangeAt(0).getBoundingClientRect(); |
79 var rect = range.getBoundingClientRect(); | |
80 var parentRect = float.parentNode.getBoundingClientRect(); | 79 var parentRect = float.parentNode.getBoundingClientRect(); |
81 return { width: rect.left - parentRect.left, height: rect.top - parentRe
ct.top }; | 80 return { width: rect.left - parentRect.left, height: rect.top - parentRe
ct.top }; |
82 } | 81 } |
83 | 82 |
84 var tests = [ | 83 var tests = [ |
85 ["f1", 0, 45], | 84 ["f1", 0, 45], |
86 ["f2", 0, 45], | 85 ["f2", 0, 45], |
87 ["f3", 0, 45], | 86 ["f3", 0, 45], |
88 ["f4", 0, 55], | 87 ["f4", 0, 55], |
89 ["f5", 0, 15] | 88 ["f5", 0, 15] |
(...skipping 10 matching lines...) Expand all Loading... |
100 failures++ | 99 failures++ |
101 } | 100 } |
102 | 101 |
103 if (window.testRunner) { | 102 if (window.testRunner) { |
104 testRunner.dumpAsText(); | 103 testRunner.dumpAsText(); |
105 document.getElementById("tests").style.display = "none"; | 104 document.getElementById("tests").style.display = "none"; |
106 } | 105 } |
107 | 106 |
108 document.getElementById("result").innerText = failures ? "FAIL: " + failures
+ " cases failed" : "PASS"; | 107 document.getElementById("result").innerText = failures ? "FAIL: " + failures
+ " cases failed" : "PASS"; |
109 </script> | 108 </script> |
OLD | NEW |