你遇到了什么跨浏览器问题? [英] What Cross-Browser issues have you faced?

查看:83
本文介绍了你遇到了什么跨浏览器问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发多组浏览器时,由于浏览器实施的差异,您在开发过程中遇到了哪些问题?

While developing for multiple sets of browsers, what issues have you faced while development due to differences in browser implementation?

首先列出一些我面临:


  • Firefox中的文本节点只允许4K数据。因此,一个XML Ajax响应被拆分成多个文本子节点,而不是只有一个节点。它在Internet Explorer中很好。对于Firefox,要获取完整的数据,您需要在调用node.firstChild之前使用node.normalize或使用node.textContent,这两个都是Mozilla特定的方法

  • Internet Explorer不替换& nbsp; 或HTML char代码160,需要替换其等价的\\\ 


  • 在Internet Explorer中的document.getElementById将返回一个元素,即使元素名称匹配,也不会传递其在表单提交时的值。

  • 在Internet Explorer中,如果选择框具有未由任何选项表示的值,则Firefox将显示第一个选项。

  • A text node in Firefox allows only 4K data. So an XML Ajax response gets split up into multiple text child nodes instead of only one node. Its fine in Internet Explorer. For Firefox, to get the full data you either need to use node.normalize before you call node.firstChild or use node.textContent, both of which are Mozilla specific methods
  • Internet Explorer does not replace   or HTML char code 160, you need to replace its Unicode equivalent \u00a0
  • In Firefox a dynamically created input field inside a form (created using document.createElement) does not pass its value on form submit.
  • document.getElementById in Internet Explorer will return an element even if the element name matches. Mozilla only returns element if id matches.
  • In Internet Explorer if a select box has a value not represented by any of the options, it will display blank, Firefox displays the first option.

推荐答案

我所遇到的大多数问题是IE,特别是IE6。问题我亲自处理,留下了难忘的印象(没有特定的顺序):

Most of the problems I have are with IE, specifically IE6. Problems I personally deal with that have left a memorable impression (in no particular order):


  • 不得不使用框架做基本事情,因为每个浏览器实现DOM有点不同。这对于IE和AJAX来说尤其令人沮丧,它需要多个if块才能启动调用。在理想的世界里,我可以在没有框架的情况下使用JavaScript来做基本的事情。

  • Having to use frameworks to do basic things because each browser implements the DOM a little differently. This is especially heinous with IE and AJAX, which necessitates multiple if-blocks just to get the call started. In an ideal world I'd be able to work in JavaScript without the framework to do basic things.

onChange在IE中的选择被实施错误,之前选择失去焦点(这是不正确的)。这意味着你永远不能使用onChange与选择因为IE,因为只有键盘的用户将被这个实现问题削弱。

onChange on selects in IE are implemented wrong, and fire before the select loses focus (which is incorrect). This means you can never use onChange with selects due to IE, since keyboard-only users will be crippled by this implementation issue.

,但是当使用getElementBy Id ()时,IE按名称抓取元素是一个巨大的痛苦。

You mentioned it in your post, but it's a huge pain when IE grabs an element by name when using getElementById().

(阿拉伯语,希伯来语等),Firefox实现text-align:right;不正确的。如果容器由于某种原因溢出,则文本会对齐到可见容器的右侧,而不是容器本身的右侧(即使它的一部分不可见)。

When in an RTL locale (Arabic, Hebrew, etc.), Firefox implements "text-align: right;" incorrectly. If the container overflows for some reason, the text aligns to the right side of the viewable container, rather than the right side of the container itself (even if it makes part of it invisible).

不同的浏览器在结束数组和对象方面有不同程度的挑剔。例如,Firefox是一个看起来像这样的数组:[item0,item1,]。然而,这个相同的代码将使Opera barf,因为它讨厌尾随逗号IE将使数组成一个三项数组,这是错误的代码肯定,但有动态生成的JavaScript我工作,这是一个巨大的痛苦重写 - 如果这只是工作很好。

