在GWT如何知道应用于给定元素的所有样式(通过id或类名) [英] In GWT how to know all the styles applied to a given element (by id or class name)

查看:497
本文介绍了在GWT如何知道应用于给定元素的所有样式(通过id或类名)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题:在我的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) :


  1. 使用 jQuery的css()
  2. in-js> SO问题
  1. Using jQuery's css() that does what I wanted
  2. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