In GWT how to know all the styles applied to a given element (by id or class name)

情到浓时终转凉″ 提交于 2019-12-08 05:17:24

问题


I have the following problem : in my GWT project there is a "main" css file for the application, inline css in the DOM that come from the application computation and a css file that is bundled in an archive uploaded to the application and dynamically loaded.

Now I need for an Element to find which CSS rules are applied, coming from either of the three sources. As I understand, GWT's getStyle() function only returns informations that are in the DOM.

What's the simplest way to achieve this ?

Edit : If possible, I search for a client-side solution (in java or javascript) rather than a server-side one.


回答1:


Found a solution to my problem (in fact two but I'm going for the first) :

  1. Using jQuery's css() that does what I wanted
  2. A pure javascript solution in this SO question

I now just have to write a JNSI wrapper for the jQuery function...

Edit : Found a third solution which correspond exactly to what I want : GQuery which is a port of jQuery to GWT and contains (according to the main page) 98% of jQuery's core functionalities.



来源:https://stackoverflow.com/questions/3179478/in-gwt-how-to-know-all-the-styles-applied-to-a-given-element-by-id-or-class-nam

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!