Different browsers have differing levels of pickiness with regards to how you end arrays and objects. For example, Firefox is more than okay with an array looking like this: [ item0, item1, ]". However, this same code will make Opera barf because it hates the trailing comma. IE will make the array a three-item array, with the third item undefined! This is bad code for sure, but there's been dynamically generated javascript I've worked on that was a huge pain to rewrite - would've been nice if this just worked.

一切都与IE的 hasLayout 有关。这么多的痛苦已经围绕这个属性,特别是当我不知道它存在的那么多的问题修复通过使用hack添加hasLayout那么许多更多的问题创建的黑客的结果。

Everything having to do with IE's hasLayout. So much awful pain has revolved around this attribute, especially when I didn't know it existed. So many problems fixed by using hacks to add hasLayout. So many more problems created as a result of the hacks.

在IE中浮动很少会按照你希望的方式工作,他们也常常在其他浏览器中烦人,但至少符合一个特定的行为。)

Floats in IE rarely work the way you hope they do. They also tend to be annoying in other browsers, but they at least conform to a particular behavior. ;)

IE添加列表项之间的额外空白使我没有痛苦,因为YUI使用列表来做他们的菜单。 (要完全掌握问题,您必须在IE和另一个浏览器中并排查看此链接。)

IE adding extra white space between list items has caused me no end of pain, since YUI uses lists to make their menus. (To fully grasp the issue, you have to view that link in IE and another browser side by side.)

我有很多问题,在IE中的容器中。其他浏览器听white-space:nowrap好多了。这是一个问题,我的工作的UI有一个可调整大小的边栏;在IE中,如果你调整太大,侧边栏项目将开始包装。

I have lots of issues getting text not to wrap in containers in IE. Other browsers listen to "white-space: nowrap" a lot better. This has been a problem with a UI I worked on that has a resizable sidebar; in IE, the sidebar items will start to wrap if you resize it too much.

在IE6中缺少许多CSS选择器类型意味着你必须class-你的DOM超过必要。例如,缺少+,:hover,:first-child。

The lack of many CSS selector types in IE6 means you have to class-up your DOM more than necessary. For example, the lack of +, :hover, :first-child.

不同的浏览器以不同的方式处理空文本节点。具体来说,当使用Opera遍历DOM时,我在浏览节点的子节点时需要担心空文本节点。这不是一个问题,如果你正在寻找一个特定的项目,但它是如果你编写的代码,期望一个特定的输入和浏览器的方式不同的输入。

Different browsers treat empty text nodes differently. Specifically, when traversing the DOM with Opera, I have to worry about empty text nodes when browsing a node's children. This isn't a problem if you're looking for a particular item, but it is if you're writing code that expects a particular input and the way the browser views that input differs.

在IE6中,当您通过javascript动态生成iframe时,iframe有时不会自动填充其容器(即使宽度和高度设置为max)。我仍然不知道如何解决这个问题,并一直在考虑发布一个问题。

In IE6, when you dynamically generate an iframe via javascript, the iframe sometimes doesn't fill its container automatically (even with width and height set to max). I still don't know how to solve this issue, and have been thinking of posting a question about it.

在IE中,您不能设置溢出CSS上的< tbody>元素。这意味着不可能以简单的方式进行可滚动表(具有具体的< thead>和< tfoot>)。

In IE, you can't set overflow CSS on the <tbody> element. This means that scrollable tables (with a concrete <thead> and <tfoot>) are impossible to make in a simple manner.

我可能会添加更多的这个列表后,因为(对我)最糟糕的部分的Web开发是跨浏览器的问题。此外,我怀疑我会编辑出我可能会添加更多的这个列表后,因为这些问题是无止境的。 :)

I will probably add more to this list later, since (to me) the worst part of web development are cross-browser issues. Also, I doubt I'll ever edit out the "I will probably add more to this list later", since these problems are endless. :)

这篇关于你遇到了什么跨浏览器问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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