2011-06-09 97 views
0

我正在使用gwt創建一個表格,我添加了一些邊框。 FxGWT:解析CSS樣式屬性

DOM.setStyleAttribute(cellElement, "border-left", "solid"); 
DOM.setStyleAttribute(cellElement, "border-right", "double"); 
... 

不同的瀏覽器然後設置非常不同的樣式。特別是邊界財產。這可能是

border-left: solid 1px; 
border-right: double 2px; 

border-style-left: solid; 
border-width-left: 1px; 
border-style-right: double; 
border-width-left: 2px; 

,甚至作爲一個單一的財產

border: solid none double none; 
... 

是在某些方面,這些不同的編寫相同的方式能夠被解析,以便它會更容易找到表格的邊框屬性。喜歡的東西:

border-left: solid; 
border-top: none; 
border-right: double; 
border-bottom: none; 
border-width-left: 1px; 
border-width-top: 1px; 
... 

而且解析應該在客戶端

回答

1

currentStyle/getComputedStyle()做將有助於利用,只要元素已呈現。您需要編寫一個JSNI方法來訪問它,因爲在DOM包中似乎沒有這種API封裝。