在GWT如何知道应用于给定元素的所有样式(通过id或类名) [英] In GWT how to know all the styles applied to a given element (by id or class name)
问题描述
我有以下问题:在我的GWT项目中有一个maincss文件的应用程序,内联css在DOM中的应用程序计算和css文件绑定在一个档案上传到应用程序并动态加载。
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.
现在我需要一个元素
来找到应用哪些CSS规则,三个来源。据我所知,GWT的 getStyle()
函数只返回DOM中的信息。
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.
要实现这一点?
编辑:如果可能,我搜索客户端解决方案(在java或javascript)而不是服务器端解决方案。
Edit : If possible, I search for a client-side solution (in java or javascript) rather than a server-side one.
推荐答案
找到了我的问题的解决方案(事实上两个,但我要第一个):
Found a solution to my problem (in fact two but I'm going for the first) :
- 使用 jQuery的css() in-js> SO问题
- Using jQuery's css() that does what I wanted
- A pure javascript solution in this SO question
我现在只需为jQuery函数写一个JNSI包装器...
I now just have to write a JNSI wrapper for the jQuery function...
编辑:找到第三个解决方案,完全符合我想要的格式: GQuery 这是一个jQuery到GWT的端口,并包含(根据主页)98%的jQuery的核心功能。
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.
这篇关于在GWT如何知道应用于给定元素的所有样式(通过id或类名)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!