我们的志愿者还没有将这篇文章翻译为 中文 (简体)。加入我们帮助完成翻译!
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 returnsundefined
, 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
- The DOM Event method
event.stopImmediatePropagation
has been implemented. - The mouse events
mouseenter
andmouseleave
have been implemented.
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 fordocument.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 ofnode1.isSameNode(node2)
, you can simply 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 eventmozvisibilitychanged
is sent when the state is modified.
Full Screen API
- Support for
document.mozFullScreenEnabled
has been added. - The new
:-moz-full-screen-ancestor
property has been added. This lets you match against elements that are ancestors of an element in full screen mode.
Battery API
- Experimental support for
window.navigator.mozBattery
has been added (can be enabled setting the preferencedom.battery.enabled
totrue
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
- Firefox 10 now supports the
OES_standard_derivatives
extension. - New preferences have been added to help test WebGL code for compatibility with minimally-capable devices on your full development platform.
Web Workers
- The attribute
XMLHttpRequest.responseType
andXMLHttpRequest.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.
- The
IDBIndex.count()
andIDBObjectStore.count()
methods have been added. - The
IDBCursor.advance()
method has been added. - When encountering an unknown optional parameter in
IDBObjectStore.createIndex()
orIDBDatabase.createObjectStore()
, Gecko will not fire an exception anymore, but simply ignore it. - When
IDBTransaction.abort()
is called, all pendingIDBRequest
have theirerrorCode
set toABORT_ERROR
. - The methods
IDBObjectStore.delete()
andIDBCursor.delete()
now set theresult
attribute of the returnedIDBRequest
toundefined
. - The method
IDBDatabase.setVersion()
has been removed as it was removed from the latest spec. The version of the database is given through theIDBFactory.open()
method which has been updated and theonupgradeneeded
callback allows the schema of the database to be upgraded. The version itself has been changed from aDOMString
to anunsigned long long
. TheIDBVersionChangeRequest
interface has been removed and replaced by the newIDBOpenDBRequest
interface. - When opening a database with
IDBFactory.open()
, if theversion
parameter is not provided and the database does not exist, then it will be created with a version of1
. - The method
IDBFactory.deleteDatabase()
method has been added. - Methods that search via an
IDBKeyRange
(such asIDBObjectStore.openCursor
andIDBIndex.getKey
) can accept either a single key or key range.
Other
- When the proper MIME type is passed,
image/svg+xml
, theDOMParser
now creates aSVGDocument
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
andbackface-visibility
properties, as well as for 3D transform functions in thetransform
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 withunicode-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 CSSdirection
property. - The CSS
linear-gradient()
andrepeating-linear-gradient()
properties have been updated to support the newto
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 thetext-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
- The
console
object has two new methods,console.time()
andconsole.timeEnd()
, which can be used to set timers on a page. - The new Page Inspector has been added, providing an excellent way to examine and manipulate the HTML and CSS behind your content.
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 totrue
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 theextensions.strictCompatibility
preference totrue
.
XUL
- Bootstrapped add-ons using a chrome.manifest file now have the manifest file registered automatically. See the section Adding user interface with a chrome.manifest for details.
XPConnect
- Several new properties and methods have been added to
Components.utils
, granting access to assorted debugging-related information.
Interface changes
- The
mozISpellCheckingEngine
andnsIEditorSpellCheck
interfaces have been updated to allow restartless add-ons to add dictionaries to the spell checker. XXX need to update docs on how to actually do this. - The
nsIBrowserHistory.lastPageVisited
attribute has been removed. - The
nsIDocumentViewer
interface has been merged intonsIContentViewer
. - The
nsIURIFixup
interface has a new flag,FIXUP_FLAG_USE_UTF8
, which lets you tell it to use UTF-8 instead of the platform character set, when doing conversions.
Plug-in changes
- The new variable
NPNVdocumentOrigin
has been added; this returns the document origin, and is more secure thanwindow.location
.
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
文档标签和贡献者
标签:
此页面的贡献者:
chrisdavidmills,
fscholz,
Sheppy,
Zefling,
myakura,
johndrinkwater,
AndrewMcElroy,
Marcoos,
teoli,
holloway,
Hsivonen,
One,
dbruant,
darktrojan,
Kohei
最后编辑者:
chrisdavidmills,