IE8在getStyle后台位置崩溃 [英] IE8 Crash on getStyle background-position

查看:102
本文介绍了IE8在getStyle后台位置崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Internet Explorer 8中发现了一个奇怪的错误。也许有人可以帮助我移动它。

I've found a strange bug in Internet Explorer 8. Maybe someone can help me move around it.

当我尝试抓住元素的背景位置时,使用 background-position-x 除了崩溃的IE8 之外,所有版本的Internet Explorer都工作为例外。

When I try to grab the background position of an element, using background-position-x all versions of Internet Explorer work as excepted except for IE8 that crashes.

当我运行 el.getStyle('background-position')所有浏览器都会给我正确的值,除了从IE(6,7和8)开始返回 undefined

When I run el.getStyle('background-position') all browsers give me the correct values except from IE (6, 7 and 8) that return undefined.

因此我使用 el.getStyle('background-position-x ')适用于所有IE版本。

I therefore use el.getStyle('background-position-x') for all IE versions.

但是,IE8在上面的代码中崩溃。

IE8, however, crashes on the above code.

是否有类似的问题?

推荐答案

感谢大家的帮助。这确实是一个错误,仅适用于以下情况。

Thanks for the help everyone. This really is a bug and works only on the following scenario.


  1. css必须加载到外部样式表上

  2. 元素没有内联样式

修复它的方法,即使是非常脏的,也是添加内联样式到元素。让IE8开心,所有其他浏览器都能正常工作。

The way to fix it, even tough dirty, is to add inline styling to the element. Makes IE8 happy and all other browsers work.

我没有测试,但根据到此票证,FF2也遭受同样的行为。

I did not test but, according to this ticket, FF2 also suffers from the same behavior.

附注:

@marcgg - 我打算回答你的答案,因为它真的没有帮助(并且必然会开始一场火焰战争)但是,所有真相都说,jQuery没有表现出这个问题。即使你可能已经知道,它也不是一个选择! ;)

Side notes:
@marcgg - I was going to downvote your answer as it really is not helpful (and bound to start a flame war) but, all truth said, jQuery does not manifest this problem. Even though, as you probably already knew, it is NOT an option! ;)

@Fabien - IE确实支持 background-position-x 并且缺乏对 background-position W3C批准的建设。

@Fabien - IE does support background-position-x and lacks support for background-position the W3C approved construction.

这篇关于IE8在getStyle后台位置崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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