Language fixes and applying Robin Berjon comments.
--- a/network-api/index.html Tue Jan 31 18:40:09 2012 +0100
+++ b/network-api/index.html Wed Feb 01 17:05:29 2012 +0100
@@ -38,7 +38,7 @@
<body>
<section id='abstract'>
- The Network Information API provides an interface for Web Applications to
+ The Network Information API provides an interface for web applications to
access the underlying connection information of the device.
</section>
@@ -55,20 +55,20 @@
<section class="informative">
<h2>Introduction</h2>
<p>
- The Network Information API provides an interface enabling Web applications to access the underlying
+ The Network Information API provides an interface enabling web applications to access the underlying
connection information of the device.
</p>
<p>
The following example shows how an image viewer can select a low definition or a high definition image based on the
current connection bandwidth:
- <pre class="example sh_javascript">
+ <pre class="example highlight">
<!DOCTYPE>
<html>
<head>
<title>Poney viewer</title>
</head>
<body>
- <img id='poney' alt="An image showing a poney" title="My precious!"></img>
+ <img id='poney' alt="An image showing a poney" title="My precious!">
<script>
var i = document.getElementById('poney');
@@ -105,7 +105,7 @@
The concepts <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#queue-a-task">
queue a task</a></dfn> and
<dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#fire-a-simple-event">
- fires a simple event</a></dfn> are defined in [[!HTML5]].
+ fire a simple event</a></dfn> are defined in [[!HTML5]].
</p>
<p>
@@ -114,6 +114,18 @@
<dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#event-handler-event-type">
event handler event types</a></dfn> are defined in [[!HTML5]].
</p>
+
+ <p>
+ The concepts of <dfn><a href="http://dev.w3.org/html5/spec/browsers.html#browsing-context">
+ browsing context</a></dfn> and
+ <dfn><a href="http://dev.w3.org/html5/spec/browsers.html#active-document">
+ active document</a></dfn> are defined in [[!HTML5]].
+ </p>
+
+ <p>
+ The concept of document <dfn><a href="http://dev.w3.org/html5/spec/origin-0.html#the-document-s-domain">
+ domain</a></dfn> is defined in [[!HTML5]].
+ </p>
</section>
<section>
@@ -151,9 +163,14 @@
interface Connection : EventTarget' class='idl'>
<dt>readonly attribute double bandwidth</dt>
<dd>
- The attribute SHOULD return an estimation of the current bandwdith in MB/s (Megabytes per seconds) the <a>user agent</a>
- has with the Document's subdomain. It MUST return Infinity if the bandwidth is unknown and it MUST return 0 if the user
- is currently offline.
+ The <a>user agent</a> MUST set the value of the <code>bandwidth</code> attribute to:
+ <ul>
+ <li>0 if the user is currently offline;</li>
+ <li>Infinity if the bandwidth is unknown;</li>
+ <li>an estimation of the current bandwidth in MB/s (Megabytes per seconds) available for communication with the
+ <a>browsing context</a> <a>active document</a>'s <a>domain</a>.
+ </li>
+ </ul>
</dd>
<dt>readonly attribute boolean metered</dt>
<dd>
@@ -168,11 +185,12 @@
Examples of metered connections are mobile connections with a small bandwidth quota or connections with a pay-per use plan.
</div>
<p>
- The attribute SHOULD return true if the connection with the Document's subdomain is <a title='metered'>metered</a> and false otherwise.
- If the implementation is not able to know the status of the connection or if the user is offline, it MUST return false.
+ The <a>user agent</a> MUST set the value of the <code>metered</code> attribute to true if the connection with the
+ <a>browsing context</a> <a>active document</a>'s <a>domain</a> is <a title='metered'>metered</a> and false otherwise.
+ If the implementation is not able to know the status of the connection or if the user is offline, the value MUST be set to false.
</p>
<div class="note">
- If not able to know if a connection is metered, a <a>user agent</a> could ask the user about the status of his current connection.
+ If unnable to know if a connection is metered, a <a>user agent</a> could ask the user about the status of his current connection.
For example, a preference could let the user define if the mobile connection used on the device is metered.
</div>
</dd>
@@ -182,7 +200,7 @@
<p>
When the <code>Connection</code> changes, the <a>user agent</a> MUST <a>queue a task</a> which updates
- the <code>Connection</code> properties and <a>fires a simple event</a> named <code>change</code> at the
+ the <code>Connection</code> properties and <a>fire a simple event</a> named <code>change</code> at the
<code>Connection</code> object.
</p>
@@ -224,7 +242,7 @@
This trivial example writes the connection bandwidth to the console and shows it again each time it is changing:
</p>
<div class="example">
- <pre class="example sh_javascript">
+ <pre class="example highlight">
function show() {
console.log(navigator.connection.bandwidth);
}
@@ -239,7 +257,7 @@
This example shows how an application can prevent automatic polling using the metered attribute:
</p>
<div class="example">
- <pre class="example sh_javascript">
+ <pre class="example highlight">
<!DOCTYPE html>
<html>
<head>
@@ -266,7 +284,7 @@
}, false);
// At load time.
- if (navigator.connection.metered) {
+ if (!navigator.connection.metered) {
gIntervalId = setInterval(poll, 1000);
}
</script>
@@ -282,6 +300,7 @@
<section class='appendix'>
<h2>Acknowledgements</h2>
<p>
+ Special thanks to Robin Berjon for his help.
</p>
</section>
</body>