Firefox 19 for developers

  • 版本网址缩略名: Mozilla/Firefox/Releases/19
  • 版本标题: Firefox 19 for developers
  • 版本 id: 407149
  • 创建于:
  • 创建者: ziyunfei
  • 是否是当前版本?
  • 评论

修订内容

{{draft}}

Firefox 19 was released on February 19, 2013. This article lists key changes that are useful not only for web developers, but also Firefox and Gecko developers as well as add-on developers.

Want to help document Firefox 19? See the list of bugs that need to be written about and pitch in!

Web开发者需要注意的变化

JavaScript

  • MapSet 对象的 size() 方法变成了 size 属性. ({{bug("807001")}})
  • MapSet 对象新增了一个 clear() 方法. ({{bug("805003")}})

CSS

  • Support for the viewport-relative {{xref_csslength}} units, vh, vw, vmin, and vmax, has landed ({{bug("503720")}})
  • CSS Flexbox has been unprefixed, but remains disabled by default ({{bug("801098")}}).
  • The -moz-initial value has been unprefixed ({{bug("806068")}}). -moz-initial will be kept for a while as an alias; however, authors are strongly encouraged to switch over to initial.
  • The CSS {{cssxref("text-transform")}} property now supports the full-width keyword, which allows a more seamless inclusion of Latin characters in text using ideographic fixed-width characters, like Chinese or Japanese ({{bug("774560")}}).
  • The CSS {{cssxref("page-break-inside")}} has been implemented ({{bug("685012")}}).
  • The CSS {{cssxref("calc", "calc()")}} function can now be used on <color-stop> (on {{xref_cssgradient}}).
  • The CSS {{cssxref("@page")}} at-rule is now supported ({{bug("115199")}}). Note that the pseudo-classes {{cssxref(":first")}}, {{cssxref(":right")}}, and {{cssxref(":left")}} are not yet implemented.
  • The {{cssxref(":-moz-placeholder")}} pseudo-class is replaced by the {{cssxref("::-moz-placeholder")}} pseudo-element ({{bug("737786")}}).

