Reputation: 1065
I have a requirement where I need to get the computed/applied css style of a widget. I am using dojo widget. Is there way to identify the styles programmatically?
Upvotes: 0
Views: 223
Reputation: 2037
Use the dom-style module.
I'm assuming you're trying to get styles off the root node of your widget (specify if otherwise):
require(['dojo/dom-style','my/Widget'], function(domStyle, Widget) {
var widgetInstance = new Widget();
var integerWidthInPixels = domStyle.get(widgetInstance.domNode, 'width');
});
There's also the "domStyle.getComputedStyle" function, which despite the name probably isn't what you actually want. Look at the docs.
http://dojotoolkit.org/reference-guide/1.10/dojo/dom-style.html
Upvotes: 1