Site compatibility for Firefox 3 编辑
This page tries to give an overview of the changes between Gecko 1.8 and Gecko 1.9, that could possibly affect websites in their behavior or rendering.
See also Firefox 3 for developers.
Events
Capturing load event listeners
In Gecko 1.8, it was not possible to set capturing load event listeners on images. In Gecko 1.9, this has been fixed by bug 234455. But this can cause problems on websites that incorrectly have their event listeners set to capture the load event. See the discussion in bug 335251. To fix this problem, the problematic page in question should not set a capturing load event listener.
For example, this:
window.addEventListener('load', yourFunction, true);
should be changed into this:
window.addEventListener('load', yourFunction, false);
For an explanation of how event capture works, see DOM Level 2 Event capture
preventBubble has been removed
In Gecko 1.8, the preventBubble
method existed on events to prevent events from bubbling upwards. In Gecko 1.9 this method has been removed. Instead, you should use the standard stopPropagation(), which also works fine in Gecko 1.8. The patch in bug 330494 made this happen. See also bug 105280.
A few other old event APIs are no longer supported
window.captureEvents
, window.releaseEvents
and window.routeEvent
are now considered deprecated since Gecko 1.9.
DOM
WRONG_DOCUMENT_ERR
Nodes from external documents should be cloned using document.importNode()
(or adopted using document.adoptNode()
) before they can be inserted into the current document. For more on the Node.ownerDocument
issues, see the W3C DOM FAQ.
Firefox doesn't currently enforce this rule (it did for a while during the development of Firefox 3, but too many sites break when this rule is enforced). We encourage Web developers to fix their code to follow this rule for improved future compatibility.
Ranges
intersectsNode has been removed
In Gecko 1.8 the function intersectsNode
code be used to test if a node intersected a range. However the return values from this function were confusing and rarely useful and has therefore been removed in Gecko 1.9. Instead use the more precise and standard function compareBoundaryPoints. The patch in bug 358073 removed this function.
See the documentation for intersectsNode for how to use compareBoundaryPoints
instead.
compareNode has been removed
In Gecko 1.8 the function compareNode
code be used to test how a node intersected a range. However the return values from this function were confusing and rarely useful and has therefore been removed in Gecko 1.9. Instead use the more precise and standard function compareBoundaryPoints. The patch in bug 358073 removed this function.
See the documentation for compareNode for how to use compareBoundaryPoints
instead.
HTML
Many bugs in the <object> have been fixed
object
and embed
elements no longer need a type
attribute to render. Changing the src
attribute (of <embed>
) or the data
attribute (of <object>
) via JavaScript now works correctly. The Content-Type header sent by the server (if any) now takes precedence over the type
attribute of an <object>
element as per the HTML specification (this is not the case for embed
).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论