/library/platform/uiSafari.py
Python | 68 lines | 66 code | 1 blank | 1 comment | 0 complexity | 2eba3e991f21237f73cb139848662865 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
1# FocusImplOld 2class Focus: 3 4 def blur(self, elem): 5 JS(""" 6 elem.firstChild.blur(); 7 """) 8 9 def createFocusable(self): 10 JS(""" 11 var div = $doc.createElement('div'); 12 var input = $doc.createElement('input'); 13 input.type = 'text'; 14 input.style.width = input.style.height = 0; 15 input.style.zIndex = -1; 16 input.style.position = 'absolute'; 17 18 input.addEventListener( 19 'blur', 20 function(evt) { if (this.parentNode.onblur) this.parentNode.onblur(evt); }, 21 false); 22 23 input.addEventListener( 24 'focus', 25 function(evt) { if (this.parentNode.onfocus) this.parentNode.onfocus(evt); }, 26 false); 27 28 div.addEventListener( 29 'mousedown', 30 function(evt) { this.firstChild.focus(); }, 31 false); 32 33 div.appendChild(input); 34 return div; 35 """) 36 37 def focus(self, elem): 38 JS(""" 39 elem.firstChild.focus(); 40 """) 41 42 def getTabIndex(self, elem): 43 JS(""" 44 return elem.firstChild.tabIndex; 45 """) 46 47 def setAccessKey(self, elem, key): 48 JS(""" 49 elem.firstChild.accessKey = key; 50 """) 51 52 def setTabIndex(self, elem, index): 53 JS(""" 54 elem.firstChild.tabIndex = index; 55 """) 56 57 58class FormPanel: 59 def getEncoding(self, form): 60 JS(""" 61 return form.enctype; 62 """) 63 64 def setEncoding(self, form, encoding): 65 JS(""" 66 form.enctype = encoding; 67 """) 68