Firefox 3.5 для разработчика
============================

Firefox 3.5 вводит ряд новых возможностей, а также дополнительную и улучшенную поддержку для самых различных веб-стандартов. Данная статья представляет собой исчерпывающий перечень нововведений со ссылками на статьи, освещающие основные усовершенствования.

Новые возможности для разработчиков
-----------------------------------

### Для разработчиков веб-сайтов и веб-приложений

#### Поддержка HTML 5

Использование аудио и видео

В Firefox 3.5 добавлена поддержка элементов HTML 5 `audio` и `video`.

Offline resources in Firefox

Firefox 3.5 now fully supports the HTML 5 offline resource specification.

Drag and drop

The HTML 5 drag and drop API allows support for dragging and dropping items within and between web sites. This also provides a simpler API for use by extensions and Mozilla-based applications.

#### Newly-supported CSS features

Downloadable fonts support

The new `@font-face` @rule lets web pages provide downloadable fonts, so that sites can be rendered exactly as the page author expects.

CSS media queries

Firefox 3.5 now supports CSS media queries, which enhance support for media-dependent style sheets.

`:before` and `:after` updated to CSS 2.1

The `:before` and `:after` pseudo-elements have been updated to full CSS 2.1 support, adding support for the `position`, `float`, `list-style-*`, and some `display` properties.

`ch` units for length

The `ch` unit can now be used anywhere that accepts a unit of length. `1ch` is the width of the "0" (zero) character.

`opacity`

The `-moz-opacity` Mozilla extension to CSS has been removed in favor of the standard `opacity`property.

`text-shadow`

The `text-shadow` property, which allows web content to specify shadow effects to apply to text and text decorations, is now supported.

`word-wrap` (en-US)

This newly-supported property lets content specify whether or not lines may be broken within words in order to prevent overflow when an otherwise unbreakable string is too long to fit on one line.

`white-space` property supports the `pre-line` value

The `white-space` property now accepts the `pre-line` value.

`-moz-box-shadow` (en-US)`-moz-border-image` (en-US)`-moz-column-rule` (en-US)`-moz-column-rule-width` (en-US)`-moz-column-rule-style` (en-US)`-moz-column-rule-color` (en-US)

Firefox 3.5 adds support for these Mozilla extensions to CSS.

The `-moz-nativehyperlinktext` color value

This new color value represents the user's system's default hyperlink color.

The `-moz-window-shadow` property and the `:-moz-system-metric(mac-graphite-theme)` pseudo-class

These new CSS features were added to facilitate theming.

New values for `-moz-appearance` (en-US)

The `-moz-win-glass` and `-moz-mac-unified-toolbar` values have been added to `-moz-appearance`.

Using CSS transforms

Firefox 3.5 supports CSS transforms. See `-moz-transform` (en-US) and `-moz-transform-origin` (en-US) for details.

`:nth-child``:nth-last-child``:nth-of-type``:nth-last-of-type``:first-of-type``:last-of-type``:only-of-type`

These selectors are all newly-supported in Firefox 3.5.

#### Новые возможности DOM

localStorage

Firefox 3.5 adds support for the Web Storage `localStorage` property, which provides a way for web applications to store data locally on the client's computer.

Using web workers

Firefox 3.5 supports web workers to allow easy multi-threading support in web applications.

Using geolocation

Firefox 3.5 supports the Geolocation API, which allows web applications to obtain information about the user's current location if a provider for that information is installed and enabled.

Locating DOM elements using selectors

The selectors API allows querying a document to locate the elements that match a given selection rule.

Mouse gesture events

Firefox 3.5 supports mouse gesture events such as trackpad swipes.

The `NodeIterator` object

The `NodeIterator` object provides support for iterating over the list of the nodes in a DOM subtree.

The MozAfterPaint event

This new DOM event is sent after painting updates in windows.

The MozMousePixelScroll event

This new DOM event allows detection of pixel-based mouse scroll wheel events instead of line-based scroll events.

#### Новые возможности JavaScript

Новое в JavaScript 1.8.1

Обзор всех изменений в JavaScript 1.8.1.

`Object.getPrototypeOf()`

Новый метод, возвращающий прототип указанного объекта.

Использование встроенного JSON

Firefox 3.5 имеет встроенную поддержку JSON.

Новые методы обрезки строк в объекте `String`

Объект `String` теперь имеет методы `trim()`, `trimLeft()` и `trimRight()`.

#### Networking

Cross-site access controls for HTTP

In Firefox 3.5, it's now possible for HTTP requests, including those made by `XMLHttpRequest`, to work across domains if the server supports it.

Progress events for`XMLHttpRequest`

Progress events are now offered to enable extensions to monitor the progress of requests.

Improved Synchronous `XMLHttpRequest` support

DOM Timeout and Input Events are now suppressed during a synchronous `XMLHttpRequest`.

Controlling DNS prefetching

Firefox 3.5 provides DNS prefetching, whereby it performs domain name resolution ahead of time for links included in the current page, in order to save time when links are actually clicked. This article describes how you can tune your web site to disable prefetching, or to adjust how prefetching operates.

#### New Canvas features

HTML 5 text API for `canvas` elements

Canvas elements now support the HTML 5 text API.

Shadow effects in a `canvas`

Canvas shadow effects are now supported.

`createImageData()`

The canvas method `createImageData()` is now supported, allowing code to specifically create an `ImageData` object instead of requiring it to be done automatically. This can improve performance of other `ImageData` methods by preventing them from having to create the object.

`moz-opaque` attribute

Added the `moz-opaque` DOM attribute, which lets the canvas know whether or not translucency will be a factor. If the canvas knows there's no translucency, painting performance can be optimized.