DOM

  • {{domxref("element.getElementsByTagName")}} 方法开始返回 HTMLCollection 对象,而不是以前的 NodeList 对象. ({{bug("799464")}}).
  • 实现了 {{domxref("File")}} 对象的 mozLastModifiedDate 属性. ({{bug("793955")}})
  • 当 {{domxref("File")}} 对象的最后修改事件无法获取到时,它的 lastModifiedDate 属性会返回当前日期. ({{bug("793459")}}
  • 实现了 {{domxref("CanvasRenderingContext2D")}}对象的 isPointInStroke 方法. ({{bug("803124")}}).
  • 实现了 {{domxref("HTMLCanvasElement")}} 对象的 toBlob 方法 ({{bug("648610")}}).
  • {{domxref("Node.isSupported")}} 和 {{domxref("document.implementation", "document.implementation.hasFeature()")}} 方法会总是放回 true ({{bug("801425")}}).
  • 当调用 document.createElement(null)时, null 会被转换成字符串,就像执行了 document.createElement("null").

XForms

删除了对XForms的支持.

附加组件和Mozilla开发者需要注意的变化

Note: A key change in Firefox 19 is that nsresult is now strongly typed. This will help make it easier to detect bugs that are caused by mishandling of return values, but may cause existing code to break if it's making incorrect assumptions in this regard.

  • getBrowserSelection() now returns the selected text in a text input field. As a result, gContextMenu.isTextSelected will be true when the user selects text in a text input field that is not a password field. ({{bug("565717")}})
  • Dict.jsm: Dict() now takes a JSON String. Dict.toJSON() was added, and it returns a JSON String. ({{bug("727967")}})

接口变化

{{interface("nsIImgLoadingContent")}}
The parameter (aObserver) of addObserver() method changes from {{interface("imgIDecoderObserver")}} to {{interface("imgINotificationObserver")}}. The notify() method of {{interface("imgINotificationObserver")}} is not scriptable, so you need to use createScriptedObserver() from {{interface("imgITools")}}.
{{interface("nsIChannel")}}
The property contentLength changed from long to int64_t.

相关链接

更早版本

{{Firefox_for_developers('18')}}

修订版来源

<div>
  {{draft}}</div>
<p>Firefox 19 was released on February 19, 2013. This article lists key changes that are useful not only&nbsp;for&nbsp;web developers, but also Firefox and Gecko developers as well as add-on developers.</p>
<p>Want to help document Firefox 19? See the <a href="http://beta.elchi3.de/doctracker/#list=fx&amp;version=19.0">list of bugs that need to be written about</a> and pitch in!</p>
<h2 id="Web.E5.BC.80.E5.8F.91.E8.80.85.E9.9C.80.E8.A6.81.E6.B3.A8.E6.84.8F.E7.9A.84.E5.8F.98.E5.8C.96">Web开发者需要注意的变化</h2>
<h3 id="JavaScript">JavaScript</h3>
<ul>
  <li><code><a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Map" title="JavaScript/Reference/Global_Objects/Map">Map</a></code> 和 <code><a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Set" title="JavaScript/Reference/Global_Objects/Set">Set</a></code> 对象的 <code>size()</code> 方法变成了 <code>size</code> 属性. ({{bug("807001")}})</li>
  <li><code><a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Map" title="JavaScript/Reference/Global_Objects/Map">Map</a></code> 和 <code><a href="/zh-CN/docs/JavaScript/Reference/Global_Objects/Set" title="JavaScript/Reference/Global_Objects/Set">Set</a></code> 对象新增了一个 clear() 方法. ({{bug("805003")}})</li>
</ul>
<h3 id="CSS">CSS</h3>
<ul>
  <li>Support for the viewport-relative {{xref_csslength}} units, <code>vh</code>, <code>vw</code>, <code>vmin</code>, and <code>vmax</code>, has landed ({{bug("503720")}})</li>
  <li>CSS Flexbox has been unprefixed, but remains disabled by default ({{bug("801098")}}).</li>
  <li>The <code>-moz-initial</code> value has been unprefixed ({{bug("806068")}}). <code>-moz-initial</code> will be kept for a while as an alias; however, authors are strongly encouraged to switch over to <code>initial</code>.</li>
  <li>The CSS {{cssxref("text-transform")}} property now supports the <code>full-width</code> keyword, which allows a more seamless inclusion of Latin characters in text using ideographic fixed-width characters, like Chinese or Japanese ({{bug("774560")}}).</li>
  <li>The CSS {{cssxref("page-break-inside")}} has been implemented ({{bug("685012")}}).</li>
  <li>The CSS {{cssxref("calc", "calc()")}} function can now be used on <code>&lt;color-stop&gt;</code> (on {{xref_cssgradient}}).</li>
  <li>The CSS {{cssxref("@page")}} at-rule is now supported ({{bug("115199")}}). Note that the pseudo-classes {{cssxref(":first")}}, {{cssxref(":right")}}, and {{cssxref(":left")}} are not yet implemented.</li>
  <li>The {{cssxref(":-moz-placeholder")}} pseudo-class is replaced by the {{cssxref("::-moz-placeholder")}} pseudo-<em>element</em> ({{bug("737786")}}).</li>
</ul>
<h3 id="DOM">DOM</h3>
<ul>
  <li>{{domxref("element.getElementsByTagName")}} 方法开始返回 <code>HTMLCollection</code> 对象,而不是以前的<code> NodeList 对象</code>. ({{bug("799464")}}).</li>
  <li>实现了 {{domxref("File")}} 对象的 <code>mozLastModifiedDate</code> 属性. ({{bug("793955")}})</li>
  <li>当 {{domxref("File")}} 对象的最后修改事件无法获取到时,它的 lastModifiedDate 属性会返回当前日期. ({{bug("793459")}}</li>
  <li>实现了 {{domxref("CanvasRenderingContext2D")}}对象的 <code>isPointInStroke</code> 方法. ({{bug("803124")}}).</li>
  <li>实现了 {{domxref("HTMLCanvasElement")}} 对象的 <code>toBlob</code> 方法 ({{bug("648610")}}).</li>
  <li>{{domxref("Node.isSupported")}} 和 {{domxref("document.implementation", "document.implementation.hasFeature()")}} 方法会总是放回 <code>true</code> ({{bug("801425")}}).</li>
  <li>当调用 <code>document.createElement(null)时</code>, <code>null</code> 会被转换成字符串,就像执行了 <code>document.createElement("null")</code>.</li>
</ul>
<h3 id="XForms">XForms</h3>
<p><a href="http://www.philipp-wagner.com/blog/2011/07/the-future-of-mozilla-xforms/" title="http://www.philipp-wagner.com/blog/2011/07/the-future-of-mozilla-xforms/"><strong>删除</strong></a>了对<a href="/zh-CN/docs/XForms" title="XForms">XForms</a>的支持.</p>
<h2 id=".E9.99.84.E5.8A.A0.E7.BB.84.E4.BB.B6.E5.92.8CMozilla.E5.BC.80.E5.8F.91.E8.80.85.E9.9C.80.E8.A6.81.E6.B3.A8.E6.84.8F.E7.9A.84.E5.8F.98.E5.8C.96">附加组件和Mozilla开发者需要注意的变化</h2>
<div class="note">
  <p><strong>Note:</strong> A key change in Firefox 19 is that <a href="/zh-CN/docs/XPCOM_API_Reference/nsresult" title="XPCOM_API_Reference/nsresult"><code>nsresult</code></a> is now strongly typed. This will help make it easier to detect bugs that are caused by mishandling of return values, but may cause existing code to break if it's making incorrect assumptions in this regard.</p>
</div>
<ul>
  <li><code>getBrowserSelection()</code> now returns the selected text in a text input field. As a result, <code>gContextMenu.isTextSelected</code> will be <code>true</code> when the user selects text in a text input field that is not a password field. ({{bug("565717")}})</li>
  <li><a href="/zh-CN/docs/Mozilla/JavaScript_code_modules/Dict.jsm" title="Mozilla/JavaScript_code_modules/Dict.jsm">Dict.jsm</a>: <a href="/zh-CN/docs/Mozilla/JavaScript_code_modules/Dict.jsm#Creating_a_dictionary" title="Mozilla/JavaScript_code_modules/Dict.jsm#Creating_a_dictionary"><code>Dict()</code></a> now takes a JSON String. <a href="/zh-CN/docs/Mozilla/JavaScript_code_modules/Dict.jsm#toJSON()" title="Mozilla/JavaScript_code_modules/Dict.jsm#toJSON()"><code>Dict.toJSON()</code></a> was added, and it returns a JSON String. ({{bug("727967")}})</li>
</ul>
<h3 id=".E6.8E.A5.E5.8F.A3.E5.8F.98.E5.8C.96">接口变化</h3>
<dl>
  <dt>
    {{interface("nsIImgLoadingContent")}}</dt>
  <dd>
    The parameter (aObserver) of <code>addObserver()</code> method changes from {{interface("imgIDecoderObserver")}} to {{interface("imgINotificationObserver")}}. The <code>notify()</code> method of {{interface("imgINotificationObserver")}} is not scriptable, so you need to use <code>createScriptedObserver()</code> from {{interface("imgITools")}}.</dd>
  <dt>
    {{interface("nsIChannel")}}</dt>
  <dd>
    The property <code>contentLength</code> changed from <code>long</code> to <code>int64_t</code>.</dd>
</dl>
<h2 id=".E7.9B.B8.E5.85.B3.E9.93.BE.E6.8E.A5">相关链接</h2>
<ul>
  <li><a href="http://www.mozilla.org/zh-CN/firefox/19.0beta/releasenotes/">Firefox&nbsp;19 Beta Release Notes</a></li>
  <li><a href="/zh-CN/docs/Site_Compatibility_for_Firefox_19">Site Compatibility for Firefox 19</a></li>
  <li><a href="https://blog.mozilla.org/addons/2013/02/07/compatibility-for-firefox-19/">Add-on Compatibility for Firefox 19</a></li>
</ul>
<h3 id=".E6.9B.B4.E6.97.A9.E7.89.88.E6.9C.AC">更早版本</h3>
<div>
  {{Firefox_for_developers('18')}}</div>
恢复到这个版本