01: /*
02: * MyGWT Widget Library
03: * Copyright(c) 2007, MyGWT.
04: * licensing@mygwt.net
05: *
06: * http://mygwt.net/license
07: */
08: package net.mygwt.ui.client.impl;
09:
10: import com.google.gwt.user.client.Element;
11:
12: public class MyDOMImplIE6 extends MyDOMImpl {
13:
14: public native String getStyle(Element elem, String property) /*-{
15: switch( property ) {
16: case 'opacity' :// IE opacity uses filter
17: var val = 100;
18: try { // will error if no DXImageTransform
19: val = elem.filters['DXImageTransform.Microsoft.Alpha'].opacity;
20:
21: } catch(e) {
22: try { // make sure its in the document
23: val = elem.filters('alpha').opacity;
24: } catch(e) {
25: }
26: }
27: return val / 100;
28: break;
29: default:
30: // test currentStyle before touching
31: var value = elem.currentStyle ? elem.currentStyle[property] : null;
32: return ( elem.style[property] || value || null );
33: }
34: }-*/;
35:
36: public native void setStyle(Element elem, String property,
37: String value) /*-{
38: switch (property) {
39: case 'opacity':
40: if ( typeof elem.style.filter == 'string' ) { // in case not appended
41: elem.style.filter = 'alpha(opacity=' + value * 100 + ')';
42:
43: if (!elem.currentStyle || !elem.currentStyle.hasLayout) {
44: elem.style.zoom = 1; // when no layout or cant tell
45: }
46: }
47: break;
48: default:
49: elem.style[property] = value;
50: }
51: }-*/;
52: }
|