| OLD | NEW |
| 1 description("Ensure that clicking in the margins around editable divs does not g
rant focus.") | 1 description("Ensure that clicking in the margins around editable divs does not g
rant focus.") |
| 2 | 2 |
| 3 document.body.style.margin = "20px"; | 3 document.body.style.margin = "20px"; |
| 4 | 4 |
| 5 var outerDiv = document.createElement("div"); | 5 var outerDiv = document.createElement("div"); |
| 6 outerDiv.style.cssText = "width: 100px; padding: 100px; background-color: blue;"
; | 6 outerDiv.style.cssText = "width: 100px; padding: 100px; background-color: blue;"
; |
| 7 var innerDiv = document.createElement("div"); | 7 var innerDiv = document.createElement("div"); |
| 8 innerDiv.style.cssText = "height: 100px; border: 1px solid pink; background-colo
r: green;"; | 8 innerDiv.style.cssText = "height: 100px; border: 1px solid pink; background-colo
r: green;"; |
| 9 innerDiv.contentEditable = true; | 9 innerDiv.contentEditable = true; |
| 10 outerDiv.appendChild(innerDiv); | 10 outerDiv.appendChild(innerDiv); |
| 11 document.body.insertBefore(outerDiv, document.body.firstChild); | 11 document.body.insertBefore(outerDiv, document.body.firstChild); |
| 12 | 12 |
| 13 // Mouse events only work after an initial layout | |
| 14 document.body.offsetLeft; | |
| 15 | |
| 16 var lastClickCausedFocus = false; | 13 var lastClickCausedFocus = false; |
| 17 document.documentElement.addEventListener("mouseup", function(e) { | 14 document.documentElement.addEventListener("mouseup", function(e) { |
| 18 var lastClick = e || window.event; | 15 var lastClick = e || window.event; |
| 19 if (lastClickCausedFocus) { | 16 if (lastClickCausedFocus) { |
| 20 testFailed("Click @ " + lastClick.clientX + ", " + lastClick.clientY + "
caused innerdiv to focus!"); | 17 testFailed("Click @ " + lastClick.clientX + ", " + lastClick.clientY + "
caused innerdiv to focus!"); |
| 21 } else { | 18 } else { |
| 22 testPassed("Click @ " + lastClick.clientX + ", " + lastClick.clientY + "
did not cause focus."); | 19 testPassed("Click @ " + lastClick.clientX + ", " + lastClick.clientY + "
did not cause focus."); |
| 23 } | 20 } |
| 24 innerDiv.blur(); | 21 innerDiv.blur(); |
| 25 lastClickCausedFocus = false; | 22 lastClickCausedFocus = false; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 43 | 40 |
| 44 clickAt(70, 270); | 41 clickAt(70, 270); |
| 45 clickAt(170, 270); | 42 clickAt(170, 270); |
| 46 clickAt(270, 270); | 43 clickAt(270, 270); |
| 47 } else { | 44 } else { |
| 48 debug("To test, cick above and to the left of the blue box, then above it, t
hen to the left " + | 45 debug("To test, cick above and to the left of the blue box, then above it, t
hen to the left " + |
| 49 "of it and finally, click in all 8 regions around the green div."); | 46 "of it and finally, click in all 8 regions around the green div."); |
| 50 } | 47 } |
| 51 | 48 |
| 52 var successfullyParsed = true; | 49 var successfullyParsed = true; |
| OLD | NEW |