| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 */ | 770 */ |
| 771 function isEnterKey(event) { | 771 function isEnterKey(event) { |
| 772 // Check if in IME. | 772 // Check if in IME. |
| 773 return event.keyCode !== 229 && event.keyIdentifier === "Enter"; | 773 return event.keyCode !== 229 && event.keyIdentifier === "Enter"; |
| 774 } | 774 } |
| 775 | 775 |
| 776 function consumeEvent(e) | 776 function consumeEvent(e) |
| 777 { | 777 { |
| 778 e.consume(); | 778 e.consume(); |
| 779 } | 779 } |
| 780 |
| 781 /** |
| 782 * @param {!function()} callback |
| 783 * @suppressGlobalPropertiesCheck |
| 784 */ |
| 785 function runOnWindowLoad(callback) |
| 786 { |
| 787 /** |
| 788 * @suppressGlobalPropertiesCheck |
| 789 */ |
| 790 function windowLoaded() |
| 791 { |
| 792 window.removeEventListener("DOMContentLoaded", windowLoaded, false); |
| 793 callback(); |
| 794 } |
| 795 |
| 796 if (document.readyState === "complete") |
| 797 callback(); |
| 798 else |
| 799 window.addEventListener("DOMContentLoaded", windowLoaded, false); |
| 800 } |
| OLD | NEW |