Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 function isBoxOfColor(givenColor) | |
| 2 { | |
| 3 return function(e, quiet) | |
| 4 { | |
| 5 var color = window.getComputedStyle(e).backgroundColor; | |
| 6 if (color == givenColor) | |
| 7 return true; | |
| 8 if (!quiet) | |
| 9 testFailed('Box had backgroundColor: ' + color); | |
|
Rick Byers
2014/03/14 17:01:02
seems like it would be a lot more understandable i
| |
| 10 return false; | |
| 11 } | |
| 12 } | |
| 13 | |
| 14 function elementCenter(e) | |
| 15 { | |
| 16 return { | |
| 17 x: e.offsetLeft + e.offsetWidth / 2, | |
| 18 y: e.offsetTop + e.offsetHeight / 2 | |
| 19 } | |
| 20 } | |
| 21 | |
| 22 // Generate methods | |
| 23 window.isBoxDefault = isBoxOfColor("rgb(0, 0, 255)"); | |
| 24 window.isBoxHovered = isBoxOfColor("rgb(255, 0, 0)"); | |
|
Rick Byers
2014/03/14 17:01:02
the name of this function and that below is a litt
| |
| 25 window.isBoxActive = isBoxOfColor("rgb(0, 255, 0)"); | |
| 26 window.isBoxHoveredAndActive = isBoxOfColor("rgb(255, 255, 0)"); | |
| OLD | NEW |