OLD | NEW |
| 1 // Copyright 2016 Google Inc. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
1 // Determine whether focus is in an editable text field. | 5 // Determine whether focus is in an editable text field. |
2 function isEditable(target) { | 6 function isEditable(target) { |
3 // Elements may be explicitly marked as editable. | 7 // Elements may be explicitly marked as editable. |
4 if (target.isContentEditable) | 8 if (target.isContentEditable) |
5 return true; | 9 return true; |
6 | 10 |
7 // Entire documents may be editable. | 11 // Entire documents may be editable. |
8 if (target.ownerDocument.designMode.toLowerCase() === 'on') | 12 if (target.ownerDocument.designMode.toLowerCase() === 'on') |
9 return true; | 13 return true; |
10 | 14 |
(...skipping 26 matching lines...) Expand all Loading... |
37 if (userModify === 'read-write' || | 41 if (userModify === 'read-write' || |
38 userModify === 'write-only' || | 42 userModify === 'write-only' || |
39 userModify === 'read-write-plaintext-only') { | 43 userModify === 'read-write-plaintext-only') { |
40 return true; | 44 return true; |
41 } | 45 } |
42 } | 46 } |
43 target = target.parentNode || null; | 47 target = target.parentNode || null; |
44 } | 48 } |
45 return false; | 49 return false; |
46 } | 50 } |
OLD | NEW |