Firefox 10 for developers 编辑

Firefox 10 shipped on January 31, 2012. This article provides information about the new features and key bugs fixed in this release, as well as links to more detailed documentation for both web developers and add-on developers.

Important note: Firefox 10 is the first release of this browser with two digits. This may lead to problem with some UA-sniffing scripts. Be sure to check them, and those contained in 3rd-party software you embed in your pages, like libraries. For more information about this, look at the Firefox goes 2-digit article on hack.mozilla.org.

Changes for Web developers

HTML

  • The new HTML5 <bdi> element, bi-directional isolation, allowing isolation of parts of text with a different directionality has been implemented. This is especially useful when displaying text with an unknown directionality, coming from a database for example, in the middle of text with a known, and potentially, different one.
  • You may now specify a fragment of "top" for the href attribute to create a link to the top of the page. This used to work, then went away for a while, and now it's back, for compatibility with the HTML5 specification. For example: <a href="#top">Return to top of page</a>.

JavaScript

  • The method WeakMap.set() now returns undefined, instead of itself.
  • A bug was introduced in regular expression handling in Firefox 7; this has been fixed. See bug 683838 if you want the gory details.
  • You can no longer use E4X syntax while in ECMAScript 5 strict mode (that is, after "use strict;").

DOM

DOM3 Events

DOM4

  • The attribute document.xmlVersion (which was only gettable and not settable) has been removed as it has been deprecated in the DOM4 specification. The article for document.xmlVersion now suggests a way to detect whether the document is HTML or XML without using that property.
  • The attribute document.xmlStandalone has been removed as it has been deprecated in the DOM4 specification.
  • The attribute document.xmlEncoding has been removed as it has been deprecated in the DOM4 specification.
  • The attribute text.isElementContentWhiteSpace has been removed as it has been deprecated in the DOM4 specification.
  • The method text.replaceWholeText has been removed as it has been deprecated in the DOM4 specification.
  • The method node.isSameNode has been removed as it has been deprecated in the DOM4 specification. Instead of node1.isSameNode(node2), you can use the === operator, like this: node1 ===node2.

Page Visibility API

  • The Page Visibility API has been implemented (prefixed): document.mozHidden, document.mozVisibilityState are available and the event mozvisibilitychanged is sent when the state is modified.

Full Screen API

Battery API

  • Experimental support for window.navigator.mozBattery has been added (can be enabled setting the preference dom.battery.enabled to true and will be enabled by default starting with Firefox 11).

Canvas

  • The createPattern() method now throws an exception if a zero-sized source canvas is specified.
  • If you use a non-finite value for any of the numeric parameters to putImageData(), the call is now silently ignored instead of throwing an exception, in keeping with the specification.

WebGL

Web Workers

  • The attribute XMLHttpRequest.responseType and XMLHttpRequest.response are now available from inside Workers.
  • The Worker() constructor now accepts data URIs.

IndexedDB

Great progress has been made to update IndexedDB to the latest draft specification. This effort will continue in Firefox 11.

Other

  • When the proper MIME type is passed, image/svg+xml, the DOMParser now creates a SVGDocument when given a string with SVG.
  • In the past, when element.setAttribute() parsed integers, it would report an error if the integer included any non-numeric characters (for example "42foo"). Now it correctly truncates this as the number 42, in accordance with the specification.
  • The ESC key no longer incorrectly results in the window.oninput handler incorrectly getting called.
  • The NameList interface is no longer implemented; it previously had an implementation with no way to actually get access to one.
  • The document.createProcessingInstruction() method now works on HTML documents as well as XML documents. ProcessingInstruction nodes are still only supported on XML documents, but since nodes can be moved among documents, it's helpful to be able to create them on HTML documents as well.
  • The XMLHttpRequest responseType "moz-json" introduced in Firefox 9 has been updated to the latest draft of the specification and has been unprefixed. See bug 707142#c13

CSS

  • CSS 3D Transforms are now supported. This includes support for the transform-style, perspective, perspective-origin and backface-visibility properties, as well as for 3D transform functions in the transform and <transform-function> properties. See Using CSS transforms for details.
  • Two new values for the CSS property unicode-bidi have been added: -moz-isolation and -moz-plaintext. The -moz-isolation value isolates, from a directionality point of view, the element from its environment, letting it have a different directionality. An element with unicode-bidi:-moz-isolation behaves like a <bdi> element. The -moz-plaintext indicates the browser to use the Unicode browser heuristic to determine directionality and not the CSS direction property.
  • The CSS linear-gradient() and repeating-linear-gradient() properties have been updated to support the new to syntax and the magic corner algorithm. This allows to give a precise color on the corner of a gradient-filled box.
  • The text-overflow property's handling of cases in which the box overflows on both sides while the text-overflow property is set to overflow on only one has been corrected.
  • Handling of the position property on elements inside positioned <table> elements has been fixed. This change will affect layout of pages; however, we now comply with the CSS specification and with other browsers, so this should be easy to fix.
  • Margin collapsing around <table> elements has been fixed to match the CSS specification. Previously, table elements' margins would not be collapsed along with other adjacent elements, leading to incorrect layout. This change will affect layout of pages; however, we now comply with the CSS specification and with other browsers, so this should be easy to fix.

SVG

  • The <mask> element has been updated to support both sRGB and linearRGB, and now defaults to sRGB, in compliance with the latest revision of the SVG 1.1 specification.

Networking

  • The HTTP Accept-Charset header is no longer sent in HTTP requests. In its absence, servers should respond by sending UTF-8.

Developer tools

Changes for Mozilla and add-on developers

For an overview of likely issues that may arise when updating your add-ons to support Firefox 10, see Updating add-ons for Firefox 10.

Note: The old PRBool data type has been retired! Anywhere in the documentation that refers to it now uses the standard C++ bool type instead. Documentation will be updated in the future, but for now, just keep this in mind.

Manifests

  • Support for <em:strictCompatibility> has been added to the install manifest. It allows add-ons authors to opt in to checking the maximum version of their extension. If set to true the add-on will be disabled if the application version is greater than <em:maxVersion>. Firefox 10 defaults to add-ons being compatible, regardless of their specified maximum version. This flag overrides that preference. You should set this if your add-on does things that are likely to be broken by Firefox updates, but not if your add-on has a binary component, since such add-ons always get strictly checked (remember that binary components must always be recompiled for each major Firefox release).
  • If you wish to revert to the old behavior -- that is, to strict compatibility checking for all add-ons, regardless of the value of the strictCompatibility flag in their manifests, you can set the extensions.strictCompatibility preference to true.

XUL

XPConnect

  • Several new properties and methods have been added to Components.utils, granting access to assorted debugging-related information.

Interface changes

Plug-in changes

Build system changes

  • The --disable-rdf build option, which actually made it impossible to successfully build, has been removed. Work is ongoing on being able to actually remove RDF support entirely, but at present XUL still requires it to function. See bug 559505 for progress on removing the last vestiges of RDF being required.
  • The --disable-smil build option has been removed.

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:132 次

字数:23504

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文