#### New SVG features

Applying SVG effects to HTML content

You can now apply SVG effects to HTML and XHTML content; this article describes how.

#### Miscellaneous new features

ICC color correction in Firefox

Firefox 3.5 now supports ICC color correction for tagged images.

The `defer` attribute is now supported on `script` elements

This attribute indicates to the browser that it *may* choose to continue to parse and render the page without waiting for the script to finish executing.

### Другие улучшения

* The Text node's `wholeText` property and `replaceWholeText()` method have been implemented.
* The property `element.children` has been added. It returns a *collection* of child elements of the given element.
* The Element Traversal API is now supported by the DOM Element object.
* HTML document nodes may now be cloned using `cloneNode()`.
* The non-standard `getBoxObjectFor()` DOM method has been removed. You should be using `getBoundingClientRect()` instead.
* Dispatched DOM events can now be re-dispatched. This makes Firefox 3.5 pass Acid 3 test 30.
* Improvements have been made to DOM 2 Range handling.
* In non-chrome scope, caught objects in exceptions are now the actual thrown object instead of an XPConnect wrapper containing the thrown object.
* SVG ID references are now live.
* SVG filters now work for `foreignObject`.
* The `GetSVGDocument()` method has been added to `object` and `iframe` elements for compatibility.
* Implicit setting of properties in object and array initializers no longer execute setters in JavaScript. See the blog post Object and array initializers should not invoke setters when evaluated for details.
* The `gDownloadLastDir.path` variable has been renamed to `gDownloadLastDir.file` since it refers to an `nsIFile`, not a path.
* The `gDownloadLastDirPath` variable has been renamed to `gDownloadLastDirFile` since it refers to an `nsIFile`, not a path.
* Starting in Firefox 3.5, you can no longer use `data:` bindings in chrome packages that get `XPCNativeWrapper` automation.
### Для разработчиков дополнений

If you're an extension developer, you should start by reading Updating extensions for Firefox 3.5, which offers a helpful overview of what changes may affect your extension.

#### New components and functionality

Supporting private browsing mode

Firefox 3.5 offers Private Browsing mode, which doesn't record the user's activities. Extensions may support private browsing following the guidelines offered by this article.

Security changes in Firefox 3.5

This article covers security-related changes in Firefox 3.5.

Theme changes in Firefox 3.5

This article covers theme-related changes in Firefox 3.5.

Monitoring WiFi access points

Code with UniversalXPConnect privileges can now monitor the list of available access points, getting information on their SSIDs, MAC addresses, and signal strength. This can be used in tandem with Geolocation to offer WiFi-based location service.

#### Notable changes and improvements

* The XUL `textbox` widget now offers a `search` type, for use as search fields.
* In order to support dragging and dropping tabs between windows, the `browser` widget now has a `swapDocShells()` method.
* Added the `level` attribute to the `panel` element; this specifies whether panels appear on top of other applications, or just on top of the window the panel is contained within.
* Элементы XUL теперь поддерживают свойства `clientHeight`, `clientWidth`, `scrollHeight` и `scrollWidth`.
* Элементы `keyset` теперь имеют атрибут `disabled`.
* В дополнение к этому, элементы `keyset` теперь могут быть удалены с помощью метода узла `removeChild()`.
* `mozIStorageStatement` had the `initialize()` method removed; consumers should use the `createStatement()` method instead to get a new statement object.
* The Storage API now offers support for asynchronous requests.
* The `nsICookie2` interface now exposes the time at which cookies were created in its new `creationTime` attribute.
* Added a flag to `nsIProtocolHandler` (`URI_IS_LOCAL_RESOURCE`) that is checked during chrome registration to make sure a protocol is allowed to be registered.
* Firefox now looks for plugins in `/usr/lib/mozilla/plugins` on Linux, as well as the previously supported locations.
* The plugin API has been updated to include support for private browsing mode; you may now use `NPN_GetValue()` to query the state of private browsing mode using the variable `NPNVprivateModeBool`.
Новые возможности для конечного пользователя
--------------------------------------------

### User experience

Location aware browsing

If you choose, you may allow Firefox 3.5 to share information about your current location with web sites. Firefox 3.5 can use information about the network you're connected to to share your location. Of course, it asks for your permission before doing so, to ensure your privacy.

Open audio and video support

Firefox 3.5 supports embedded video and audio using the open Ogg format, as well as WAV for audio. No plugins, no confusing error messages about needing to install something or other that turns out not to be available on your platform anyway.

Local data storage

Web applications can now use Web Storage's local storage capabilities to store data on your computer. This is great for anything from site preferences to more complex data.

### Безопасность и приватность

Private Browsing

Need to use someone else's computer? Switch on Private Browsing mode and nothing will be recorded about your session, including cookies, history, and any other potentially private information.

Better privacy controls

The Privacy preference pane has been completely redesigned to offer users more control over their private information. Users can choose to retain or discard anything including history information, cookies, downloads, and form field information. In addition, users can specify whether or not to include history and/or bookmarks in the location bar's automated suggestions, so you can keep private web addresses from popping up unexpectedly while typing in the location bar.

### Производительность

Faster JavaScript performance

JavaScript, the "J" in "AJAX," is sped up dramatically in Firefox 3.5 with the new TraceMonkey JavaScript engine. Web applications are much faster than in Firefox 3.

Faster page rendering

Web content draws faster in Firefox 3.5, thanks to technologies such as "speculative parsing." Your users don't need to know what it means, other than "it makes things draw faster."

Смотрите также
--------------

* Firefox 3 для разработчика
* Firefox 2 для разработчика
* Firefox 1.5 для разработчика