AnAmuser
AnAmuser

Reputation: 1895

GWT: Parse CSS style attribute

I am using gwt to create a table where i add some borders. Fx

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

Different browsers then sets the styling very differently. Especially the border property. It could be

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

or

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

or even as a single property

border: solid none double none;
...

Is the some way that these different ways of writing the same could be parsed, so that it would be easier to find border properties of a table. Something like:

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

And the parsing should be done on the client side

Upvotes: 0

Views: 985

Answers (1)

BobV
BobV

Reputation: 4173

currentStyle / getComputedStyle() will help with that, as long as the element has already been rendered. You'll need to write a JSNI method to access it, since there doesn't appear to be an API wrapper for this in the DOM package.

Upvotes: 1

Related Questions