简体   繁体   English

jQuery CSS左,上,z-index

[英]jQuery css left, top, z-index

I have a few tests that test if the style params are set properly. 我有一些测试可以测试样式参数是否设置正确。 For some reason, some tests fail in Chrome. 由于某些原因,某些测试在Chrome中失败。 Here are the tests. 这是测试。 element is a jQuery Object by the way. 顺便说一下, element是一个jQuery对象。

    equal(element.css("left"),  "41px", "left is set properly");
    equal(element.css("top"),  "144px", "top is set properly");
    equal(element.css("z-index"),  "2070", "z-index is set properly");

All three of them pass in Firefox but not in Chrome. 他们三个都通过Firefox,但没有通过Chrome。 When I put a breakpoint on the tests and inspect element.css("left") I get "41px". 当我在测试上设置断点并检查element.css("left")我会得到“ 41px”。 But the test still fails showing the following error. 但是测试仍然无法显示以下错误。 Does anybody know why ? 有人知道为什么吗?

在此处输入图片说明

It's a known bug, there is pull request that fixes this issue in jquery git repo https://github.com/jquery/jquery/pull/1241 这是一个已知的错误,在jQuery git repo https://github.com/jquery/jquery/pull/1241中有拉取请求可解决此问题

you can try to clone jquery repo, apply this patch and make custom build 您可以尝试克隆jquery repo,应用此补丁并进行自定义构建

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM