merge
authorAnssi Kostiainen <anssi.kostiainen@nokia.com>
Sat, 25 Aug 2012 00:52:13 +0300
changeset 202 444a05503706
parent 201 2527383d5cdc (current diff)
parent 192 3ecf12df315d (diff)
child 203 1c5a2f31a18d
merge
api-design/index.html
gallery/index.html
media-stream-capture/scenarios.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,4 @@
+# use glob syntax.
+syntax: glob
+
+.DS_Store
--- a/api-design/index.html	Fri Aug 24 23:36:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-<!DOCTYPE html>
-<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
-  <head>
-    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
-    <title>API Design Best Practices</title>
-    <script class='remove'>
-      var respecConfig = {
-          specStatus: "ED",
-          shortName:  "api-design",
-          editors: [
-                {   name:       "Robin Berjon",
-                    url:        "http://berjon.com/",
-                    company:    "Robineko",
-                    companyURL: "http://robineko.com/" }
-          ],
-          edDraftURI:   "http://w3c-test.org/dap/api-design/",
-          copyrightStart: 2011,
-          noIDLIn:      true,
-          // wg:           "Web Applications (WebApps) Working Group",
-          // wgURI:        "http://www.w3.org/2008/webapps/",
-          // wgPublicList: "public-webapps",
-          // wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/42538/status",
-          wg:           "Device APIs Working Group",
-          wgURI:        "http://www.w3.org/2009/dap/",
-          wgPublicList: "public-device-apis",
-          wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/43696/status",
-      };
-    </script>
-    <script src='http://respec.specifiction.com/js/profiles/w3c-common.js' class='remove'></script>
-  </head>
-  <body>
-    <section id='abstract'>
-      <p>
-        This document captures best practices in designing APIs that fit well into the Web platform as
-        a whole, using WebIDL [[!WEBIDL]].
-      </p>
-    </section>
-    <section id='sotd'>
-      <p>
-        As it currently stands, this document is nothing more than a proposal from its editor, with no
-        backing implied or otherwise from any other party.
-      </p>
-    </section>
-    <section>
-      <h2>Introduction</h2>
-      <p>
-        Over a relatively short period of time the number of different APIs being created for use on the
-        Web has grown at a sustained pace. In working on these interfaces, many in the community discuss
-        the benefits of certain approaches over others and reach agreement as to best practices when
-        facing a given problem.
-      </p>
-      <p>
-        Keeping track of all these gems is however difficult given the volume of work being carried on
-        in parallel and the sometimes disjointed nature of the groups involved. As a result, it can take
-        a long while and many arguments repeated almost identically before a discovered best practice
-        becomes common.
-      </p>
-      <p>
-        The goal of this document is to capture such ideas as they appear and accrete them over time so as
-        to constitute a repository of knowledge on this topic. As a guide it does not however endeavour to
-        supplant editors' brains in making decisions as to how to design their APIs, and consequently one
-        must keep in mind that the reasoning behind a specific recommendation is often more important than
-        its result. Furthermore, in some cases there may not be a single consensual best approach, and 
-        editors will need to understand the tradeoffs involved in order to pick what works for them amongst
-        a set of options.
-      </p>
-    </section>
-    <section>
-      <h2>WebIDL Legacy Features</h2>
-      <p>
-        ...
-      </p>
-    </section>
-    <section>
-      <h2>Exceptions</h2>
-      <p>
-        ...
-      </p>
-    </section>
-    <section>
-      <h2>When to use NoInterfaceObject</h2>
-      <p>
-        ...
-      </p>
-    </section>
-    <section>
-      <h2>Using Dictionaries</h2>
-      <p>
-        ...
-      </p>
-    </section>
-    <section>
-      <h2>Specifying Callbacks</h2>
-      <p>
-        ...
-      </p>
-    </section>
-    <section class='appendix'>
-      <h2>Acknowledgements</h2>
-      <p>
-        Many thanks to Cameron McCormack, Marcos Càceres, and Andreas Gal for their input.
-      </p>
-    </section>
-  </body>
-</html>
--- a/battery/Overview.html	Fri Aug 24 23:36:10 2012 +0300
+++ b/battery/Overview.html	Sat Aug 25 00:52:13 2012 +0300
@@ -6,11 +6,11 @@
     <script src='http://www.w3.org/Tools/respec/respec-w3c-common' class='remove'></script>
     <script class="remove">
       var respecConfig = {
-          specStatus:           "CR",
+          specStatus:           "ED",
           shortName:            "battery-status",
-          publishDate:          "2012-05-08",
-          previousPublishDate:  "2011-11-29",
-          previousMaturity:     "LC",
+          //publishDate:          "2012-05-08",
+          previousPublishDate:  "2012-05-08",
+          previousMaturity:     "CR",
           edDraftURI:           "http://dvcs.w3.org/hg/dap/raw-file/tip/battery/Overview.html",
           // lcEnd:                "2011-12-20",
           crEnd:                "2012-07-01",
@@ -189,9 +189,9 @@
     <section>
       <h2>Terminology</h2>
       <p>
-        The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#function">
-        Function</a></code> interface represents a function in the scripting
-        language being used as defined in [[!HTML5]].
+        The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#eventhandler">
+        EventHandler</a></code> interface represents a callback used for event
+        handlers as defined in [[!HTML5]].
       </p>
       <p>
         The concepts <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#queue-a-task">
@@ -255,22 +255,22 @@
           Represents the current battery level scaled from 0 to 1.0.
         </dd>
         <dt class="no-docs">
-          [TreatNonCallableAsNull] attribute Function? onchargingchange
+          attribute EventHandler onchargingchange
         </dt>
         <dd>
         </dd>
         <dt class="no-docs">
-          [TreatNonCallableAsNull] attribute Function? onchargingtimechange
+          attribute EventHandler onchargingtimechange
         </dt>
         <dd>
         </dd>
         <dt class="no-docs">
-          [TreatNonCallableAsNull] attribute Function? ondischargingtimechange
+          attribute EventHandler ondischargingtimechange
         </dt>
         <dd>
         </dd>
         <dt class="no-docs">
-          [TreatNonCallableAsNull] attribute Function? onlevelchange
+          attribute EventHandler onlevelchange
         </dt>
         <dd>
         </dd>
--- a/contacts/Overview.html	Fri Aug 24 23:36:10 2012 +0300
+++ b/contacts/Overview.html	Sat Aug 25 00:52:13 2012 +0300
@@ -1,213 +1,136 @@
 <!DOCTYPE html>
 <html>
   <head>
-    <title>Contacts API</title>
+    <title>Pick Contacts Intent</title>
     <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
-    <script type="text/javascript" src='http://dev.w3.org/2009/dap/ReSpec.js/js/respec.js' class='remove'></script>
-    <script type="text/javascript" src='http://dev.w3.org/2009/dap/ReSpec.js/js/sh_main.min.js' class='remove'></script>
+    <script type="text/javascript" src='https://www.w3.org/Tools/respec/respec-w3c-common' class='remove' async></script>
     <script type="text/javascript" class='remove'>
-            var respecConfig = {
-                  specStatus: "ED",
-                  shortName: "contacts-api",
-                  editors: [{
-                            name: "Richard Tibbett", 
-                            url: "http://richt.me", 
-                            company: "Opera Software ASA", 
-                            companyURL: "http://www.opera.com"}],
-                  previousPublishDate:  "2011-06-16",
-                  lcEnd:  "2011-07-14",
-                  previousMaturity: "LC",
-                  edDraftURI: "http://w3c-test.org/2009/dap/contacts/",
-                  noIDLIn:  true,
-              };
+        var respecConfig = {
+              specStatus: "ED",
+              shortName: "contacts-api",
+              editors: [{
+                        name: "Richard Tibbett", 
+                        url: "http://richt.me", 
+                        company: "Opera Software ASA", 
+                        companyURL: "http://www.opera.com"},
+                        {name: "Robin Berjon",
+                        url: "http://berjon.com/", 
+                        company: "Robineko", 
+                        companyURL: "http://robineko.com/"}
+                      ],
+              // previousPublishDate:  "2011-06-16",
+              // lcEnd:  "2011-07-14",
+              // previousMaturity: "LC",
+              edDraftURI: "http://w3c-test.org/2009/dap/contacts/",
+              wg:           "Device APIs Working Group",
+              wgURI:        "http://www.w3.org/2009/dap/",
+              wgPublicList: "public-device-apis",
+              wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/43696/status"
+          };
     </script>
-    <script type="text/javascript" src='http://dev.w3.org/2009/dap/common/config.js' class='remove'></script>
-    <style type="text/css">
-      /* ReSpec.js CSS optimizations (Richard Tibbett) */
-      div.example {
-          border-top: 1px solid #ff4500;
-          border-bottom: 1px solid #ff4500;
-          background: #fff;
-          padding:    1em;
-          font-size: 0.9em;
-          margin-top: 1em;
-      }
-      div.example::before {
-          content:    "Example";
-          display:    block;
-          width:      150px;
-          background: #ff4500;
-          color:  #fff;
-          font-family:    initial;
-          padding:    3px;
-          padding-left: 5px;
-          font-weight:    bold;
-          margin: -1em 0 1em -1em;
-      }
-
-      /* Clean up pre.idl */
-      pre.idl::before {
-          font-size:0.9em;
-      }
-
-      /* Add better spacing to sections */
-      section, .section {
-          margin-bottom: 2em;
-      }
-
-      /* Reduce note & issue render size */
-      .note, .issue {
-          font-size:0.8em;
-      }
-
-      /* Add addition spacing to <ol> and <ul> for rule definition */
-      ol.rule li, ul.rule li {
-          padding:0.2em;
-      }
-      /*
-      IDL wrapping fix
-      http://perishablepress.com/press/2010/06/01/wrapping-content/
-
-      [RB] This isn't a fix, it kills indentation!
-
-      pre.idl {
-          white-space: pre;
-          white-space: pre-wrap;
-          white-space: pre-line;
-          white-space: -pre-wrap;
-          white-space: -o-pre-wrap;
-          white-space: -moz-pre-wrap;
-          white-space: -hp-pre-wrap;
-          word-wrap: break-word;
-      }
-      */
-    </style>
   </head>
-
   <body>
     <section id='abstract'>
       <p>
-        The Contacts API defines the high-level interfaces required to obtain read access to a user's unified
-        address book.
-      </p>
-      <p>
-        This API includes the following key interfaces:
+        The Pick Contacts Intent defines a Web Intent [[!WEBINTENTS]] that enables access to a user's
+        address book service from inside a Web application. It defines both an Intent action/type
+        pair that selects this operation, and the format of the contacts data that is returned
+        by services implementing this specification
       </p>
-      <ul>
-        <li>A <a>Contacts</a> interface, which provides the method
-        needed to access a user's unified address book.</li>
-        <li>A <a>Contact</a> interface, which captures the individual
-        contact information that can be returned following a successful read operation.</li>
-      </ul>
     </section>
 
     <section id='sotd'>
       <p>
-        This document represents the early consensus of the group on the scope and features of the proposed
-        Contacts API. Issues and editors note in the document highlight some of the points on which the group is
-        still working and would particularly like to get feedback.
+        This document builds atop previous versions that were pure JavaScript APIs and turns them
+        into an API built using Web Intents, while maintaining the data format which the JavaScript
+        APIs had defined.
       </p>
     </section>
 
     <section class="informative">
       <h2>Introduction</h2>
       <p>
-        Every operating system and a large number of web-based service providers have different ways of
+        Every operating system and a large number of Web-based service providers have different ways of
         representing address book information. Most users are required to maintain a plurality of contact lists
-        which leads to multiple copies of address book data. This in turn
-        often leads to disjoint and inconsistent information being stored across a user's
-        address book providers.
+        which leads to multiple copies of address book data. This in turn often leads to disjoint and inconsistent
+        information being stored across a user's address book providers.
       </p>
       <p>
         When sharing contact data with third parties users are, more often than not, required to hand over access to
         their whole address book. Users are implicitly required to trust third parties with all of their data
         when, in reality, the user may only wish, or need, to share a subset of their address book information so
-        that an application can fulfill its purpose.
+        that an application can fulfil its purpose. When sharing of only a subset of a user's address book is
+        possible, it often requires the user to type the information into a form herself rather than having it
+        extracted from one of her address book services.
       </p>
       <p>
-        This specification defines the concept of a user's unified address book - where address book data may
-        be sourced from a plurality of sources - both online and locally. It then defines the
-        interfaces through which third party applications can access a user's unified address book, with explicit user
-        permission and filtering. The focus of this data sharing is on making the user aware of the data that
-        they will share and putting them at the centre of the data sharing process; free to select both the
-        extent to which they share their address book information and the ability to restrict which pieces of
-        information related to which contact gets shared.
+        This specification enables a Web application to have access to a selected subset of a user's address book,
+        obtained from arbitrary services not known to the Web application. The interactions, brokered using
+        Web Intents [[!WEBINTENTS]] are designed in order to maximise the user's security and privacy.
+        Address book data may be sourced from a plurality of sources — both online and local to the user's device
+        — so long as those sources are registered as Intent services with the user agent. It defines a common
+        format which services use to provide data to Web applications in a consistent and interoperable manner.
+      </p>
+      <p>
+        The expectation is that data sharing happens with explicit user permission and filtering. The focus of 
+        this data sharing is on making the user aware of the data that they will share and putting them at the 
+        centre of the data sharing process; free to select both the extent to which they share their address 
+        book information and the ability to restrict which pieces of information related to which contact gets shared.
       </p>
       <p>
         A set of <a href="#security-and-privacy-considerations">Security and Privacy Considerations</a> are
-        presented for the discretion of both implementers of the Contacts API and recipients of contact
-        information (i.e. web pages). This specification provides a set of non-normative 
+        presented for the discretion of both implementers of Pick Contacts Intent services and recipients of contact
+        information (i.e. Web applications). This specification provides a set of non-normative 
         <a href="#user-interaction-guidelines">User Interaction Guidelines</a> demonstrating an example user experience
         that is compliant with the Security and Privacy Considerations described herein.
       </p>
       <p>
-        This specification also provides informative examples illustrating how to 
-        <a href="#adding-and-updating-contacts">add and update contact information</a>, utilizing existing web platform
-        APIs.
-      </p>
-      <p>
         The following code illustrates how to obtain contact information from a user's address book:
       </p>
-      <pre class="example sh_javascript_dom">
-        function success (contacts) {
-            // do something with resulting contact objects
-            for (var i in contacts) alert(contacts[i].name);
-            // ...
-        }
+      <pre class="example highlight">
+        var intent = new Intent({ action:   "http://webintents.org/pick",
+                                  type:     "http://w3.org/type/contact",
+                                  extras:   { fields: ["displayName", "emails"] }});
+        navigator.startActivity(intent, contactsOK, contactsFail);
 
-        function error (err) {
-            // do something with resulting error
-            alert(err.code);
-            // ...
+        function contactsOK (contacts) {
+            // iterate over the array of contacts to do something useful with them
         }
-
-        // Perform an address book search. Obtain the 'name' and 'emails' properties 
-        // and initially filter the list to Contact records containing 'Bob':
-        navigator.contacts.find(  ['name', 'emails'], success, error, { filter: 'Bob', multiple: true } );
+        function contactsFail (err) {
+            // display an error to the user
+        }
       </pre>
+      <p>
+        When the above code is run, the user would typically be prompted by her user agent to select
+        a service able to pick a contact (there may be several such services, if she has multiple address
+        book sources). Upon selecting a service, she will be presented with an interface enabling her
+        to choose what contact information is returned to the Web application. Upon completing her
+        choice, the contacts data would be returned to the Web application in the <code>contactsOK</code>
+        callback.
+      </p>
     </section>
 
     <section id='conformance'>
       <p>
-        This specification defines conformance criteria that apply to a single product: the 
-        <dfn id="ua">user agent</dfn> that implements the interfaces that it contains.
-      </p>
-      <p>
-        Implementations that use ECMAScript to implement the APIs defined in this specification must implement
-        them in a manner consistent with the ECMAScript Bindings defined in the Web IDL specification
-        [[!WEBIDL]], as this specification uses that specification and terminology.
+        There is only one single conformance requirement placed upon the <dfn>user agent</dfn>
+        product: a <a>user agent</a> MUST support Web Intents [[!WEBINTENTS]].
       </p>
       <p>
-        A conforming implementation is required to implement all fields defined in this specification.
+        The conformance criteria in this specification apply to a single product: the
+        <dfn>contact service</dfn> which exposes a Web Intent service that
+        handles Pick Contact Intents as defined in this specification.
       </p>
-
-      <section>
-        <h2>Terminology</h2>
-        <p>
-          The terms <dfn>document base URL</dfn>, <dfn>browsing context</dfn>, <dfn>event handler attribute</dfn>, 
-          <dfn>event handler event type</dfn>, <dfn>task</dfn>, <dfn>task source</dfn> and <dfn>task queues</dfn> 
-          are defined by the HTML5 specification [[!HTML5]].
-        </p>
-        <p>
-          The <a>task source</a> used by this specification is the <dfn>device task source</dfn>.
-        </p>
-        <p>
-          To <dfn>dispatch a <code>success</code> event</dfn> means that an event with the name
-          <code>success</code>, which does not bubble and is not cancellable, and which uses the
-          <code>Event</code> interface, is to be dispatched at the <a>ContactFindCB</a> object.
-        </p>
-        <p>
-          To <dfn>dispatch an <code>error</code> event</dfn> means that an event with the name
-          <code>error</code>, which does not bubble and is not cancellable, and which uses the <code>Event</code>
-          interface, is to be dispatched at the <a>ContactErrorCB</a> object.
-        </p>
-      </section>
+      <p>
+        The data returned by the <a>contact service</a> is described in this specification using [[!WEBIDL]].
+        When this data is provided using JavaScript, then the <a>contact service</a> MUST do so in a manner
+        consistent with the ECMAScript Bindings defined in the Web IDL specification.
+      </p>
     </section>
 
-    <section>
+    <section class="informative">
       <h2>Security and Privacy Considerations</h2>
       <p>
-        The API defined in this specification can be used to find contact information from a user's address
+        The Intent defined in this specification can be used to find contact information from a user's address
         books. This discloses information related to a user's contacts such as their phone numbers, email
         addresses and other personally identifying information. The distribution of this information could
         potentially compromise the user's privacy, or the user's contacts' privacy. A conforming implementation
@@ -215,36 +138,23 @@
         ensure that no contact information is retrievable without the user's express permission.
       </p>
       <section>
-        <h2>Privacy considerations for implementers of the Contacts API</h2>
+        <h2>Privacy considerations for implementers of the Pick Contacts Intent</h2>
         <p>
-          A <a class="product-ua" href="#ua">user agent</a> should not provide contact information to Web sites without the express
-          permission of the user. A <a>user agent</a> should acquire permission from the user, unless
-          they have prearranged trust relationships with users, as described below. The user interface should
-          include the <a>document base URL</a>. Those permissions that are acquired through the user interface
-          and that are preserved beyond the current browsing session (i.e. beyond the time when the <a>browsing
-          context</a> is navigated to another URL) should be revocable and a <a>user agent</a> should respect permission revocation.
+          A <a>contact service</a> should not provide contact information to Web sites without the express
+          permission of the user. Obtaining the user's express permission to access a set of contacts does 
+          not imply that the user has granted permission for the same Web site to access more contact information.
+          A <a>contact service</a> should take great care to ensure that the user can clearly see which information
+          is about to be shared, and must not share more information than has been requested by the Web application.
         </p>
         <p>
-          Obtaining the user's express permission to access one API method does not imply the user has granted
-          permission for the same Web site to access other methods provided by this API, or to access the same
-          method with a different set of arguments, as part of the same permission context. If a user has
-          expressed permission for an implementation to, e.g. find a set of existing contacts, the implementation
-          should seek the user's express permission if and when any additional <code>find</code> function is called
-          on this API.
-        </p>
-        <p>
-          A <a>user agent</a> may have prearranged trust relationships that do not require such user
-          interfaces. For example, while a Web browser will present a user interface when a Web site performs an
-          address book request, a Widget [[WIDGETS]] runtime may have a prearranged, delegated security
-          relationship with the user and, as such, a suitable alternative security and privacy mechanism with
-          which to authorize the retrieval of contact information.
+          A <a>user agent</a> may have prearranged trust relationships with a specific <a>contact service</a> 
+          that do not require such user interaction.
         </p>
       </section>
-
-      <section class="informative">
+      <section>
         <h2>Privacy considerations for recipients of contact information</h2>
         <p>
-          Web sites operators that retrieve contacts information using this API are denoted as recipients
+          Web sites operators that retrieve contacts information using this Intent are denoted as recipients
           below.
         </p>
         <p>
@@ -254,7 +164,7 @@
         <p>
           Recipients should dispose of contact information once that task is completed, unless expressly
           permitted to retain it by the user. Recipients should also take measures to protect this information
-          against unauthorized access. If contact information is stored, users should be allowed to update and
+          against unauthorised access. If contact information is stored, users should be allowed to update and
           delete this information.
         </p>
         <p>
@@ -264,7 +174,7 @@
         </p>
         <p>
           Recipients should clearly and conspicuously disclose the fact that they are collecting contact data,
-          the purpose for the collection, how long the data is retained, how the data is secured, how the data is
+          the purpose of the collection, how long the data is retained, how the data is secured, how the data is
           shared if it is shared, how users can access, update and delete the data, and any other choices that
           users have with respect to the data. This disclosure should include an explanation of any exceptions to
           the guidelines listed above.
@@ -272,228 +182,156 @@
         <p>
           Note that even if a user gives permission to share their contact information this can have serious
           privacy implications for those parties whose contacts are shared, as they may not wish such sharing to
-          occur. This should be considered by web services when requesting and using such information.
+          occur. This should be considered by Web applications when requesting and using such information.
         </p>
       </section>
-      <section class='informative'>
+      <section>
         <h2>Additional implementation considerations</h2>
         <p>
-          Further to the requirements listed in the previous section, implementers of the Contacts API are
+          Further to the requirements listed in the previous section, implementers of a <a>user agents</a> are
           also advised to consider the following aspects that can negatively affect the privacy of their users:
-          in certain cases, users can inadvertently grant permission to the <a>user agent</a> to disclose their contacts
+          in certain cases, users can inadvertently grant permission to disclose their contacts
           to Web sites. In other cases, the content hosted at a certain URL changes in such a way that the
           previously granted contact permissions no longer apply as far as the user is concerned. Or the users
           might simply change their minds.
         </p>
         <p>
           Predicting or preventing these situations is inherently difficult. Mitigation and in-depth defensive
-          measures are an implementation responsibility and not prescribed by this specification. However, in
-          designing these measures, implementers are advised to enable user awareness of contact sharing, and to
-          provide easy access to interfaces that enable revocation of permissions that web applications have to
-          access this API.
+          measures are a <a>user agent</a>'s responsibility and not prescribed by this specification. However, in
+          designing these measures, implementers are advised to enable user awareness of information sharing, and to
+          provide easy access to user interfaces that enable revocation of permissions that Web applications have to
+          access this Intent.
         </p>
       </section>
     </section>
 
     <section>
-      <h2>API Description</h2>
-
+      <h2>Intent Description</h2>
+      <p>
+        The action for this Intent is <code>http://webintents.org/pick</code>.
+      </p>
+      <p>
+        The type for this Intent is <code>http://w3.org/type/contact</code>.
+      </p>
+      <p>
+        When a <a>contact service</a> is matched for delivery using these action and type, it
+        MUST respond in one of two ways:
+      </p>
+      <ul>
+        <li>
+          If contacts have been successfully selected for delivery, then a successful payload is returned
+          to the client (using <code>postResult()</code>) matching the data format defined below.
+        </li>
+        <li>
+          If an error of any kind takes place in the service, then an error payload is returned (using
+          <code>postFailure()</code>) matching the error data format defined below. The <a>contact service</a>
+          MUST NOT treat the user selecting zero contacts or cancelling the service as error conditions.
+        </li>
+      </ul>
       <section>
-        <h2><a>ServiceContacts</a> interface</h2>
-        <p id="ta-aa" class="product-ua">
-          The <a>ServiceContacts</a> interface is exposed on the <a class="externalDFN">Navigator</a> 
-          object [[NAVIGATOR]]. Its goal is to provide an access point to the functionality in this
-          specification.
-        </p>
-        <dl title='[NoInterfaceObject] interface ServiceContacts' class='idl'>
-          <dt>readonly attribute Contacts contacts</dt>
-          <dd>The object through which the contacts functionality can be accessed.</dd>
-        </dl>
-        <div class='idl' title='Navigator implements ServiceContacts'></div>
-      </section>
-
-      <section>
-        <h2><a>Contacts</a> interface</h2>
+        <h2>Intent Extras</h2>
         <p>
-          The <a>Contacts</a> interface exposes a database of contact information that may be retrieved.
-        </p>
-        <p>
-          Multiple contact groups can be represented within this unified address book by specifying consistent
-          <a href='#widl-Contact-categories'><code>categories</code></a> values as part of individual 
-          <a>Contact</a> objects. Multiple contact groups can be displayed by filtering on the required 
-          <a href='#widl-Contact-categories'><code>categories</code></a> values via
-          the <a>Contacts</a> <a href='#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options'>find()</a> operation.
+          The Pick Contact Intent can be instantiated with an <code>extras</code> field that adheres to the 
+          following dictionary.
         </p>
-
-        <dl title='[NoInterfaceObject] interface Contacts' class='idl'>
-          <dt>void find ()</dt>
-          <dd>
-            <p>
-              Find contacts in the address book according to the <a>find contacts process</a> detailed
-              below.
-            </p>
-            <p>
-              This method takes two, three or four arguments. When called, it  starts the following 
-              <dfn>find contacts process</dfn>:
-            </p>
-            <ol class="rule">
-              <li>
-                Let <var>successCallback</var> be the callback indicated by the method's second argument.
-              </li>
-              <li>
-                Let <var>errorCallback</var> be the callback indicated by the method's third argument, if any, or null otherwise.
-              </li>
-              <li id="ta-ai" class="product-ua">If <var>successCallback</var> is null, then throw a TypeError (as defined in [[WEBIDL]]).</li>
-              <li  class="product-ua" id="ta-ag">
-                If there is a <a>task</a> from the <a>device task source</a> in one of the <a>task
-                queues</a> (e.g. an existing <code>find()</code> operation is still pending a response), run these
-                substeps:
-                <ol>
-                  <li>
-                    If <var>errorCallback</var> is not null, let <var>error</var> be a <a>ContactError</a>
-                    object whose code attribute has the value <code>PENDING_OPERATION_ERROR</code> and
-                    queue a task to invoke <var>errorCallback</var> with <var>error</var> as its argument.
-                  </li>
-                  <li>Abort this operation.</li>
-                </ol>
-              </li>
-              <li>
-                Return, and run the remaining steps asynchronously.
-              </li>
-              <li>
-                Let <var>results</var> be the array of <a>Contact</a> objects obtained by searching contacts in the address book
-                according to the rules defined in  <a href='#contact-search-processing'>Contact Search Processing</a>,
-                or null if the search has failed.
-              </li>
-              <li>
-                If <var>results</var> is null, run these substeps:
-                <ol>
-                  <li>
-                    If <var>errorCallback</var> is not null, let <var>error</var> be a <a>ContactError</a>
-                    object whose code attribute has its value set according to the type of failure that occurred and
-                    queue a task to invoke <var>errorCallback</var> with <var>error</var> as its argument.
-                  </li>
-                  <li>Abort this operation.</li>
-                </ol>
-              </li>
-              <li>Queue a task to invoke <var>successCallback</var> with <var>results</var> as its argument.</li>
-            </ol>
-
-            <dl class='parameters'>
-              <dt>DOMString[] fields</dt>
-              <dd>The <a>search qualifier</a>.</dd>
-              <dt>ContactFindCB successCB</dt>
-              <dd>Function to call when the asynchronous operation completes successfully.</dd>
-              <dt>optional ContactErrorCB errorCB</dt>
-              <dd>Function to call when the asynchronous operation fails.</dd>
-              <dt>optional ContactFindOptions options</dt>
-              <dd>The options to apply to the output of this method.</dd>
-            </dl>
-          </dd>
-        </dl>
+        <section>
+          <h2>The <a>ContactIntentExtras</a> dictionary</h2>
+          <p>
+            The <a>ContactIntentExtras</a> dictionary describes the options that can be applied to contact searching.
+          </p>
+          <dl title='dictionary ContactIntentExtras' class='idl'>
+            <dt>DOMString? search</dt>
+            <dd>
+              A string which provides a hint to the <a>contact service</a> to facilitate contacts selection by the user.
+              The exact manner in which this hint is exploited is entirely up to the <a>contact service</a>.
+            </dd>
+            <dt>unsigned long? limit</dt>
+            <dd>
+              By default a <a>contact service</a> MAY return as many contacts as the user selects. If <code>limit</code>
+              is specified, the <a>contact service</a> MUST NOT return more than <code>limit</code> contacts. The
+              <a>contact service</a> SHOULD enforce this limitation in the user interface that it exposes.
+            </dd>
+            <dt>DOMString[] fields</dt>
+            <dd>
+              An array of field names corresponding to the name of the fields in the <a>Contact</a> dictionary that
+              the Web application is requesting from the <a>contact service</a>. The <a>contact service</a> MUST
+              NOT return defined fields on the contact objects that it provides other than those present in this
+              list. If a field name is provided that the <a>contact service</a> does not recognise as a field
+              of the <a>Contact</a> dictionary, then it MUST ignore it.
+            </dd>
+          </dl>
+        </section>
       </section>
-
+    </section>
+    <section>
+      <h2>Data Format</h2>
+      <p>
+        Upon successful invocation, the <a>contact service</a> MUST return an array of <a>Contact</a> dictionaries.
+      </p>
       <section>
-        <h2><a>Contact</a> interface</h2>
+        <h2>The <a>Contact</a> dictionary</h2>
         <p>
-          The <a>Contact</a> interface captures the properties of a contact object. All properties included in this 
-          interface have a corresponding definition in [[POCO-SCHEMA]], [[RFC2426]] (aka vCard), and [[OMA-CAB]], thereby
-          allowing the API to be supported across implementations supporting these various contact formats.
-        </p>
-        <p id="ta-ac" class="product-ua">
-          All <a>Contact</a> objects MUST include all attributes supported by the implementation, regardless 
-          of whether these attributes have been assigned a <code>null</code> value or not. If a supported attribute has not been
-          assigned a value by the user or the implementation, then this attribute MUST still be present in the
-          resulting <a>Contact</a> object and MUST have a value of <code>null</code>.
+          The <a>Contact</a> dictionary captures the properties of a contact object. All properties included in this 
+          interface have a corresponding definition in [[POCO-SCHEMA]], [[RFC2426]] (also known as vCard), and 
+          [[OMA-CAB]], thereby allowing the data format to be supported across implementations supporting these 
+          various contact representations.
         </p>
         <p>
           Additional attributes MAY be included according to the provisions detailed in 
-          <a href="#extended-contact-properties-and-parameters">Extended Contact Properties and Parameters</a>. If an
-          extended attribute is supported by the current implementation and has not been assigned a value by the
-          user or the implementation, then this extended attribute MUST still be present in the resulting
-          <a>Contact</a> object and MUST have a value of <code>null</code>.
+          <a href="#extended-contact-properties-and-parameters">Extended Contact Properties and Parameters</a>.
         </p>
-
-        <dl title='[NoInterfaceObject] interface Contact' class='idl'>
-          <dt>readonly attribute DOMString id</dt>
-          <dd>
-            <p>
-              A globally unique identifier for the given <a>Contact</a> object. 
-            </p>
-            <p>
-              An implementation MUST maintain this globally unique identifier when a <a>Contact</a> is added
-              to an address book.
-            </p>
-          </dd>
-          <dt>attribute DOMString? displayName</dt>
+        <dl title='dictionary Contact' class='idl'>
+          <dt>DOMString id</dt>
           <dd>
-            <p>
-              This attribute contains the name of this <a>Contact</a> in a form that is suitable for display 
-              to the user.
-            </p>
-          </dd>
-          <dt>attribute ContactName? name</dt>
-          <dd>
-            <p>
-              This attribute represents the full name of this <a>Contact</a> indicated by the name components 
-              associated with the <a>ContactName</a> object.
-            </p>
-          </dd>
-          <dt>attribute DOMString? nickname</dt>
-          <dd>
-            <p>
-              This attribute contains the nickname (or a casual name) for this <a>Contact</a>.
-            </p>
-          </dd>
-          <dt>attribute ContactField[]? phoneNumbers</dt>
-          <dd>
-            <p>
-              This attribute captures one or more phone numbers associated with this <a>Contact</a>.
-            </p>
+            A globally unique identifier for the given <a>Contact</a> object. 
           </dd>
-          <dt>attribute ContactField[]? emails</dt>
-          <dd>
-            <p>
-              This attribute represents one or more email addresses associated with this <a>Contact</a>.
-            </p>
-          </dd>
-          <dt>attribute ContactAddress[]? addresses</dt>
-          <dd>
-            <p>
-              This attribute represents one or more physical addresses associated with this <a>Contact</a>.
-            </p>
-          </dd>
-          <dt>attribute ContactField[]? ims</dt>
-          <dd>
-            <p>
-              This attribute represents one or more instant messaging identifiers associated with this
-              <a>Contact</a>.
-            </p>
-          </dd>
-          <dt>attribute ContactOrganization[]? organizations</dt>
+          <dt>DOMString? displayName</dt>
           <dd>
-            <p>
-              This attribute represents one or more organizations associated with this <a>Contact</a>.
-            </p>
+            This attribute contains the name of this <a>Contact</a> in a form that is suitable for display 
+            to the user.
           </dd>
-          <dt>attribute Date? birthday</dt>
+          <dt>ContactName? name</dt>
           <dd>
-            <p>
-              This attribute contains birthday of this <a>Contact</a>.
-            </p>
-            <p>
-              The year value MAY be set to 0000 when the age of the <a>Contact</a> is private or the year is not
-              available.
-            </p>
+            This attribute represents the full name of this <a>Contact</a> indicated by the name components 
+            associated with the <a>ContactName</a> dictionary.
           </dd>
-          <dt>attribute DOMString? note</dt>
+          <dt>DOMString? nickname</dt>
           <dd>
-            <p>
-              This attribute contains the personal notes (free-text) for this <a>Contact</a> that is managed by the
-              user of the address book.
-            </p>
+            This attribute contains the nickname (or a casual name) for this <a>Contact</a>.
           </dd>
-          <dt>attribute ContactField[]? photos</dt>
+          <dt>ContactField[]? phoneNumbers</dt>
+          <dd>
+            This attribute captures one or more phone numbers associated with this <a>Contact</a>.
+          </dd>
+          <dt>ContactField[]? emails</dt>
+          <dd>
+            This attribute represents one or more email addresses associated with this <a>Contact</a>.
+          </dd>
+          <dt>ContactAddress[]? addresses</dt>
+          <dd>
+            This attribute represents one or more physical addresses associated with this <a>Contact</a>.
+          </dd>
+          <dt>ContactField[]? ims</dt>
+          <dd>
+            This attribute represents one or more instant messaging identifiers associated with this
+            <a>Contact</a>.
+          </dd>
+          <dt>ContactOrganization[]? organizations</dt>
+          <dd>
+            This attribute represents one or more organisations associated with this <a>Contact</a>.
+          </dd>
+          <dt>Date? birthday</dt>
+          <dd>
+            This attribute contains birthday of this <a>Contact</a>. The <a>contact service</a> MAY
+            set the year value to 0000 when the age of the <a>Contact</a> is private or the year is not
+            available.
+          </dd>
+          <dt>DOMString? note</dt>
+          <dd>
+            This attribute contains the personal notes (free-text) for this <a>Contact</a> that is managed by the
+            user of the address book.
+          </dd>
+          <dt>ContactField[]? photos</dt>
           <dd>
             <p>
               This attribute represents one or more photos associated with this <a>Contact</a>.
@@ -504,679 +342,178 @@
               to provide inline data.
             </p>
             <p class="note">
-              This attribute SHOULD NOT be used to send down arbitrary photos taken by this user,
+              A <a>contact service</a> SHOULD NOT use this attribute to send down arbitrary photos taken by this user,
               but specifically profile photos of the contact suitable for display when describing the
               contact.
             </p>
           </dd>
-          <dt>attribute DOMString[]? categories</dt>
+          <dt>DOMString[]? categories</dt>
           <dd>
-            <p>
-              This attribute contains one or more user-defined categories/tags/labels associated with this
-              <a>Contact</a>. e.g. "family", "favorite", "cryptozoologists".
-            </p>
+            This attribute contains one or more user-defined categories/tags/labels associated with this
+            <a>Contact</a>. e.g. "family", "favourite", "cryptozoologists".
           </dd>
-          <dt>attribute ContactField[]? urls</dt>
+          <dt>ContactField[]? urls</dt>
           <dd>
             <p>
               This attribute represents one or more URLs associated with this <a>Contact</a> e.g. personal web page, 
               blog.
             </p>
-            <p>
-              The web resources MUST be specified using the <code>value</code> attribute of the
-              <code>ContactField</code> object, and its <code>type</code> field may be set to "blog" or
-              "profile".
-            </p>
-          </dd>
-        </dl>
-      </section>
-
-      <section>
-        <h2><a>ContactName</a> interface</h2>
-
-        <p>
-          The <a>ContactName</a> interface describes a contact's name.
-        </p>
-
-        <dl title='[NoInterfaceObject] interface ContactName' class='idl'>
-          <dt>attribute DOMString? familyName</dt>
-          <dd>
-            <p>
-              This attribute contains the family name (also referred to as the last name) of this <a>Contact</a>.
-            </p>
-          </dd>
-          <dt>attribute DOMString? givenName</dt>
-          <dd>
-            <p>
-              This attribute contains the given name (also referred to as the first name) of this <a>Contact</a>.
-            </p>
-          </dd>
-          <dt>attribute DOMString? middleName</dt>
-          <dd>
-            <p>
-              This attribute contains the middle name of this <a>Contact</a>.
-            </p>
-          </dd>
-          <dt>attribute DOMString? honorificPrefix</dt>
-          <dd>
-            <p>
-              This attribute contains the honorific prefix (or title) of this <a>Contact</a>. E.g. Mr., Dr., Ms.,
-              Mrs.
-            </p>
-          </dd>
-          <dt>attribute DOMString? honorificSuffix</dt>
-          <dd>
-            <p>
-              This attribute contains the honorific suffix of this <a>Contact</a>. E.g. Jr., III, Sr.
-            </p>
-          </dd>
-        </dl>
-      </section>
-
-      <section>
-        <h2><a>ContactField</a> interface</h2>
-
-        <p>
-          The <a>ContactField</a> interface is a reusable component that is used to capture contact fields of the
-          <a>Contact</a> interface that have some modicum of structure.
-        </p>
-
-        <dl title='[NoInterfaceObject] interface ContactField' class='idl'>
-          <dt>attribute DOMString type</dt>
-          <dd>
-            <p>
-              This attribute contains the type information for this <a>ContactField</a> and its content varies subject
-              to the contact property this <a>ContactField</a> is representing. For example, if the <a>ContactField</a> 
-              is representing a <code>phoneNumber</code> property, the <code>type</code> attribute can be set to 
-              <code>home</code>, <code>mobile</code>; if the <a>ContactField</a> is representing the <code>ims</code> 
-              property, the type attribute could be set to <code>xmpp</code>, <code>irc</code>, <code>bbm</code>, etc.
-            </p>
-          </dd>
-          <dt>attribute DOMString? value</dt>
-          <dd>
-            <p>
-              This attribute contains the value for this <a>ContactField</a> and its content varies subject to the
-              contact property this <a>ContactField</a> is representing. For example, if the <a>ContactField</a> is 
-              representing an <code>email</code>, the value attribute could be set to <code>JoeSmith@example.com</code>, 
-              and if the <a>ContactField</a> is representing a <code>url</code>, the value attribute can be set to    
-              <code>http://www.example.org/joesmith</code>, etc.
-            </p>
-          </dd>
-          <dt>attribute boolean pref</dt>
-          <dd>
-            <p>
-              This attribute indicates whether this instance of the <a>ContactField</a> is the
-              preferred, or primary, value for the contact property this <a>ContactField</a> is
-              representing in the <a>Contact</a> interface. By default, the value is <code>false</code>.
-            </p>
-          </dd>
-        </dl>
-      </section>
-
-      <section>
-        <h2><a>ContactAddress</a> interface</h2>
-
-        <p>
-          The <a>ContactAddress</a> interface is a reusable component that is used to capture addresses
-          within the <a>Contact</a> interface.
-        </p>
-        <dl title='[NoInterfaceObject] interface ContactAddress' class='idl'>
-          <dt>attribute boolean pref</dt>
-          <dd>
-            <p>
-              This attribute indicates whether this instance of the <code>ContactAddress</code> is the preferred, or primary, value for the contact. 
-              By default, the value is <code>false</code>.
-            </p>
-          </dd>
-          <dt>attribute DOMString? type</dt>
-          <dd>
-            <p>
-              This attribute contains the type of address this object is representing (e.g. <code>work</code>, <code>home</code>, <code>premises</code>, etc).
-            </p>
-          </dd>
-          <dt>attribute DOMString? streetAddress</dt>
-          <dd>
-            <p>
-              This attribute contains the street address corresponding to this <a>ContactAddress</a>.
-            </p>
-          </dd>
-          <dt>attribute DOMString? locality</dt>
-          <dd>
-            <p>
-              This attribute contains the locality (or city) name corresponding to this <a>ContactAddress</a>.
-            </p>
-          </dd>
-          <dt>attribute DOMString? region</dt>
-          <dd>
-            <p>
-              This attribute contains the region (or state/province) name corresponding to this <a>ContactAddress</a>.
-            </p>
-          </dd>
-          <dt>attribute DOMString? postalCode</dt>
-          <dd>
-            <p>
-              This attribute contains the postal code (or zip) corresponding to this <a>ContactAddress</a>.
-            </p>
-          </dd>
-          <dt>attribute DOMString? country</dt>
-          <dd>
-            <p>
-              This attribute contains the country name corresponding to this <a>ContactAddress</a>.
-            </p>
-          </dd>
-        </dl>
-      </section>
-
-      <section>
-        <h2><a>ContactOrganization</a> interface</h2>
-
-        <p>
-          The <a>ContactOrganization</a> interface is a reusable component that is used to support contact
-          organisations within the <a>Contact</a> interface.
-        </p>
-
-        <dl title='[NoInterfaceObject] interface ContactOrganization' class='idl'>
-          <dt>attribute boolean pref</dt>
-          <dd>
-            <p>
-              This attribute indicates whether this instance of the <code>ContactOrganization</code> is the preferred, or 
-              primary, value for the contact. By default, the value is <code>false</code>.
-            </p>
-          </dd>
-          <dt>attribute DOMString? type</dt>
-          <dd>
-            <p>
-              This attribute contains the type of organization this object is representing. 
-            </p>
-          </dd>
-          <dt>attribute DOMString? name</dt>
-          <dd>
-            <p>
-              The name of the organisation.
-            </p>
-          </dd>
-          <dt>attribute DOMString? department</dt>
-          <dd>
-            <p>
-              The department within which this <a>Contact</a> works.
-            </p>
-          </dd>
-          <dt>attribute DOMString? title</dt>
-          <dd>
-            <p>
-              The job title that the <a>Contact</a> holds inside this organisation.
-            </p>
           </dd>
         </dl>
       </section>
 
       <section>
-        <h2><a>ContactFindOptions</a> interface</h2>
+        <h2>The <a>ContactName</a> dictionary</h2>
         <p>
-          The <a>ContactFindOptions</a> interface describes the options that can be applied to contact searching. 
-          When a <a>ContactFindOptions</a> parameter is provided to the <a>Contacts</a> <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a>
-          operation, it should be processed according to the provisions detailed in 
-          <a href="#options-processing">Options Processing</a>.
+          The <a>ContactName</a> dictionary describes a contact's name in detail.
         </p>
-        <dl title='[NoInterfaceObject] interface ContactFindOptions' class='idl'>
-          <dt>attribute DOMString? filter</dt>
+        <dl title='dictionary ContactName' class='idl'>
+          <dt>DOMString? familyName</dt>
           <dd>
-            A string-based <a>search filter</a> which provides a hint to the user agent to facilitate contacts selection by the user.
+            This attribute contains the family name (also referred to as the last name) of this <a>Contact</a>.
           </dd>
-          <dt>attribute boolean? multiple</dt>
+          <dt>DOMString? givenName</dt>
           <dd>
-            A boolean value to indicate whether multiple Contact objects are wanted as part of the
-            <a>Contacts</a> <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation.
-            By default this option is set to <code>false</code>.
+            This attribute contains the given name (also referred to as the first name) of this <a>Contact</a>.
+          </dd>
+          <dt>DOMString? middleName</dt>
+          <dd>
+            This attribute contains the middle name of this <a>Contact</a>.
+          </dd>
+          <dt>DOMString? honorificPrefix</dt>
+          <dd>
+            This attribute contains the honorific prefix (or title) of this <a>Contact</a>. E.g. Mr., Dr., Ms., Mrs.
+          </dd>
+          <dt>DOMString? honorificSuffix</dt>
+          <dd>
+            This attribute contains the honorific suffix of this <a>Contact</a>. E.g. Jr., III, Sr.
           </dd>
         </dl>
       </section>
 
       <section>
-        <h2><a>ContactFindCB</a> interface</h2>
+        <h2>The <a>ContactField</a> dictionary</h2>
         <p>
-          This is the wrapper interface for callbacks indicating success of the <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> 
-          operation.
+          The <a>ContactField</a> dictionary is a reusable component that is used to capture contact fields of the
+          <a>Contact</a> dictionary that have some modicum of structure.
         </p>
 
-        <dl title='[Callback=FunctionOnly, NoInterfaceObject] interface ContactFindCB' class='idl'>
-          <dt>void onsuccess ()</dt>
+        <dl title='dictionary ContactField' class='idl'>
+          <dt>DOMString type</dt>
           <dd>
-            <dl class='parameters'>
-              <dt>Contact[] contactObjs</dt>
-              <dd>
-                An array of <a>Contact</a> objects resulting from the given <a>Contacts</a> 
-                <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation.
-              </dd>
-            </dl>
+            This attribute contains the type information for this <a>ContactField</a> and its content varies subject
+            to the contact property this <a>ContactField</a> is representing. For example, if the <a>ContactField</a> 
+            is representing a <code>phoneNumber</code> property, the <code>type</code> attribute can be set to 
+            <code>home</code>, <code>mobile</code>; if the <a>ContactField</a> is representing the <code>ims</code> 
+            property, the type attribute could be set to <code>xmpp</code>, <code>irc</code>, <code>bbm</code>, etc.
+          </dd>
+          <dt>DOMString? value</dt>
+          <dd>
+            This attribute contains the value for this <a>ContactField</a> and its content varies subject to the
+            contact property this <a>ContactField</a> is representing. For example, if the <a>ContactField</a> is 
+            representing an <code>email</code>, the value attribute could be set to <code>JoeSmith@example.com</code>, 
+            and if the <a>ContactField</a> is representing a <code>url</code>, the value attribute can be set to    
+            <code>http://www.example.org/joesmith</code>, etc.
+          </dd>
+          <dt>boolean pref</dt>
+          <dd>
+            This attribute indicates whether this instance of the <a>ContactField</a> is the
+            preferred, or primary, value for the contact property this <a>ContactField</a> is
+            representing in the <a>Contact</a> interface. By default, the value is <code>false</code>.
           </dd>
         </dl>
-
-        <section>
-          <h3>Event Handler Attributes</h3>
-          <p>
-            The following is the <a>event handler attribute</a> (and its corresponding <a>event handler event
-            type</a>) that MUST be supported as a DOM attribute by the <a>ContactFindCB</a> object.
-          </p>
-          <table class='simple'>
-            <thead>
-              <tr>
-                <th>event handler attribute</th>
-                <th>event handler event type</th>
-              </tr>
-            </thead>
-            <tbody>
-              <tr>
-                <td><strong><code>onsuccess</code></strong></td>
-                <td><code>success</code></td>
-              </tr>
-            </tbody>
-          </table>
-        </section>
-      </section>
-
-      <section>
-        <h2><a>ContactErrorCB</a> interface</h2>
-        <p>
-          This is the wrapper interface for callbacks indicating failure of the <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> 
-          operation.
-        </p>
-
-        <dl title='[Callback=FunctionOnly, NoInterfaceObject] interface ContactErrorCB' class='idl'>
-          <dt>void onerror ()</dt>
-          <dd>
-            <dl class='parameters'>
-              <dt>ContactError error</dt>
-              <dd>The <a>ContactError</a> object capturing the type of the error.</dd>
-            </dl>
-          </dd>
-        </dl>
-
-        <section>
-          <h3>Event Handler Attributes</h3>
-          <p>
-            The following is the <a>event handler attribute</a> (and its corresponding <a>event handler event
-            type</a>) that MUST be supported as a DOM attribute by the <a>ContactErrorCB</a> object.
-          </p>
-
-          <table class='simple'>
-            <thead>
-              <tr>
-                <th>event handler attribute</th>
-                <th>event handler event type</th>
-              </tr>
-            </thead>
-            <tbody>
-              <tr>
-                <td><strong><code><strong>onerror</strong></code></strong></td>
-                <td><code>error</code></td>
-              </tr>
-            </tbody>
-          </table>
-        </section>
       </section>
 
       <section>
-        <h2><a>ContactError</a> interface</h2>
+        <h2>The <a>ContactAddress</a> dictionary</h2>
         <p>
-          The <a>ContactError</a> interface encapsulates all errors in the manipulation of 
-          <a>Contact</a> objects.
-        </p>
-
-        <dl title='[NoInterfaceObject] interface ContactError' class='idl'>
-          <dt>const unsigned short UNKNOWN_ERROR = 0</dt>
-          <dd>An unknown error occurred.</dd>
-
-          <dt>const unsigned short INVALID_ARGUMENT_ERROR = 1</dt>
-          <dd>An invalid parameter was provided when the requested method was invoked.</dd>
-
-          <dt>const unsigned short TIMEOUT_ERROR = 2</dt>
-          <dd>The requested method timed out before it could be completed.</dd>
-
-          <dt>const unsigned short PENDING_OPERATION_ERROR = 3</dt>
-          <dd>There is already a <a>task</a> in the <a>device task source</a>.</dd>
-
-          <dt>const unsigned short IO_ERROR = 4</dt>
-          <dd>An error occurred in communication with the underlying implementation that meant the requested
-          method could not complete.</dd>
-
-          <dt>const unsigned short NOT_SUPPORTED_ERROR = 5</dt>
-          <dd>The requested method is not supported by the current implementation.</dd>
-
-          <dt>const unsigned short PERMISSION_DENIED_ERROR = 20</dt>
-          <dd>Access to the requested information was denied by the implementation or by the user.</dd>
-
-          <dt>readonly attribute unsigned short code</dt>
-          <dd>An error code assigned by an implementation when an error has occurred in Contacts API
-          processing.</dd>
-        </dl>
-      </section>
-    </section>
-
-    <section>
-      <h2><a>Contact Search Processing</a></h2>
-
-      <p>
-      The <a href="#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a>
-      method provides an operation to search for one of more <a href=
-      "#contact-interface"><code>Contact</code></a> objects within the <a href=
-      "#contacts-interface"><code>Contacts</code></a> database.
-      </p>
-
-      <section>
-        <h3>Search Qualifiers</h3>
-
-        <p>
-        The <dfn>search qualifier</dfn> provides an application with a way to request the specific subset of
-        <a href="#contact-interface"><code>Contact</code></a> properties it wishes to obtain in any resulting
-        successful callback. The <a>search qualifier</a> is deployed to minimize the data that needs to be
-        shared with an application in order to let that application fulfill its function on behalf of the user.
-        The <a>search qualifier</a> is included within a <a href=
-        "#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation as
-        the <code>fields</code> parameter.
-        </p>
-
-        <p id="ta-aj" class="product-ua">
-        A <a>search qualifier</a> MUST be specified from a requesting application as a part of any <a href=
-        "#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation.
-        </p>
-
-        <p id="ta-ab" class="product-ua">
-        If the <a>search qualifier</a> provided is of <em>zero-length</em> then the current <a href=
-        "#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation and 
-        the current find() operation was invoked with a non-<code>null</code> 
-        <code>errorCB</code> parameter, then the user agent MUST invoke the <code>errorCB</code> function
-        with an error code of <a href=
-        "#widl-ContactError-INVALID_ARGUMENT_ERROR"><code>INVALID_ARGUMENT_ERROR</code></a>.
+          The <a>ContactAddress</a> dictionary is a reusable component that is used to capture addresses
+          within the <a>Contact</a> dictionary.
         </p>
-
-        <p id="ta-ak" class="product-ua">
-        In the case that the <a>search qualifier</a> provided is of <em>non-zero-length</em> then the
-        current <a href="#contacts-interface"><code>Contacts</code></a> <a href=
-        "#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation MUST return only the matching <a href=
-        "#contact-interface"><code>Contact</code></a> properties within any resulting <a href=
-        "#contact-interface"><code>Contact</code></a> object(s).
-        </p>
-
-        <p id="ta-al" class="product-ua">
-        If a provided <a>search qualifier</a> element (<code>fields[x]</code>) does not match a <a href=
-        "#contact-interface"><code>Contact</code></a> attribute, <code>fields[x]</code> SHOULD be ignored when
-        executing the current <a href="#contacts-interface"><code>Contacts</code></a> <a href=
-        "#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation.
-        </p>
-
-        <section>
-          <h3>Advanced Search Qualifiers</h3>
-
-          <p>
-          We call <dfn>composed attributes</dfn> <a href="#contact-interface"><code>Contact</code></a>
-          attributes of types <code>object</code>, which contain information only available 
-          only through child attributes of that object, or <code>array</code>.
-          </p>
-
-          <p class="product-ua" id="ta-ad">
-          A requesting application MUST be able to request both the full composed <a href=
-          "#contact-interface"><code>Contact</code></a> attribute and also be able to request individual parts
-          of a composed <a href="#contact-interface"><code>Contact</code></a> attribute in the <a>search
-          qualifier</a> provided to a <a href="#contacts-interface"><code>Contacts</code></a> <a href=
-          "#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation.
-          </p>
-
-          <p>
-          For example, the <code>name</code> attribute of a <a href=
-          "#contact-interface"><code>Contact</code></a> object is defined to be of composed type <a href=
-          "#contactname-interface"><code>ContactName</code></a>. Therefore, a requesting application may
-          request either the full composed attribute (i.e. <code>name</code>) or specific individual attributes
-          of this composed attribute (i.e. <code>name.familyName</code>,
-          <code>name.givenName</code>, <code>name.middleName</code>, <code>name.honorificPrefix</code>,
-          <code>name.honorificSuffix</code>) as part of a <a href=
-          "#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation's
-          <a>search qualifier</a>.
-          </p>
-
-          <p id="ta-af" class="product-ua">
-          In the case that a composed <a href="#contact-interface"><code>Contact</code></a> attribute is
-          defined as an array of composed objects, specific individual attributes can be referenced
-          by using the composed attribute name, a dot (<code>.</code>) character and the individual attribute
-          to be retrieved.
-          </p>
-
-          <p>
-          For example, the <code>addresses</code> attribute of <a href=
-          "#contact-interface"><code>Contact</code></a> allows multiple <a href=
-          "#contactaddress-interface"><code>ContactAddress</code></a> objects to be defined. To request
-          individual attributes of this composed attribute an application would request e.g.
-          <code>addresses.locality</code>, <code>addresses.region</code>, etc.
-          </p>
-        </section>
-
-        <div class="example">
-          <p>
-          The following Contact search is initiated:
-          </p>
-          <pre class="sh_javascript">
- 
-     navigator.contacts( ['emails.value', 'name', 'friends'],
-                         function(contacts) { 
-                           for(i in contacts) {
-                             for(j in contacts[i].emails)
-                               alert(contacts[i].emails[j]);
-                           }
-                         } );
-  </pre>
-
-          <p>
-          The above example logically implies:
-          </p>
-
-          <ol class="rule">
-            <li>Return only the valid <a href="#contact-interface"><code>Contact</code></a> attributes
-            requested in the provided <a>search qualifier</a> (<code>name</code>, <code>emails.value</code> -
-            <code>friends</code> is not a valid <a href="#contact-interface"><code>Contact</code></a> attribute
-            so ignore this element).</li>
-          </ol>
-        </div>
+        <dl title='dictionary ContactAddress' class='idl'>
+          <dt>boolean pref</dt>
+          <dd>
+            This attribute indicates whether this instance of the <code>ContactAddress</code> is the preferred, 
+            or primary, value for the contact. By default, the value is <code>false</code>.
+          </dd>
+          <dt>DOMString? type</dt>
+          <dd>
+            This attribute contains the type of address this object is representing (e.g. <code>work</code>, 
+            <code>home</code>, <code>premises</code>, etc).
+          </dd>
+          <dt>DOMString? streetAddress</dt>
+          <dd>
+            This attribute contains the street address corresponding to this <a>ContactAddress</a>.
+          </dd>
+          <dt>DOMString? locality</dt>
+          <dd>
+            This attribute contains the locality (or city) name corresponding to this <a>ContactAddress</a>.
+          </dd>
+          <dt>DOMString? region</dt>
+          <dd>
+            This attribute contains the region (or state/province) name corresponding to this <a>ContactAddress</a>.
+          </dd>
+          <dt>DOMString? postalCode</dt>
+          <dd>
+            This attribute contains the postal code (or zip) corresponding to this <a>ContactAddress</a>.
+          </dd>
+          <dt>DOMString? country</dt>
+          <dd>
+            This attribute contains the country name corresponding to this <a>ContactAddress</a>.
+          </dd>
+        </dl>
       </section>
 
       <section>
-        <h2>Options Processing</h2>
-
-        <section>
-          <h3>Search Cardinality</h3>
-
-          <p id="ta-am" class="product-ua">
-          By default, the <a href="#contacts-interface"><code>Contacts</code></a> <a href=
-          "#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation MUST return either an empty sequence or a single <a href=
-          "#contact-interface"><code>Contact</code></a> object, accessible as part of the sequence returned in
-          the <a href="#contactfindcb-interface"><code>ContactFindCB</code></a> callback function.
-          </p>
-
-          <p id="ta-ae" class="product-ua">
-          If a <a href="#contactfindoptions-interface"><code>ContactFindOptions</code></a> object is
-          provided to the <a href="#contacts-interface"><code>Contacts</code></a> <a href=
-          "#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation and its <code>multiple</code> attribute is set to
-          <code>true</code>, the <a href="#contacts-interface"><code>Contacts</code></a> <a href=
-          "#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation MUST return either an empty sequence, a single <a href=
-          "#contact-interface"><code>Contact</code></a> object or <var>[X]</var> number of <a href=
-          "#contact-interface"><code>Contact</code></a> objects, accessible as part of the sequence returned in
-          the <a href="#contactfindcb-interface"><code>ContactFindCB</code></a> callback function.
-          </p>
-        </section>
-
-        <section>
-          <h3>Search Filters</h3>
-
-	  <p>
-          A <dfn>search filter</dfn> may be specified from a requesting web application to provide a hint to the user agents as to which contacts the user can select to share with the application.</p>
-
-	  <p>The <a>search filter</a> is defined through the <code>filter</code>
-          attribute of the <a href="#contactfindoptions-interface"><code>ContactFindOptions</code></a> object
-          provided to a <a href="#contacts-interface"><code>Contacts</code></a> <a href=
-          "#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation.
-          </p>
-
-          <p>The actual usage of this <a>search filter</a> is user-agent dependant, but is expected to represent
-          the logical union of provided values that are matched therein.
-          </p>
-	</section>
+        <h2>The <a>ContactOrganization</a> dictionary</h2>
+        <p>
+          The <a>ContactOrganization</a> dictionary is a reusable component that is used to support contact
+          organisations within the <a>Contact</a> dictionary.
+        </p>
+        <dl title='dictionary ContactOrganization' class='idl'>
+          <dt>boolean pref</dt>
+          <dd>
+            This attribute indicates whether this instance of the <code>ContactOrganization</code> is the preferred, or 
+            primary, value for the contact. By default, the value is <code>false</code>.
+          </dd>
+          <dt>DOMString? type</dt>
+          <dd>
+            This attribute contains the type of organisation this object is representing. 
+          </dd>
+          <dt>DOMString? name</dt>
+          <dd>
+            The name of the organisation.
+          </dd>
+          <dt>DOMString? department</dt>
+          <dd>
+            The department within which this <a>Contact</a> works.
+          </dd>
+          <dt>DOMString? title</dt>
+          <dd>
+            The job title that the <a>Contact</a> holds inside this organisation.
+          </dd>
+        </dl>
+      </section>
+      <section>
+        <h2>The <a>ContactError</a> dictionary</h2>
+        <p>
+          If the <a>contact service</a> encounters an error then it MUST return an error 
+          (through <code>postFailure()</code>) using the <a>ContactError</a> dictionary.
+        </p>
+        <dl title='dictionary ContactError' class='idl'>
+          <dt>DOMString message</dt>
+          <dd>A message describing the error.</dd>
+        </dl>
+      </section>
+      <section>
+        <h2>Extended Contact Properties and Parameters</h2>
+        <p>
+          A <a>contact service</a> MAY extend the dictionaries described in in the Data Formats section with
+          additional fields. If providing an extended field, a <a>contact service</a> MUST prefix its name
+          with <code>X</code> (U+0058 LATIN CAPITAL LETTER X) or use a vendor-specific prefix.
+        </p>
       </section>
     </section>
-
-    <section>
-      <h2>Extended Contact Properties and Parameters</h2>
-
-      <p>
-      The properties and parameters defined on the <a href="#contact-interface"><code>Contact</code></a>
-      interface MAY be extended by implementers of this specification.
-      </p>
-
-      <p>
-      Non-standard, private properties and parameters MUST have a prefixed name starting with
-      <code>X</code> (U+0058 LATIN CAPITAL LETTER X) or use a vendor-specific prefix. Extended properties and
-      parameters can be defined bilaterally between <a title="user agent">user agents</a> without outside
-      registration or standardization.
-      </p>
-
-      <p>
-      It is RECOMMENDED that authors define both a formal vCard grammar and a WebIDL grammar for their
-      proposed extension to ensure interoperability between vCard databases and other non-standard Contact
-      databases and formats. It is also RECOMMENDED that authors provide documentation of their extension
-      properties and parameters within the public domain.
-      </p>
-
-      <div class="example">
-        <p>
-        A new parameter is required by Company X to provide information related to a user's accounts
-        registered across different networks and services.
-        </p>
-
-        <p>
-        The [[WEBIDL]] syntax for this parameter is defined as follows:
-        </p>
-
-        <div class='idl' title='Contact implements ContactExtended'>
-          &nbsp;
-        </div>
-
-        <dl title='[NoInterfaceObject] interface ContactExtended' class='idl'>
-          <dt>attribute ContactAccount[] Xaccounts</dt>
-
-          <dd>One or more user accounts. See [[[POCO-SCHEMA]] Section 7.2.2. <code>accounts</code>].</dd>
-        </dl>
-
-        <dl title='[NoInterfaceObject] interface ContactAccount' class='idl'>
-          <dt>attribute DOMString domain</dt>
-
-          <dd>
-            <p>
-            See [[[POCO-SCHEMA]] Section 7.6. <code>domain</code>].
-            </p>
-          </dd>
-
-          <dt>attribute DOMString username</dt>
-
-          <dd>
-            <p>
-            See [[[POCO-SCHEMA]] Section 7.6. <code>username</code>].
-            </p>
-          </dd>
-
-          <dt>attribute DOMString userid</dt>
-
-          <dd>
-            <p>
-            See [[[POCO-SCHEMA]] Section 7.6. <code>userid</code>].
-            </p>
-          </dd>
-        </dl>
-
-        <p>
-        The corresponding vCard [[RFC2426]] notation for this parameter is defined as follows:
-        </p>
-        <pre>
-     The following ABNF grammar extends the grammar found in [[RFC2426]] (Section 4).
-   
-     <strong>X-ACCOUNT</strong>
-   
-     Purpose:  To specify the components of the accounts for the vCard 
-        object.
-
-     Value type:  A single structured text value, separated by the SEMI-
-        COLON character (ASCII decimal 59).
-
-     Cardinality:  (0,n)
-
-     Special notes:  The structured type value consists of a sequence of
-        account components.  The component values must be specified in
-        their corresponding position.  The structured type value
-        corresponds, in sequence, to the domain; the username; the userid.
-        When a component value is missing, the associated component 
-        separator must still be specified.    
-
-        The text components are separated by the SEMI-COLON character
-        (ASCII decimal 59).
-      
-     ABNF:
-   
-       X-ACCOUNT-param = ; no parameter allowed
-       X-ACCOUNT-value = list-component 3(";" list-component)
-  </pre>
-
-        <p>
-        This parameter will be used within the Contacts API as follows:
-        </p>
-        <pre class="sh_javascript">
-     var contact = ...; // ...obtain individual contact object
-     for(var i in contact.Xaccounts) {
-        alert(contact.Xaccounts[i].domain);   // thesocialnetwork.com
-        alert(contact.Xaccounts[i].username); // null
-        alert(contact.Xaccounts[i].userid);   // 344aesq2
-     }            
-  </pre>
-
-        <p>
-        This parameter will be used within the vCard format [[RFC2426]]] as follows:
-        </p>
-        <pre>
-     X-ACCOUNT;thesocialnetwork.com;;344aesq2
-  </pre>
-      </div>
-    </section>
-
-    <section>
-      <h3>API Invocation via DOM Events</h3>
-
-      <p>
-      The API contained in this document can be invoked either programmatically (for example, inline within
-      a general script) or resulting from the <a>interaction of a user</a>.
-      </p>
-
-      <p>
-      The <dfn>interaction of a user</dfn> is when a user invokes the API from an <a href=
-      "http://dev.w3.org/html5/markup/elements.html"><code>HTMLElement</code></a> [[HTML5]] within the current
-      <a>browsing context</a> via a <a>valid auto-invocation event</a>.
-      </p>
-
-      <p>
-      A <dfn>valid auto-invocation event</dfn> includes any of the following event types, as defined in
-      [[!DOM-LEVEL-3-EVENTS]]:
-      </p>
-
-      <ul>
-        <li><code>click</code></li>
-
-        <li><code>dblclick</code></li>
-
-        <li><code>mouseup</code></li>
-      </ul>
-
-      <p>
-      The <code>find()</code> method on <a href="#contacts-interface"><code>Contacts</code></a> should, if
-      the method was invoked by an <a>interaction of a user</a> (as opposed to having been created and executed
-      in general script), display the <a>Contact Picker</a> directly.
-      </p>
-    </section>
-
     <section class="informative appendix">
       <h2>User Interaction Guidelines</h2>
 
@@ -1371,226 +708,5 @@
         </p>
       </section>
     </section>
-
-    <section class="informative appendix">
-      <h2>Adding and Updating Contacts</h2>
-
-      <p>
-      The ability to add and update contact information is not a function of the API provided in this
-      specification. Instead, the intention is to reuse existing web platform APIs and paradigms in order to
-      achieve add and update functionality.
-      </p>
-
-      <p>
-      In this section we show how the existing web platform would be used to provide add and update
-      writeback functionality to allow users to add new contacts or update existing contacts from a web page to
-      their unified address book.
-      </p>
-
-      <p>
-      A <dfn>valid Contact resource</dfn> is a web resource with a <code>.vcard</code> or <code>.vcf</code>
-      filename extension or a web resource with a MIME-type matching a <a>valid media type</a>. A <dfn>vCard
-      object</dfn> is a text-based representation of contact information provided according to any version of
-      the vCard family of specifications.
-      </p>
-
-      <p class="note">Need to add informative references to all specs within the 'vCard family of
-      specifications'.
-      </p>
-
-      <p>
-      To handle the saving of a new Contact, a <a>user agent</a> should register as the default handler for
-      any <a>valid Contact resource</a>.
-      </p>
-
-      <p>
-      A <dfn>valid media type</dfn> will be one of the following web resource MIME types:
-      </p>
-
-      <ul>
-        <li><code>text/vcard</code></li>
-        <li><code>text/x-vcard</code></li>
-        <li><code>text/directory</code></li>
-        <li><code>text/directory;profile=vCard</code></li>
-      </ul>
-
-      <p>
-      On invocation of a <a>valid Contact resource</a>, the <a>user agent</a> should, on successful download
-      of the <a>valid Contact resource</a>, store the given resource in the user's unified address book
-      according to the <a>rule for storing a Contact resource</a>. As part of this standard download process,
-      the <a>user agent</a> may present a dialog to the user allowing them to select a different application
-      with which to handle the given resource, thereby overriding the use of the unified address book for the
-      storage of the data contained therein and bypassing the <a>rule for storing a Contact resource</a>.
-      </p>
-
-      <p>
-      The <dfn>rule for storing a Contact resource</dfn> is defined as follows:
-      </p>
-
-      <p>
-      Let <var>Contact</var> be the parsed key/value pairs contained in the <a>valid Contact
-      resource</a>.
-      </p>
-
-      <ol>
-        <li>If <var>Contact</var> contains a <code>UID</code> key then process the <a>valid Contact
-        resource</a> as follows.
-
-          <ol>
-            <li>Let <var>MatchedContact</var> be the result of obtaining a Contact object from the user's
-            unified address book that matches exactly the value of the <code>UID</code> provided.</li>
-
-            <li>If a <var>MatchedContact</var> has been found (i.e. <var>MatchedContact</var> is
-            not-<code>null</code>) then update the contents of <var>MatchedContact</var> with the contents of
-            <var>Contact</var> and exit this rule.</li>
-          </ol>
-        </li>
-
-        <li>Save the contents of <var>Contact</var> in the user's unified address book as a new Contact
-        object.</li>
-      </ol>
-
-      <p>
-      As part of the <a>rule for storing a Contact resource</a>, the <a>user agent</a> may provide
-      additional dialogs to the user after successful completion of the download and before the Contact
-      information is saved to the unified address book, such as to show a preview of the Contact information
-      contained therein as it will be stored in the user's unified address book. The user may be able to
-      override the information provided before accepting the additions and permanently storing the given data
-      in their unified address book.
-      </p>
-
-      <section class="informative">
-        <h4>Adding a new Contact</h4>
-
-        <p>
-        A web page can dynamically generate a <a>vCard object</a> on the client side for download to the
-        user's unified address book via either data: URIs [[RFC2397]] or using the [[FILE-WRITER]] and
-        [[FILE-API]] interfaces. The following examples show two methods for creating a <a>vCard object</a>
-        dynamically and then presenting this to the user. The user may then save this information by clicking
-        on the presented information, download the dynamically generated <a>vCard object</a> and invoke a
-        suitable application with which to handle the dynamic resource.
-        </p>
-
-        <div class="example">
-          <pre class="sh_javascript">
-  &lt;a id="vcard"&gt;Save our Contact Details&lt;/a&gt;
-
-  &lt;script type="text/javascript"&gt;
-    var vcard = 'BEGIN:VCARD\r\n' +
-                'VERSION:2.1\r\n' +
-                'N:Doe;John\r\n' +
-                'FN:John Doe\r\n' +
-                'TEL;WORK;VOICE:123456\r\n' +
-                'END:VCARD';
-
-    // assign vCard as a Data URI to an anchor element for presentation and download by the user
-    document.getElementById('vcard').href = "data:text/x-vcard;charset=utf-8," + encodeURIComponent( vcard ); 
-  &lt;/script&gt;
-  </pre>
-        </div>
-
-        <div class="example">
-          <pre class="sh_javascript">
-  &lt;a id="vcard"&gt;Save our Contact Details&lt;/a&gt;
-
-  &lt;script type="text/javascript"&gt;
-    // obtain an ArrayBuffer consisting of valid vCard syntax (out of scope)
-    var vCardObj = getVCard( /* ... */ );
-            
-    // create a new vCard Blob [[FILE-WRITER]]
-    var contactBlobBuilder = new BlobBuilder();
-    contactBlobBuilder.append( vCardObj );
-    var contactBlob = contactBlobBuilder.getBlob( "text/x-vcard" );
-
-    // obtain a vCard Blob URL [[FILE-API]]
-    var contactBlobURL = window.URL.createObjectUrl( contactBlob );
-
-    // assign vCard Blob URL to an anchor element for presentation and download by the user
-    document.getElementById('vcard').href = contactBlobURL; 
-  &lt;/script&gt;
-  </pre>
-        </div>
-      </section>
-
-      <section class="informative">
-        <h4>Updating an existing Contact</h4>
-
-        <p>
-        To update an existing Contact, the user must have already shared the contact information to edit
-        with the current web page via the <a href='#widl-Contacts-find-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options'>find()</a> operation of the <a href=
-        "#contacts-interface"><code>Contacts</code></a> interface. This section assumes that the user is
-        already sharing some contact information with the current web page via this process.
-        </p>
-
-        <p>
-        If this existing Contact information is to be updated in the user's unified address book then the
-        developer will assign the <code>id</code> attribute, as returned in the <code>Contact</code> object, as
-        the <code>UID</code> property of any resulting <a>vCard object</a> to be processed by the <a>user
-        agent</a> according to the <a>rule for storing a Contact resource</a>.
-        </p>
-
-        <p>
-        The examples below show two methods for updating an existing Contact in the user's unified address
-        book by maintaining a valid UID property while changing other parameters of the Contact card. The user
-        is then required to click on the resulting anchor element to download the modified Contact
-        resource.
-        </p>
-
-        <div class="example">
-          <pre class="sh_javascript">
-  &lt;a id="vcard"&gt;Save our Contact Details&lt;/a&gt;
-
-  &lt;script type="text/javascript"&gt;
-    // Obtain a single existing Contact object resulting from navigator.contacts.find()
-    var existingContactObj = ...;
-  
-    var vcard = 'BEGIN:VCARD\r\n' +
-                'VERSION:3.0\r\n' +
-                'UID:' + existingContactObj.id + '\r\n' + // assign the Contact.id to a UID property   
-                'N:Doe;John\r\n' +
-                'FN:John Doe\r\n' +
-                'TEL;HOME;VOICE:654321\r\n' +
-                'END:VCARD';
-
-    // assign vCard as a Data URI to an anchor element for presentation and download by the user
-    document.getElementById('vcard').href = "data:text/x-vcard;charset=utf-8," + encodeURIComponent( vcard ); 
-  &lt;/script&gt;
-  </pre>
-        </div>
-
-        <div class="example">
-          <pre class="sh_javascript">
-  &lt;a id="vcard"&gt;Update our Contact Details&lt;/a&gt;
-
-  &lt;script type="text/javascript"&gt;
-    // Obtain a single existing Contact object resulting from navigator.contacts.find()
-    var existingContactObj = ...;
-  
-    // Modify some parameters as required. e.g. add a new phone number
-    existingContactObj.phoneNumbers.push({
-      type: 'home', 
-      value: '654321'
-    });
-
-    // With the existing Contact object, create an ArrayBuffer consisting of valid vCard 
-    // syntax (out of scope) making sure to set the resulting vCard UID property to 
-    // the id parameter returned in the existing Contact object
-    var vCardObj = getVCard( existingContactObj );
-
-    // create a new vCard Blob [[FILE-WRITER]]
-    var contactBlobBuilder = new BlobBuilder();
-    contactBlobBuilder.append( vCardObj );
-    var contactBlob = contactBlobBuilder.getBlob( "text/x-vcard" );
-
-    // obtain a vCard Blob URL [[FILE-API]]
-    var contactBlobURL = window.URL.createObjectUrl( contactBlob );
-
-    // assign vCard Blob URL to an anchor element for presentation and download by the user
-    document.getElementById('vcard').href = contactBlobURL; 
-  &lt;/script&gt;
-  </pre>
-        </div>
-      </section>
-    </section>
   </body>
 </html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/discovery-api/FPWD.html	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,1797 @@
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+<head>
+    <title>Networked Service Discovery and Messaging</title>
+    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+    
+
+    
+    <style type="text/css">
+      /* Custom CSS optimizations (Richard Tibbett) */
+
+      /* Add better spacing to sections */
+      section, .section { margin-bottom: 2em; }
+
+      /* Reduce note & issue render size */
+      .note, .issue { font-size:0.8em; }
+
+      /* Add addition spacing to <ol> and <ul> for rule definition */
+      ol.rule li, ul.rule li { padding:0.6em; }
+
+      pre.widl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; position: relative; }
+      pre.widl :link, pre.widl :visited { color: #000; background: transparent; }
+      pre.widl:before { content: "IDL"; font: bold small sans-serif; padding: 0.5em; background: white; position: absolute; top: 0; margin: -1px 0 0 -4em; width: 1.5em; border: thin solid; border-radius: 0 0 0 0.5em }
+
+      div.example { border: solid thin red; background: #F7DFE5; color: black; padding: 0.5em 1em; position: relative; margin: 1em 0 1em 4.6em; width: auto; }
+      div.example:before { content: "EXAMPLE"; font: bold small sans-serif; padding: 0.5em; background: red; color: white; position: absolute; top: 0; margin: -1px 0 0 -7.6em; width: 5em; border: thin solid red; border-radius: 0 0 0 0.5em }
+
+      dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
+      hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
+      dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
+      dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
+      dl.domintro dd p { margin: 0.5em 0; }
+      dl.domintro code {font-size: inherit; font-style: italic; }
+      dl.domintro:before { display: table; margin: -1em -0.5em 0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: red; border: solid 2px; background: white; padding: 0 0.25em; }
+    </style>
+  <style>/*****************************************************************
+ * ReSpec 3 CSS
+ * Robin Berjon - http://berjon.com/
+ *****************************************************************/
+
+/* --- INLINES --- */
+em.rfc2119 { 
+    text-transform:     lowercase;
+    font-variant:       small-caps;
+    font-style:         normal;
+    color:              #900;
+}
+
+h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
+h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
+    border: none;
+}
+
+dfn {
+    font-weight:    bold;
+}
+
+a.internalDFN {
+    color:  inherit;
+    border-bottom:  1px solid #99c;
+    text-decoration:    none;
+}
+
+a.externalDFN {
+    color:  inherit;
+    border-bottom:  1px dotted #ccc;
+    text-decoration:    none;
+}
+
+a.bibref {
+    text-decoration:    none;
+}
+
+cite .bibref {
+    font-style: normal;
+}
+
+code {
+    color:  #ff4500;
+}
+
+
+/* --- --- */
+ol.algorithm { counter-reset:numsection; list-style-type: none; }
+ol.algorithm li { margin: 0.5em 0; }
+ol.algorithm li:before { font-weight: bold; counter-increment: numsection; content: counters(numsection, ".") ") "; }
+
+/* --- TOC --- */
+.toc a, .tof a {
+    text-decoration:    none;
+}
+
+a .secno, a .figno {
+    color:  #000;
+}
+
+ul.tof, ol.tof {
+    list-style: none outside none;
+}
+
+.caption {
+    margin-top: 0.5em;
+    font-style:   italic;
+}
+
+/* --- TABLE --- */
+table.simple {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    border-bottom:  3px solid #005a9c;
+}
+
+.simple th {
+    background: #005a9c;
+    color:  #fff;
+    padding:    3px 5px;
+    text-align: left;
+}
+
+.simple th[scope="row"] {
+    background: inherit;
+    color:  inherit;
+    border-top: 1px solid #ddd;
+}
+
+.simple td {
+    padding:    3px 10px;
+    border-top: 1px solid #ddd;
+}
+
+.simple tr:nth-child(even) {
+    background: #f0f6ff;
+}
+
+/* --- DL --- */
+.section dd > p:first-child {
+    margin-top: 0;
+}
+
+.section dd > p:last-child {
+    margin-bottom: 0;
+}
+
+.section dd {
+    margin-bottom:  1em;
+}
+
+.section dl.attrs dd, .section dl.eldef dd {
+    margin-bottom:  0;
+}
+</style><style>/* --- ISSUES/NOTES --- */
+div.issue-title, div.note-title {
+    padding-right:  1em;
+    min-width: 7.5em;
+    color: #b9ab2d;
+}
+div.issue-title { color: #e05252; }
+div.note-title { color: #52e052; }
+div.issue-title span, div.note-title span {
+    text-transform: uppercase;
+}
+div.note, div.issue {
+    margin-top: 1em;
+    margin-bottom: 1em;
+}
+.note > p:first-child, .issue > p:first-child { margin-top: 0 }
+.issue, .note {
+    padding: .5em;
+    border-left-width: .5em;
+    border-left-style: solid;
+}
+div.issue, div.note {
+    padding: 0.5em;
+    margin: 1em 0;
+    position: relative;
+    clear: both;
+}
+span.note, span.issue { padding: .1em .5em .15em; }
+
+.issue {
+    border-color: #e05252;
+    background: #fbe9e9;
+}
+.note {
+    border-color: #52e052;
+    background: #e9fbe9;
+}
+
+
+</style><style>/* HIGHLIGHTS */
+code.prettyprint {
+    color:  inherit;
+}
+
+/* this from google-code-prettify */
+.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
+</style><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet"><!--[if lt IE 9]><script src='undefined://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head>
+
+  <body><div class="head">
+  <p>
+    
+      <a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72"></a>
+    
+  </p>
+  <h1 class="title" id="title">Networked Service Discovery and Messaging</h1>
+  
+  <h2 id="w3c-working-draft-07-august-2012"><abbr title="World Wide Web Consortium">W3C</abbr> Working Draft 07 August 2012</h2>
+  <dl>
+    
+      <dt>This version:</dt>
+      <dd><a href="http://www.w3.org/TR/2012/WD-discovery-api-20120807/">http://www.w3.org/TR/2012/WD-discovery-api-20120807/</a></dd>
+      <dt>Latest published version:</dt>
+      <dd><a href="http://www.w3.org/TR/discovery-api/">http://www.w3.org/TR/discovery-api/</a></dd>
+    
+    
+      <dt>Latest editor's draft:</dt>
+      <dd><a href="http://w3c-test.org/dap/discovery-api/">http://w3c-test.org/dap/discovery-api/</a></dd>
+    
+    
+    
+    
+    
+    
+    <dt>Editors:</dt>
+    <dd><span>Rich Tibbett</span>, <a href="http://opera.com/">Opera Software ASA</a></dd>
+<dd><span>Clarke Stevens</span>, <a href="http://cablelabs.com/">CableLabs</a></dd>
+
+    
+  </dl>
+  
+  
+  
+  
+    
+      <p class="copyright">
+        <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 
+        2012
+        
+        <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> 
+        (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
+        <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
+        <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
+        <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+        <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
+        <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+      </p>
+    
+  
+  <hr>
+</div>
+    <section class="introductory" id="abstract"><h2>Abstract</h2>
+      <p>
+        This specification defines a mechanism for an HTML document to discover and subsequently communicate with <abbr title="Hypertext Transfer Protocol">HTTP</abbr>-based services
+        advertised via common discovery protocols within a user's network.
+      </p>
+    </section><section id="sotd" class="introductory"><h2>Status of This Document</h2>
+  
+    
+      
+        <p>
+          <em>This section describes the status of this document at the time of its publication. Other
+          documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision
+          of this technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports
+          index</a> at http://www.w3.org/TR/.</em>
+        </p>
+        
+      <p>
+        This document represents the early consensus of the group on the scope and features of the proposed
+        <abbr title="Application Programming Interface">API</abbr>.
+      </p>
+    
+        <p>
+          This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs and Policy Working Group</a> as a First Public Working Draft.
+          
+            This document is intended to become a <abbr title="World Wide Web Consortium">W3C</abbr> Recommendation.
+          
+          If you wish to make comments regarding this document, please send them to 
+          <a href="mailto:public-device-apis@w3.org">public-device-apis@w3.org</a> 
+          (<a href="mailto:public-device-apis-request@w3.org?subject=subscribe">subscribe</a>,
+          <a href="http://lists.w3.org/Archives/Public/public-device-apis/">archives</a>).
+          
+          
+          All feedback is welcome.
+        </p>
+        
+          <p>
+            Publication as a Working Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr> Membership.
+            This is a draft document and may be updated, replaced or obsoleted by other documents at 
+            any time. It is inappropriate to cite this document as other than work in progress.
+          </p>
+        
+        
+        <p>
+          
+            This document was produced by a group operating under the 
+            <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
+          
+          
+          
+            
+              <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/43696/status" rel="disclosure">public list of any patent disclosures</a> 
+            
+            made in connection with the deliverables of the group; that page also includes instructions for 
+            disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains
+            <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the
+            information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
+            6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
+          
+          
+        </p>
+        
+      
+    
+  
+</section><section id="toc"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a class="tocxref" href="#introduction"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a class="tocxref" href="#conformance"><span class="secno">2. </span>Conformance</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#dependencies"><span class="secno">2.1 </span>Dependencies</a></li></ul></li><li class="tocline"><a class="tocxref" href="#terminology"><span class="secno">3. </span>Terminology</a></li><li class="tocline"><a class="tocxref" href="#requesting-networked-services"><span class="secno">4. </span>Requesting networked services</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#methods"><span class="secno">4.1 </span>Methods</a></li><li class="tocline"><a class="tocxref" href="#error-handling"><span class="secno">4.2 </span>Error Handling</a></li></ul></li><li class="tocline"><a class="tocxref" href="#obtaining-networked-services"><span class="secno">5. </span>Obtaining networked services</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes"><span class="secno">5.1 </span>Attributes</a></li><li class="tocline"><a class="tocxref" href="#methods-1"><span class="secno">5.2 </span>Methods</a></li><li class="tocline"><a class="tocxref" href="#events"><span class="secno">5.3 </span>Events</a></li></ul></li><li class="tocline"><a class="tocxref" href="#communicating-with-a-networked-service"><span class="secno">6. </span>Communicating with a networked service</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes-1"><span class="secno">6.1 </span>Attributes</a></li><li class="tocline"><a class="tocxref" href="#states"><span class="secno">6.2 </span>States</a></li><li class="tocline"><a class="tocxref" href="#events-1"><span class="secno">6.3 </span>Events</a></li></ul></li><li class="tocline"><a class="tocxref" href="#service-discovery"><span class="secno">7. </span>Service Discovery</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#zeroconf-mdns-dns-sd"><span class="secno">7.1 </span>Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> + <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>)</a></li><li class="tocline"><a class="tocxref" href="#universal-plug-and-play-upnp"><span class="secno">7.2 </span>Universal Plug-and-Play (<abbr title="Universal Plug-and-Play">UPnP</abbr>)</a></li><li class="tocline"><a class="tocxref" href="#network-topology-monitoring"><span class="secno">7.3 </span>Network Topology Monitoring</a></li></ul></li><li class="tocline"><a class="tocxref" href="#garbage-collection"><span class="secno">8. </span>Garbage collection</a></li><li class="tocline"><a class="tocxref" href="#use-cases-and-requirements"><span class="secno">9. </span>Use Cases and Requirements</a></li><li class="tocline"><a class="tocxref" href="#examples"><span class="secno">A. </span>Examples</a></li><li class="tocline"><a class="tocxref" href="#acknowledgements"><span class="secno">B. </span>Acknowledgements</a></li><li class="tocline"><a class="tocxref" href="#references"><span class="secno">C. </span>References</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#normative-references"><span class="secno">C.1 </span>Normative references</a></li><li class="tocline"><a class="tocxref" href="#informative-references"><span class="secno">C.2 </span>Informative references</a></li></ul></li></ul></section>
+
+    
+
+    <section id="introduction" class="informative">
+      <!--OddPage--><h2><span class="secno">1. </span>Introduction</h2><p><em>This section is non-normative.</em></p>
+
+      <p>To enable Web pages to connect and communicate with Local-networked Services provided over <abbr title="Hypertext Transfer Protocol">HTTP</abbr>, this specification introduces the
+      <a href="#navigatornetworkservice"><code>NavigatorNetworkService</code></a> interface.</p>
+
+      <p>
+         Using this <abbr title="Application Programming Interface">API</abbr> consists of requesting a well-known service type, known by developers and advertised by Local-networked Devices. User authorization, where the user connects the web page to one or more discovered services,
+         is expected before the web page is able to interact with any Local-networked Services.
+      </p>
+
+      <p>
+         A web page creates a request to obtain connectivity to services running in the network by specifying a well-known discovery service type that it wishes to interact with.
+      </p>
+
+      <p>
+         The user agent, having captured all advertised services on the network from the Service Discovery mechanisms included in this recommendation, attempts to match
+      the requested service type to a discovered service according to the processing described herein.
+      </p>
+
+      <p>
+          If a service connectivity request is successful then the Web page is provided with the necessary information to communicate with the authorized Local-networked Service.
+          If the request fails then the Web page will receive an error callback containing an error code describing the cause of Local-networked Service connectivity failure.
+      </p>
+
+      <p>
+         Once connected to a Local-networked Service the Web page can send requests and receive responses to the Local-networked Service via the messaging format and appropriate channel inferred from the service type
+         authorized via the provided <abbr title="Application Programming Interface">API</abbr>.
+         The Web page, once connected, can also receive service-pushed events, in the messaging format supported by the Local-networked Device, if such event subscription functionality is provided by the
+         connected Local-networked Service.
+      </p>
+
+      <div class="example">
+       <p>Example of requesting a <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> advertised service:</p>
+       <hr>
+       <pre class="highlight prettyprint"><span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+  </span><span class="com">// Show a list of all the services provided to the web page</span><span class="pln">
+  </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class="pun">++)</span><span class="pln"> console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">name </span><span class="pun">);</span><span class="pln">
+</span><span class="pun">}</span><span class="pln">
+
+navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class="pun">(</span><span class="str">'zeroconf:_boxee-jsonrpc._tcp'</span><span class="pun">,</span><span class="pln"> showServices</span><span class="pun">);</span></pre>
+      </div>
+
+      <div class="example">
+        <p>Example of requesting a <abbr title="Universal Plug-and-Play">UPnP</abbr> advertised service, also handling error conditions:</p>
+        <hr>
+        <pre class="highlight prettyprint"><span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+  </span><span class="com">// Show a list of all the services provided to the web page</span><span class="pln">
+  </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class="pun">++)</span><span class="pln"> console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">name </span><span class="pun">);</span><span class="pln">
+</span><span class="pun">}</span><span class="pln">
+
+</span><span class="kwd">function</span><span class="pln"> error</span><span class="pun">(</span><span class="pln"> e </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+  console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln"> </span><span class="str">"Error occurred: "</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> e</span><span class="pun">.</span><span class="pln">code </span><span class="pun">);</span><span class="pln">
+</span><span class="pun">}</span><span class="pln">
+
+navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class="pun">(</span><span class="str">'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'</span><span class="pun">,</span><span class="pln"> showServices</span><span class="pun">,</span><span class="pln"> error</span><span class="pun">);</span></pre>
+      </div>
+
+      <div class="example">
+        <p>Example of requesting either a <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> or <abbr title="Universal Plug-and-Play">UPnP</abbr> advertised service:</p>
+        <hr>
+        <pre class="highlight prettyprint"><span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+  </span><span class="com">// Show a list of all the services provided to the web page (+ service type)</span><span class="pln">
+  </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class="pun">++)</span><span class="pln">
+     console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">'('</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">type </span><span class="pun">+</span><span class="pln"> </span><span class="str">')'</span><span class="pln"> </span><span class="pun">);</span><span class="pln">
+</span><span class="pun">}</span><span class="pln">
+
+navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class="pun">([</span><span class="pln">
+  </span><span class="str">'zeroconf:_boxee-jsonrpc._tcp'</span><span class="pun">,</span><span class="pln">
+  </span><span class="str">'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'</span><span class="pln">
+</span><span class="pun">],</span><span class="pln"> showServices</span><span class="pun">);</span></pre>
+      </div>
+
+      <p>For more detailed examples see the <a href="#examples">Examples</a> section.
+    </p></section>
+
+    <section id="conformance"><!--OddPage--><h2><span class="secno">2. </span>Conformance</h2>
+<p>
+  As well as sections marked as non-normative, all authoring guidelines, diagrams, examples,
+  and notes in this specification are non-normative. Everything else in this specification is
+  normative.
+</p>
+<p>
+  The key words <em title="must" class="rfc2119">must</em>, <em title="must not" class="rfc2119">must not</em>, <em title="required" class="rfc2119">required</em>, <em title="should" class="rfc2119">should</em>, <em title="should not" class="rfc2119">should not</em>, <em title="recommended" class="rfc2119">recommended</em>, <em title="may" class="rfc2119">may</em>,
+  and <em title="optional" class="rfc2119">optional</em> in this specification are to be interpreted as described in [<cite><a href="#bib-RFC2119" class="bibref">RFC2119</a></cite>].
+</p>
+
+
+     <p>Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or "return false and abort these steps") are to be interpreted with the
+     meaning of the key word ("must", "should", "may", etc) used in introducing the algorithm.</p>
+
+     <p>
+      Some conformance requirements are phrased as requirements on attributes, methods or objects. Such requirements are to be interpreted as requirements on user agents.
+     </p>
+
+     <p>
+      Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent. (In particular, the algorithms defined in
+      this specification are intended to be easy to follow, and not intended to be performant.)
+     </p>
+
+     <p>
+      The only conformance class defined by this specification is a <dfn id="dfn-user-agent">user agent</dfn>.
+     </p>
+
+     <p>
+      User agents may impose implementation-specific limits on otherwise unconstrained inputs, e.g. to prevent denial of service attacks, to guard against running out of memory, or to work
+      around platform-specific limitations.
+     </p>
+
+     <p>
+      When support for a feature is disabled (e.g. as an emergency measure to mitigate a security problem, or to aid in development, or for performance reasons), user agents must act as if
+      they had no support for the feature whatsoever, and as if the feature was not mentioned in this specification. For example, if a particular feature is accessed via an attribute in a Web
+      IDL interface, the attribute itself would be omitted from the objects that implement that interface - leaving the attribute on the object but making it return null or throw an exception
+      is insufficient.
+     </p>
+
+      <section id="dependencies">
+         <h3><span class="secno">2.1 </span>Dependencies</h3>
+
+         This specification relies on several other underlying specifications.
+
+         <dl>
+            <dt>HTML</dt>
+            <dd>Many fundamental concepts from HTML are used by this specification. [<cite><a href="#bib-HTML5" class="bibref">HTML5</a></cite>]</dd>
+            <dt>WebIDL</dt>
+            <dd>The IDL blocks in this specification use the semantics of the WebIDL specification. [<cite><a href="#bib-WEBIDL" class="bibref">WEBIDL</a></cite>]</dd>
+         </dl>
+      </section>
+    </section>
+
+    <section id="terminology">
+      <!--OddPage--><h2><span class="secno">3. </span>Terminology</h2>
+
+      <p>
+         The construction "a <code>Foo</code> object", where <code>Foo</code> is actually an interface, is sometimes used instead of the more accurate "an object implementing the interface <code>Foo</code>".
+      </p>
+
+      <p>
+         The term DOM is used to refer to the <abbr title="Application Programming Interface">API</abbr> set made available to scripts in Web applications, and does not necessarily imply the existence of an actual <code>Document</code> object or of any
+         other <code>Node</code> objects as defined in the DOM Core specifications. [<cite><a href="#bib-DOM4" class="bibref">DOM4</a></cite>]
+      </p>
+
+      <p>
+         An IDL attribute is said to be <em>getting</em> when its value is being retrieved (e.g. by author script), and is said to be <em>setting</em> when a new value is assigned to it.
+      </p>
+
+      <p>
+        A <dfn id="dfn-valid-service-type">valid service type</dfn> is a string that begins with <code>upnp:</code> or <code>zeroconf:</code> followed by one or more characters in the ranges U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E.
+      </p>
+
+      <p>
+        A <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> provided in the <code>type</code> attribute of the <code>getNetworkServices()</code> method will be matched against the services currently contained in the <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a> according to the algorithms defined in this specification.
+      </p>
+    </section>
+
+    <section id="requesting-networked-services">
+     <!--OddPage--><h2><span class="secno">4. </span>Requesting networked services</h2>
+
+
+<pre class="widl">[Supplemental, NoInterfaceObject]
+interface <dfn id="navigatornetworkservice">NavigatorNetworkService</dfn> {
+  // Obtain a Local-networked Service
+  void <a href="#dom-navigator-getnetworkservices">getNetworkServices</a>( in any type,
+                           in <a href="#navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</a> successCallback,
+                           in optional <a href="#navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</a> errorCallback );
+};
+<a class="externalDFN" href="http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">Navigator</a> implements <a href="#navigatornetworkservice">NavigatorNetworkService</a>;
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id="navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</dfn> {
+  void handleEvent( in <a href="#networkservices">NetworkServices</a> services );
+};
+
+[NoInterfaceObject]
+interface <dfn id="navigatornetworkserviceerror">NavigatorNetworkServiceError</dfn> {
+  const unsigned short <a href="#dom-navigatornetworkserviceerror-permission_denied">PERMISSION_DENIED_ERR</a> = 1;
+  const unsigned short <a href="#dom-navigatornetworkserviceerror-unknown_type_prefix">UNKNOWN_TYPE_PREFIX_ERR</a> = 2;
+  readonly attribute unsigned short <a href="#dom-navigatornetworkserviceerror-code">code</a>;
+};
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id="navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</dfn> {
+  void handleEvent( in <a href="#navigatornetworkserviceerror">NavigatorNetworkServiceError</a> error );
+};
+</pre>
+
+  <section id="methods">
+   <h3><span class="secno">4.1 </span>Methods</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">window</var>
+           .
+          <code title="dom-navigator">
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">navigator</a>
+          </code>
+           .
+          <code title="dom-navigator-getNetworkServices">
+            <a href="#dom-navigator-getnetworkservices">getNetworkServices</a>
+          </code>
+          (
+          <var title="">type</var>
+          ,
+          <var title="">successCallback</var>
+           [,
+          <var title="">errorCallback</var>
+           ] )
+        </dt>
+        <dd>
+          <p>Prompts the user to select one or more discovered network services that have advertised support for the requested service type.</p>
+          <p>
+            The
+            <var title="">type</var>
+             argument contains one or more <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> tokens that the web page would like to interact with.
+          </p>
+          <p>
+            If the user accepts, the
+            <var title="">successCallback</var>
+             is
+          invoked, with one or more
+            <code>
+              <a href="#networkservice"><code>NetworkService</code></a>
+            </code>
+             objects as
+          its argument.
+          </p>
+          <p>
+            If the user declines, the
+            <var title="">errorCallback</var>
+             (if
+          any) is invoked.
+          </p>
+        </dd>
+      </dl>
+
+       <div>
+          <p>
+            When the <dfn id="dom-navigator-getnetworkservices" title="dom-navigator-getnetworkservices"><code>getNetworkServices(type, successCallback[, errorCallback])</code></dfn> method is called, the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> run the following steps:
+          </p>
+
+          <ol class="rule">
+            <li>
+               If <var>successCallback</var> is empty or is not an object of type <code>Function</code> then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> abort these steps.
+            </li>
+
+            <li>
+              Let <var>requested control types</var> be initially set to an empty array.
+            </li>
+
+            <li>
+               If <var>type</var> is an array consisting of one or more <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> tokens, then let <var>requested control types</var> by the value of <var>type</var>, removing any non-<a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> tokens from the resulting array.
+            </li>
+
+            <li>
+               If <var>type</var> is a string consisting of one <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> token, then let <var>requested control types</var> be an array containing one item with a value of <var>type</var>.
+            </li>
+
+            <li>
+               If <var>requested control types</var> is an array that contains at least one or more <a class="internalDFN" href="#dfn-valid-service-type" title="valid service type">valid service type</a> tokens then continue to the step labeled <em>process</em> below. Otherwise, the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 2
+                  (<a href="#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a>) as its argument,
+                   abort any remaining steps and return.
+            </li>
+
+            <li>
+               <em>Process</em>: Let <var>services found</var> be an empty array.
+            </li>
+
+            <li>
+               For each <var>available service</var> in the <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a> run the following steps:
+               <ol class="rule">
+                  <li>
+                    For each <var>requested control type</var> in <var>requested control types</var>: If <var>available service</var>'s <code>type</code> attribute equals the <var>requested control type</var> then let <var>matched service</var> equal the value of <var>available service</var> and continue at the step labeled <var>attach</var> below.
+                  </li>
+                  <li>
+                     Continue at the next <var>available service</var>.
+                  </li>
+                  <li>
+                     <em>Attach</em>: If <var>matched service</var> is not empty then run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>new service object</var> be a new <a href="#networkservice"><code>NetworkService</code></a> object, mapping the parameters of
+                     <var>matched service</var> to this new object where possible.
+                        </li>
+                        <li>
+                           Append <var>new service object</var> to the <var>services found</var> array.
+                        </li>
+                     </ol>
+                  </li>
+               </ol>
+            </li>
+
+            <li>
+               If <var>services found</var> is an empty array, then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                 (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+            </li>
+
+            <li>
+               Return, and run the remaining steps asynchronously.
+            </li>
+
+            <li>
+               Optionally, e.g. based on a previously-established user preference, for security reasons, or due to platform limitations, the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="may" class="rfc2119">may</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                 (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+            </li>
+
+            <li>
+                  The <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> prompt the user in a user-agent-specific manner for permission to provide the
+                  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s
+                  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> with an array of
+                  <a href="#networkservice"><code>NetworkService</code></a> objects representing the user-authorized subset of <var>services found</var>.
+
+               <p>
+                  If the user grants permission to access one or more networked services then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="should" class="rfc2119">should</em> include an
+                  "ongoing local-network communication" indicator.
+               </p>
+
+               <p>If the user denies permission, then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+              </p>
+
+              <p>
+                If the user never responds, this algorithm stalls on this step.
+              </p>
+
+            </li>
+
+            <li>
+               Let <var>services</var> be the array of one or more <a href="#networkservice"><code>NetworkService</code></a> objects for which the user granted permission.
+            </li>
+
+            <li>
+               For each Object <var>service</var> in <var>services</var>, run the following substeps:
+
+               <ol class="rule">
+                  <li>
+                     Add the <var>service</var>'s <code>url</code> parameter to the <a class="internalDFN" href="#dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
+                  </li>
+                  <li>
+                    If <var>service</var> was originally created from a <abbr title="Universal Plug-and-Play">UPnP</abbr> discovery process and the <var>service</var>'s <code>eventsUrl</code> parameter is not empty then <a class="internalDFN" href="#dfn-setup-a-upnp-events-subscription">setup a <abbr title="Universal Plug-and-Play">UPnP</abbr> Events Subscription</a> for <var>service</var>.
+                  </li>
+               </ol>
+            </li>
+
+            <li>
+               Let <var>services manager</var> be a new <a href="#networkservices"><code>NetworkServices</code></a> object.
+            </li>
+
+            <li>
+               Set <var>services manager</var>'s <code>servicesAvailable</code> attribute to the length of <var>services</var>.
+            </li>
+
+            <li>
+              Store the set of <var>services</var> as <dfn id="current_authorized_services">current authorized services</dfn> internally against the newly created <var>services manager</var> object.
+            </li>
+
+            <li>
+               The <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>successCallback</var> with
+               <var>services manager</var> as its argument.
+            </li>
+
+          </ol>
+
+          <p>
+            The <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#task-source" class="externalDFN">task source</a> for these
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#concept-task" class="externalDFN">tasks</a> is the
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#user-interaction-task-source" class="externalDFN">user interaction task source</a>.
+          </p>
+
+          <p>
+            When a <a href="#networkservice"><code>NetworkService</code></a> object is provided to a Web page, the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> add the <code>url</code> property
+             to the <dfn id="dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</dfn>. This list enables the
+            Web page to override and initiate cross-site resource requests towards these URLs, and any sub-resources of these URLs, within the current
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> via various existing mechanisms (e.g. Web Sockets, Server-Sent Events,
+            Web Messaging, XMLHttpRequest).
+         </p>
+
+         <p>
+            If the user navigates away from the current browsing context, the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> remove all previously whitelisted urls from the <a class="internalDFN" href="#dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
+            There is no persistence to network service selections provided to a web page. It is not possible to access a previously white-listed networked service without the necessary user authorization in all of the following cases:
+            </p><ul>
+              <li>If the current script is reloaded at any point in the same or different window.</li>
+              <li>if the current script reinvokes the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method at any point in its execution.</li>
+              <li>If the user navigates forward or back in their history to reload the current page.</li>
+              <li>If a script is running in a different origin.</li>
+            </ul>
+         <p></p>
+
+      </div>
+      </section>
+
+      <section id="error-handling">
+         <h3><span class="secno">4.2 </span>Error Handling</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">error</var>
+           .
+          <code title="dom-NavigatorNetworkServiceError-code">
+            <a href="#dom-navigatornetworkserviceerror-code">code</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            Returns the current error's error code. At the current time, this may be <code>1</code> or <code>2</code>, for which the
+            corresponding error constants
+            <a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a> and
+            <a href="#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a> are defined.
+          </p>
+        </dd>
+      </dl>
+
+         <p>
+            The <dfn id="dom-navigatornetworkserviceerror-code" title="dom-navigatornetworkserviceerror-code"><code>code</code></dfn> attribute of a
+            <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object <em title="must" class="rfc2119">must</em> return the code for the error, which will be one of the following:
+         </p>
+
+         <dl>
+            <dt>
+               <dfn id="dom-navigatornetworkserviceerror-permission_denied" title="dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></dfn> (numeric value 1)
+            </dt>
+            <dd>
+               The user denied the page permission to access any services.
+            </dd>
+            <dt>
+               <dfn id="dom-navigatornetworkserviceerror-unknown_type_prefix" title="dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></dfn> (numeric value 2)
+            </dt>
+            <dd>
+               No <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> tokens were provided in the method invocation.
+            </dd>
+         </dl>
+
+      </section>
+
+      </section>
+      <section id="obtaining-networked-services">
+      <!--OddPage--><h2><span class="secno">5. </span>Obtaining networked services</h2>
+
+      <p>
+         The <a href="#networkservices"><code>NetworkServices</code></a> interface is the top-level response object from a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> and provides access to a set of user-authorized <a href="#networkservice"><code>NetworkService</code></a> objects for the given request.
+      </p>
+
+<pre class="widl">[NoInterfaceObject]
+interface <dfn id="networkservices">NetworkServices</dfn> {
+  readonly attribute unsigned long    <a href="#dom-networkservices-length">length</a>;
+  getter <a href="#networkservice">NetworkService</a> (unsigned long index);
+  <a href="#networkservice">NetworkService</a>? <a href="#dom-networkservices-getservicebyid">getServiceById</a>(DOMString id);
+
+  readonly attribute unsigned long    <a href="#dom-networkservices-servicesavailable">servicesAvailable</a>;
+
+  // event handler attributes
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservices-onserviceavailable">onserviceavailable</a>;
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservices-onserviceunavailable">onserviceunavailable</a>;
+
+};
+
+<a href="#networkservices">NetworkServices</a> implements <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" class="externalDFN">EventTarget</a>;
+</pre>
+
+      <section id="attributes">
+      <h3><span class="secno">5.1 </span>Attributes</h3>
+
+        <dl class="domintro">
+          <dt>
+            <code title="dom-networkservices-length">
+              <a href="#dom-networkservices-length">length</a>
+            </code>
+          </dt>
+          <dd>
+            <p>
+              Returns the current number of services in the respective object's <a class="internalDFN" href="#current_authorized_services">current authorized services</a>.
+            </p>
+          </dd>
+          <dt>
+            <code title="dom-networkservices-servicesavailable">
+              <a href="#dom-networkservices-servicesavailable">servicesAvailable</a>
+            </code>
+          </dt>
+          <dd>
+            <p>
+              Returns the current number of services matching one of the app-requested <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> tokens that are actively available within the user's current network.
+            </p>
+          </dd>
+        </dl>
+
+        <div>
+           <p>
+              The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute <em title="must" class="rfc2119">must</em> return the number of services represented in the object's corresponding <a class="internalDFN" href="#current_authorized_services">current authorized services</a> list at the time of getting.
+           </p>
+
+           <p>
+              The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute <em title="must" class="rfc2119">must</em> return the number of services available in the
+              user's network that match the <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> that was initially used to create the current <a href="#networkservices"><code>NetworkServices</code></a> object.
+              By default, <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> <em title="must" class="rfc2119">must</em> be set to <code>1</code>.
+           </p>
+
+           <p>
+             When a previously unknown instance of a networked service matching one or the requested <a href="#dfn-valid-service-type">valid service types</a> becomes available on the user's current network, the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> fire a new simple
+             event at the <a href="#dom-networkservices-onserviceavailable"><code>onserviceavailable</code></a> event handler.
+           </p>
+
+           <p>
+             When a previously known instance of a networked service matching one or the requested <a href="#dfn-valid-service-type">valid service types</a> becomes unavailable on the user's current network, the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> fire a new simple
+             event at the <a href="#dom-networkservices-onserviceunavailable"><code>onserviceunavailable</code></a> event handler.
+           </p>
+        </div>
+
+      </section>
+
+      <section id="methods-1">
+      <h3><span class="secno">5.2 </span>Methods</h3>
+        <dl class="domintro">
+        <dt>
+          <code title="networkservices-getter">
+            <a href="#networkservices">services</a>
+          </code>
+          [
+          <var title="">index</var>
+          ]
+        </dt>
+        <dd>
+          <p>
+            Returns the specified <a href="#networkservice"><code>NetworkService</code></a> object.
+          </p>
+        </dd>
+        <dt>
+          <code title="networkservices-getter">
+            <a href="#networkservices">services</a>
+          </code>
+          .
+          <code title="dom-networkservices-getservicebyid">
+            <a href="#dom-networkservices-getservicebyid">getServiceById</a>
+          </code>
+          (
+          <var title="">id</var>
+          )
+        </dt>
+        <dd>
+          <p>
+            Returns the <a href="#networkservice"><code>NetworkService</code></a> object with the given identifier, or null if no
+            service has that identifier.
+          </p>
+        </dd>
+      </dl>
+
+      <p>
+        A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current list of zero or more <a class="internalDFN" href="#current_authorized_services">current authorized services</a>, of which zero or more can be available at a time. Each item in <a class="internalDFN" href="#current_authorized_services">current authorized services</a> is represented by a <a href="#networkservice"><code>NetworkService</code></a> object.
+      </p>
+
+      <div class="note"><div class="note-title"><span>Note</span></div><p class="">
+        Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the first has the index 0, and each subsequent service is numbered one higher than the previous one. If the <a class="internalDFN" href="#dfn-user-agent">user agent</a> dynamically adds or removes network services for any reason, then the indices of the services in <a class="internalDFN" href="#current_authorized_services">current authorized services</a> will change dynamically. If the set of network services changes entirely, then all the previous services will be removed from <a class="internalDFN" href="#current_authorized_services">current authorized services</a> and replaced with new services.
+      </p></div>
+
+      <p>
+        The <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a> of <a href="#networkservices"><code>NetworkServices</code></a> objects at any instant are the numbers from zero to the number of items in <a class="internalDFN" href="#current_authorized_services">current authorized services</a> represented by the respective object minus one, if any services are represented in <a class="internalDFN" href="#current_authorized_services">current authorized services</a>. If a <a href="#networkservices"><code>NetworkServices</code></a> object represents no <a class="internalDFN" href="#current_authorized_services">current authorized services</a>, it has no <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a>.
+      </p>
+
+      <p>
+        To <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#determine-the-value-of-an-indexed-property" class="externalDFN">determine the value of an indexed property</a> for a given index <var>index</var> in a <a href="#networkservices"><code>NetworkServices</code></a> object's <a class="internalDFN" href="#current_authorized_services">current authorized services</a>, the user agent <em title="must" class="rfc2119">must</em> return the <a href="#networkservice"><code>NetworkService</code></a> object that represents the <var>index</var>th service in <a class="internalDFN" href="#current_authorized_services">current authorized services</a>.
+      </p>
+
+      <p>
+        The <dfn id="dom-networkservices-getservicebyid"><code>getServiceById(id)</code></dfn> method <em title="must" class="rfc2119">must</em> return the first <a href="#networkservice"><code>NetworkService</code></a> object in <a class="internalDFN" href="#current_authorized_services">current authorized services</a> represented by the respective object whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to the value of the <var>id</var> argument.
+        When no services in <a class="internalDFN" href="#current_authorized_services">current authorized services</a> match the given argument, the method <em title="must" class="rfc2119">must</em> return null.
+      </p>
+
+      <p>
+         Services available within the local network can connect and disconnect at different times during the execution of a web page. A <a class="internalDFN" href="#dfn-user-agent">user agent</a> can
+         inform a web page when the state of networked services matching the requested <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> change. Web pages can use this information to enable in-page experiences for communicating the state of networked services
+         with the ability to change the particular service or set of services the page is connected to by re-invoking the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method.
+      </p>
+
+      </section>
+
+      <section id="events">
+      <h3><span class="secno">5.3 </span>Events</h3>
+
+      <p>
+         The following are the event handlers (and their corresponding event handler event types) that must be supported, as IDL attributes, by all objects implementing the <a href="#networkservices"><code>NetworkServices</code></a> interface:
+       </p>
+
+       <table border="1">
+        <thead>
+          <tr>
+            <th>
+              <span title="event handlers">Event handler</span>
+            </th>
+            <th>
+              <span>Event handler event type</span>
+            </th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr>
+            <td>
+              <dfn id="dom-networkservices-onserviceavailable" title="dom-NetworkServices-onserviceavailable">
+                <code>onserviceavailable</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-serviceavailable">serviceavailable</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservices-onserviceunavailable" title="dom-NetworkServices-onserviceunavailable">
+                <code>onserviceunavailable</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-serviceunavailable">serviceunavailable</code>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+
+      <p>
+         Events with an event type of <code>serviceavailable</code> or <code>serviceunavailable</code> defined in this specification are simple <code>Event</code> objects.
+      </p>
+
+      </section>
+
+    </section>
+    <section id="communicating-with-a-networked-service">
+    <!--OddPage--><h2><span class="secno">6. </span>Communicating with a networked service</h2>
+
+<p>
+   The <a href="#networkservice"><code>NetworkService</code></a> interface is used to provide a set of connection information for an <abbr title="Hypertext Transfer Protocol">HTTP</abbr> service endpoint and if available, service events, running on a networked device.
+</p>
+
+<pre class="widl">[NoInterfaceObject]
+interface <dfn id="networkservice">NetworkService</dfn> {
+  readonly attribute DOMString        <a href="#dom-networkservice-id">id</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-name">name</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-type">type</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-url">url</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-config">config</a>;
+
+  const unsigned short <a href="#dom-networkservice-AVAILABLE">AVAILABLE</a>      = 1;
+  const unsigned short <a href="#dom-networkservice-UNAVAILABLE">UNAVAILABLE</a>    = 2;
+  readonly attribute unsigned short   <a href="#dom-networkservice-readystate">readyState</a>;
+
+  // event handler attributes
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onreadystatechange">onreadystatechange</a>;
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onmessage">onmessage</a>;
+};
+
+<a href="#networkservice">NetworkService</a> implements <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" class="externalDFN">EventTarget</a>;
+</pre>
+
+<section id="attributes-1">
+  <h3><span class="secno">6.1 </span>Attributes</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-id">
+            <a href="#dom-networkservice-id">id</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            A unique identifier for the given user-selected service instance.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-name">
+            <a href="#dom-networkservice-name">name</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The name of the user-selected service.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-type">
+            <a href="#dom-networkservice-type">type</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> token value of the user-selected service.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-url">
+            <a href="#dom-networkservice-url">url</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The control <abbr title="Uniform Resource Locator">URL</abbr> endpoint (including any required port information) of the user-selected control service that has been added to the <a class="internalDFN" href="#dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-config">
+            <a href="#dom-networkservice-config">config</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The configuration information associated with the service depending on the requested service type.
+          </p>
+        </dd>
+      </dl>
+
+          <p>
+            The <dfn id="dom-networkservice-id"><code>id</code></dfn> attribute is a unique identifier for the service. Two services provided at different times or on different objects <em title="must" class="rfc2119">must</em> have the same <a href="#dom-networkservice-id"><code>id</code></a> value.
+         </p>
+
+         <p>
+            The <dfn id="dom-networkservice-name"><code>name</code></dfn> attribute represents a human-readable title for the service.
+         </p>
+
+         <p>
+             The <dfn id="dom-networkservice-type"><code>type</code></dfn> attribute reflects the value of the <a class="internalDFN" href="#dfn-valid-service-type">valid service type</a> of the service.
+          </p>
+
+         <p>
+            The <dfn id="dom-networkservice-url"><code>url</code></dfn> attribute is an <a href="http://www.w3.org/TR/html5/urls.html#absolute-url" class="externalDFN">absolute <abbr title="Uniform Resource Locator">URL</abbr></a> pointing to the root <abbr title="Hypertext Transfer Protocol">HTTP</abbr>
+            endpoint for the service that has been added to the <a class="internalDFN" href="#dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>. Web pages can subsequently use this value for implicit cross-document messaging via various existing mechanisms (e.g. Web Sockets, Server-Sent Events, Web Messaging, XMLHttpRequest).
+         </p>
+
+         <p>
+            The <dfn id="dom-networkservice-config"><code>config</code></dfn> attribute provides the raw configuration information extracted from the given network service.
+         </p>
+
+      </section>
+
+      <section id="states">
+         <h3><span class="secno">6.2 </span>States</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-readystate">
+            <a href="#dom-networkservice-readystate">readyState</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            Returns the current state.
+          </p>
+        </dd>
+      </dl>
+
+         A <a href="#networkservice"><code>NetworkService</code></a> object can be in several states. The <dfn id="dom-networkservice-readystate"><code>readyState</code></dfn> attribute <em title="must" class="rfc2119">must</em> return the current state of the networked service,
+         which <em title="must" class="rfc2119">must</em> be one of the following values:
+
+         <dl>
+           <dt>
+             <dfn id="dom-networkservice-AVAILABLE" title="dom-networkservice-AVAILABLE">
+               <code>AVAILABLE</code>
+             </dfn>
+              (numeric value
+             1)
+
+
+           </dt>
+           <dd>
+             <p>The object is connected to its service endpoint.
+
+            </p>
+           </dd>
+           <dt>
+             <dfn id="dom-networkservice-UNAVAILABLE" title="dom-networkservice-UNAVAILABLE">
+               <code>UNAVAILABLE</code>
+             </dfn>
+              (numeric value
+             2)
+           </dt>
+           <dd>
+             <p>The object is not connected to its service endpoint.
+            </p>
+           </dd>
+         </dl>
+
+      </section>
+
+      <section id="events-1">
+         <h3><span class="secno">6.3 </span>Events</h3>
+
+      <p>
+         The following are the event handlers (and their corresponding event handler event types) that must be supported, as IDL attributes, by all objects implementing the
+         <a href="#networkservice"><code>NetworkService</code></a> interface:
+       </p>
+
+       <table border="1">
+        <thead>
+          <tr>
+            <th>
+              <span title="event handlers">Event handler</span>
+            </th>
+            <th>
+              <span>Event handler event type</span>
+            </th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-onmessage" title="dom-NetworkService-onmessage">
+                <code>onmessage</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-message">message</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-onreadystatechange" title="dom-NetworkService-onreadystatechange">
+                <code>onreadystatechange</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-onreadystatechange">readystatechange</code>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+
+      <p>
+         Events with an event type of <code>message</code> defined in this specification are <a href="http://dev.w3.org/html5/postmsg/#messageevent" class="externalDFN"><code>MessageEvent</code></a> objects as defined in [<cite><a href="#bib-POSTMSG" class="bibref">POSTMSG</a></cite>].
+      </p>
+
+      <p>
+         Events with an event type of <code>readystatechange</code> defined in this specification are simple <code>Event</code> objects.
+      </p>
+
+      </section>
+   </section>
+
+      <section id="service-discovery">
+            <!--OddPage--><h2><span class="secno">7. </span>Service Discovery</h2>
+
+      <p>
+         A <a class="internalDFN" href="#dfn-user-agent">user agent</a> conforming to this specification <em title="may" class="rfc2119">may</em> implement <abbr title="Simple Service Discovery Protocol">SSDP</abbr> [<cite><a href="#bib-UPNP-DEVICEARCH11" class="bibref">UPNP-DEVICEARCH11</a></cite>] and Zeroconf [<cite><a href="#bib-ZEROCONF" class="bibref">ZEROCONF</a></cite>] service discovery mechanisms
+         to enable Web pages to request and connect with <abbr title="Hypertext Transfer Protocol">HTTP</abbr> services running on networked devices, discovered via either mechanism, through this <abbr title="Application Programming Interface">API</abbr>. When a <a class="internalDFN" href="#dfn-user-agent">user agent</a> implements either of these service discovery mechanisms, then it <em title="must" class="rfc2119">must</em> conform to the corresponding algorithms provided in this section of the specification.
+      </p>
+      <p>
+         This section presents how the results of these two service discovery
+         mechanisms will be matched to requested service types and how their properties will be applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
+      </p>
+
+      <p>
+         It is expected that user agents will perform these service discovery mechansisms asynchronously and periodically update the <a>list of networked devices</a> as required. The timing of any
+         service discovery mechanisms is an implementation detail left to the discretion of the implementer (e.g. once on user agent start-up, every X seconds during user agent execution or on
+         invocation of this <abbr title="Application Programming Interface">API</abbr> from a Web page).
+      </p>
+
+      <p>
+         The <dfn id="dfn-list-of-available-service-records">list of available service records</dfn> is a single dynamic internal lookup table within user agents that is used to track the current services available in the network at any given time.
+         At any point during the running of either of the two service discovery mechanisms then existing entries within this table can be updated, entries can be added and entries can be removed as the status of networked
+         services changes. Each record contained within this table contains the attributes: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code> and <code>config</code>.
+      </p>
+
+            <section id="zeroconf-mdns-dns-sd">
+         <h3><span class="secno">7.1 </span>Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> + <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>)</h3>
+
+         <p>
+            For each <abbr title="Domain Name System">DNS</abbr> response received from a user-agent-initiated Multicast <abbr title="Domain Name System">DNS</abbr> Browse for <abbr title="DNS Pointer Record">PTR</abbr> records with the name <code>_services._dns-sd._udp</code> on the resolved recommended automatic browsing
+   domain [<cite><a href="#bib-MDNS" class="bibref">MDNS</a></cite>], the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> run the following steps:
+         </p>
+
+         <ol class="rule">
+
+            <li>Let <var>service <abbr title="Multicast DNS">mDNS</abbr> responses</var> be an array of <abbr title="DNS Pointer Record">PTR</abbr> records received by issuing a Multicast <abbr title="Domain Name System">DNS</abbr> Browse for <abbr title="DNS Pointer Record">PTR</abbr> records with the name of the current discovered service type.</li>
+
+            <li>For each Object <var>service <abbr title="Multicast DNS">mDNS</abbr> response</var> in <var>service <abbr title="Multicast DNS">mDNS</abbr> responses</var>, run the following steps:
+               <ol>
+
+                  <li>
+                     Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>config</code>.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>id</code> property to the value of the full <abbr title="DNS Pointer Record">PTR</abbr> Service Instance Name [<cite><a href="#bib-MDNS" class="bibref">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>name</code> property to the value of the <abbr title="DNS Pointer Record">PTR</abbr> Service Instance Name's <var>Instance</var> component [<cite><a href="#bib-MDNS" class="bibref">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string <code>zeroconf:</code> followed by the value of the <abbr title="DNS Pointer Record">PTR</abbr> Service Instance Name's <var>Service</var> component [<cite><a href="#bib-MDNS" class="bibref">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>url</code> property to the resolvable Service <abbr title="Uniform Resource Locator">URL</abbr> obtained from performing an <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> Lookup [<cite><a href="#bib-DNS-SD" class="bibref">DNS-SD</a></cite>] of the current service from the <abbr title="DNS Pointer Record">PTR</abbr> record provided [<cite><a href="#bib-MDNS" class="bibref">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>config</code> property to the string value of the contents of the first <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> TXT record associated with the <var>service <abbr title="Multicast DNS">mDNS</abbr> response</var> as defined in [<cite><a href="#bib-DNS-SD" class="bibref">DNS-SD</a></cite>].
+                  </li>
+
+                  <li>
+                     For each Object <var>existing service record</var> in the current <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a>, run the following sub-steps:
+                     <ol class="rule">
+
+                       <li>
+                        If the <var>existing service record</var>'s <code>id</code> property matches the value of the <var>network service record</var>'s <code>id</code>, then set the
+                        value of <var>existing service record</var> in the current <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a>  to the value of the
+                        <var>network service record</var> and skip the next step.
+                       </li>
+                     </ol>
+                  </li>
+
+                  <li>
+                     Add <var>network service record</var> to the <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a>.
+                  </li>
+
+                  <li>
+                     For each non-garbage collected <a href="#networkservice"><code>NetworkService</code></a> object run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           If the <a href="#networkservice"><code>NetworkService</code></a> object's <code>type</code> attribute does not equal the
+                           current <a>network service record</a>'s <code>type</code> property then continue at the next available active
+                           <a href="#networkservice"><code>NetworkService</code></a> object.
+                        </li>
+                        <li>
+                           Increment the <code>servicesAvailable</code> attribute of the <a href="#networkservices"><code>NetworkServices</code></a> object by <code>1</code>.
+                        </li>
+                     </ol>
+                  </li>
+            </ol>
+           </li>
+         </ol>
+
+      </section>
+
+      <section id="universal-plug-and-play-upnp">
+         <h3><span class="secno">7.2 </span>Universal Plug-and-Play (<abbr title="Universal Plug-and-Play">UPnP</abbr>)</h3>
+
+         <p>
+            For each <abbr title="Simple Service Discovery Protocol">SSDP</abbr> Presence Announcement [<cite><a href="#bib-UPNP-DEVICEARCH11" class="bibref">UPNP-DEVICEARCH11</a></cite>] - a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request - received from a user-agent-initiated <abbr title="Simple Service Discovery Protocol">SSDP</abbr> Discovery Request [<cite><a href="#bib-UPNP-DEVICEARCH11" class="bibref">UPNP-DEVICEARCH11</a></cite>], the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> run the following steps:
+         </p>
+
+         <ol class="rule">
+            <li>
+               Let <var>ssdp device</var> be an Object with a property for each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header received in the received <abbr title="Simple Service Discovery Protocol">SSDP</abbr> Presence Announcement, with each key being the name of a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header and its
+               value being that <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header's accompanying value.
+            </li>
+
+            <li>
+               If <var>ssdp device</var> does not contain at least one <var>NTS</var>, <var>USN</var> and <var>Location</var> parameter, then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> abort these steps.
+            </li>
+
+            <li>
+               If the first occurrence of <var>NTS</var> has a value other than <code>ssdp:alive</code>, then continue to the step labeled <var>update service monitor</var> below.
+            </li>
+
+            <li>
+               Let <var>root device descriptor file</var> contain the contents of the file located at the <abbr title="Uniform Resource Locator">URL</abbr> provided in the first occurrence of <var>Location</var> obtained according to the rules
+               defined in the section 'Retrieving a description using <abbr title="Hypertext Transfer Protocol">HTTP</abbr>' [<cite><a href="#bib-UPNP-DEVICEARCH11" class="bibref">UPNP-DEVICEARCH11</a></cite>].
+            </li>
+
+            <li>
+               If <var>root device descriptor file</var> is empty, then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> abort these steps.
+            </li>
+
+            <li>
+               Let <var>advertised services</var> be a <a>list of all advertised services</a> obtained from the <var>root device descriptor file</var> containing all sub-nodes of the <code>serviceList</code> node as described in
+               the section 'Device Description' [<cite><a href="#bib-UPNP-DEVICEARCH11" class="bibref">UPNP-DEVICEARCH11</a></cite>].
+            </li>
+
+            <li>
+               For each Object <var>advertised service</var> in <var>advertised services</var> run the following steps:
+               <ol class="rule">
+
+                  <li>
+                     Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>eventsUrl</code>, <code>config</code>.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>id</code> property to the string value of the first occurrence of <var>ssdp device</var>'s <var>USN</var> parameter.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>name</code> property to the string value of the first occurrence of the <var>service</var>'s <code>serviceId</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string <code>upnp:</code> followed by the string value of the first occurrence of the <var>service</var>'s <code>serviceType</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>url</code> property to the string value of the first occurrence of the <var>service</var>'s <code>controlURL</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>config</code> property to the string value of the first occurrence of the <var>device</var> property.
+                  </li>
+
+                  <li>
+                     If <var>service</var>'s <code>eventSubURL</code> property is empty, then continue to the step labeled <em>register</em> below.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>eventsUrl</code> property to the string value of the first occurrence of the <var>service</var>'s <code>eventSubURL</code> property.
+                  </li>
+
+                  <li>
+                     <em>Register</em>: For each Object <var>existing service record</var> in the current <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a>, run the following sub-steps:
+                     <ol class="rule">
+
+                       <li>
+                        If the <var>existing service record</var>'s <var>id</var> property matches the value of the first occurrence of <var>USN</var> and the
+                        <var>existing service record</var>'s <code>type</code> property matches the value of <var>network service record</var>'s <code>type</code>, then set the
+                        value of <var>existing service record</var> in the current <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a>  to the value of the
+                        <var>network service record</var> and skip the next step.
+                       </li>
+                     </ol>
+                  </li>
+
+                  <li>
+                     Add <var>network service record</var> to the <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a>.
+                  </li>
+
+               </ol>
+            </li>
+            <li>
+               <em>Update Service Monitor</em>: For each non-garbage collected <a href="#networkservice"><code>NetworkService</code></a> object run the following steps:
+
+               <ol class="rule">
+                  <li>
+                     If this <a href="#networkservice"><code>NetworkService</code></a> object's <code>type</code> attribute does not equal the
+                     current <a>network service record</a>'s <code>type</code> property then continue at the next available active
+                     <a href="#networkservice"><code>NetworkService</code></a> object.
+                  </li>
+                  <li>
+                     If the <var>announcement type</var> equals <code>ssdp:alive</code> then Increment the <code>servicesAvailable</code> attribute of the <a href="#networkservices"><code>NetworkServices</code></a>
+                     object by <code>1</code>. Otherwise, decrement the <code>servicesAvailable</code> attribute of the <a href="#networkservices"><code>NetworkServices</code></a>
+                     object by <code>1</code>.
+                  </li>
+               </ol>
+            </li>
+         </ol>
+
+         <p>
+            A <dfn id="dfn-user-agent-generated-callback-url">user-agent generated callback url</dfn> is a Local-network accessible <abbr title="Uniform Resource Locator">URL</abbr> endpoint that a <a class="internalDFN" href="#dfn-user-agent">user agent</a> must generate and maintain for receiving <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY requests from <abbr title="Universal Plug-and-Play">UPnP</abbr> Event sources.
+         </p>
+
+         <p>When the <a class="internalDFN" href="#dfn-user-agent">user agent</a> is to <dfn id="dfn-setup-a-upnp-events-subscription">setup a <abbr title="Universal Plug-and-Play">UPnP</abbr> Events Subscription</dfn>, it is to run the following steps with the current <var>network service record</var> object:</p>
+
+         <ol class="rule">
+            <li>
+               If <var>network service record</var>'s <code>eventsUrl</code> property is empty then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> abort these steps.
+            </li>
+
+            <li>
+               Let <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> be the value of creating a new <a class="internalDFN" href="#dfn-user-agent-generated-callback-url">user-agent generated callback url</a>.
+            </li>
+
+            <li>
+               Send a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request with a <em>NT</em> header with a string value of <code>upnp:event</code>, a <em>TIMEOUT</em> header with an integer value of
+               <code>86400</code> and a <em>CALLBACK</em> header
+               with a string value of <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> towards the <var>network service record</var>'s <code>eventsUrl</code> property.
+            </li>
+
+            <li>
+               If a non-200 OK response is received from the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> abort these steps.
+            </li>
+
+            <li>
+               On receiving a valid 200 OK response, run the following steps:
+
+               <ol class="rule">
+                  <li>
+                     Let <var>callback ID</var> equal the string value of the first included <em>SID</em> header, if it exists.
+                  </li>
+                  <li>
+                     Let <var>timeout date</var> equal the sum of the current UTC date value plus the integer value of the first included <em>TIMEOUT</em> header, if it exists.
+                  </li>
+                  <li>
+                     Run the following steps aynchronously and continue to the step labeled <em>listen</em> below.
+                  </li>
+                  <li>
+                     <em>Refresh Subscription</em>: Run the following steps at a set interval (X) within the <a class="internalDFN" href="#dfn-user-agent">user agent</a>:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>current date</var> equal the current UTC date.
+                        </li>
+                        <li>
+                           If <var>current date</var> is less than the <var>timeout date</var> then continue to the step labeled <em>refresh subscription</em> above.
+                        </li>
+                        <li>
+                           Send a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request with a <em>SID</em> header with the string value of <var>callback ID</var> and a <em>TIMEOUT</em> header
+                           with an integer value of <code>86400</code> towards the <var>network service record</var>'s <code>eventsUrl</code> property.
+                        </li>
+                        <li>
+                           On receiving a valid 200 OK, update <var>callback ID</var> with the string value of the first included <em>SID</em> header, if it exists. All other <abbr title="Hypertext Transfer Protocol">HTTP</abbr>
+                           responses should cause the <a class="internalDFN" href="#dfn-user-agent">user agent</a> to continue from the step labeled <em>refresh subscription</em> above.
+                        </li>
+                     </ol>
+
+                  </li>
+
+                  <li>
+                     <em>Listen</em>: For each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request received at the <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> the <a class="internalDFN" href="#dfn-user-agent">user agent</a> is to run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>content clone</var> be the result of obtaining the message body of the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request. If <var>content clone</var> is empty, then the <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> abort these steps.
+                        </li>
+                        <li>
+                          Create a new <code>message</code> event that uses the <a href="http://dev.w3.org/html5/postmsg/#messageevent" class="externalDFN"><code>MessageEvent</code></a> interface [<cite><a href="#bib-POSTMSG" class="bibref">POSTMSG</a></cite>], with the name <code>message</code>,
+                           which does not bubble, is not cancelable, and has no default action.
+                        </li>
+                        <li>
+                           Let the <code>data</code> attribute of the event have the DOMString value of <var>content clone</var>.
+                        </li>
+                        <li>
+                           <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a> to
+                            dispatch the newly created event at the current <a class="internalDFN" href="#networkservice"><code>NetworkService</code></a> object.
+                        </li>
+                     </ol>
+                  </li>
+
+               </ol>
+
+            </li>
+         </ol>
+
+         </section>
+
+         <section id="network-topology-monitoring">
+            <h3><span class="secno">7.3 </span>Network Topology Monitoring</h3>
+
+                  <div>
+                     <p>
+                        When the <a class="internalDFN" href="#dfn-user-agent">user agent</a> detects that the user has dropped from their connected network, then it <em title="must" class="rfc2119">must</em> run the following steps:
+                     </p>
+
+                     <ol class="rule">
+                        <li>
+                           Flush all entries from the <a class="internalDFN" href="#dfn-list-of-available-service-records">list of available service records</a>.
+                        </li>
+                        <li>
+                           For each <a href="#networkservice"><code>NetworkService</code></a> object currently active in the <a class="internalDFN" href="#dfn-user-agent">user agent</a> perform the following steps:
+
+                           <ol class="rule">
+                              <li>
+                                 Set the <a href="#dom-networkservice-readystate"><code>readyState</code></a> attribute to <code>2</code> (<a href="#dom-networkservice-UNAVAILABLE"><code>UNAVAILABLE</code></a>).
+                              </li>
+                              <li>
+                                 Create a new <code>readystatechange</code> event that uses the <code>Event</code> interface which does not bubble, is not cancelable, and has no default action.
+                              </li>
+                              <li>
+                                 <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a> to
+                                        dispatch the newly created event at the <a href="#networkservice"><code>NetworkService</code></a> object.
+                              </li>
+                           </ol>
+                        </li>
+                     </ol>
+
+                     <p>
+                        When the <a class="internalDFN" href="#dfn-user-agent">user agent</a> detects that the user has connected to a new network, then it <em title="should" class="rfc2119">should</em> run the following steps:
+                     </p>
+
+                     <ol class="rule">
+                        <li>
+                           Re-issue an <abbr title="Multicast DNS">mDNS</abbr> search and <abbr title="Simple Service Discovery Protocol">SSDP</abbr> discovery search and handle the responses according to the processing defined in <a href="#service-discovery">Section 6: Service Discovery</a>.
+                        </li>
+                     </ol>
+                  </div>
+         </section>
+      </section>
+
+   <section id="garbage-collection">
+      <!--OddPage--><h2><span class="secno">8. </span>Garbage collection</h2>
+
+      <p>
+         A <a class="internalDFN" href="#networkservice"><code>NetworkService</code></a> object containing a <code>url</code> parameter currently in the <a class="internalDFN" href="#dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a> <em title="must not" class="rfc2119">must not</em> be garbage collected.
+      </p>
+
+      <p>
+         Only when the user navigates away from the current browsing context can <a class="internalDFN" href="#networkservice"><code>NetworkService</code></a> objects be garbage-collected and records in the <a class="internalDFN" href="#dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a> be removed.
+      </p>
+
+   </section>
+
+
+    <section id="use-cases-and-requirements">
+      <!--OddPage--><h2><span class="secno">9. </span>Use Cases and Requirements</h2>
+
+      <p>This section covers what the requirements are for this <abbr title="Application Programming Interface">API</abbr>, as well as illustrates some use cases.</p>
+
+      <ul class="rule">
+         <li>
+            Once a user has given permission, user agents should provide the ability for Web pages to communicate directly with a Local-networked Service.
+            <ul class="rule">
+               <li>
+                  Example: A web-based TV remote control. A Web page wants to control the current user's TV, changing the programming shown or increasing/decreasing/muting the
+                  volume of the Local-networked Device. The Web page requests a service type that is known to be implemented by television sets to which it has the
+                  application logic to communicate. Local devices providing the request service types are discovered and presented to the user for authorization. The user selects one
+                  or more of the discovered television sets to be accessible to the current Web page and then clicks 'Share'. The Web page can now communicate directly with
+                  the user-authorized Local-networked services.
+               </li>
+            </ul>
+         </li>
+
+         <li>
+           Web pages should be able to communicate with Local-networked Services using the messaging channel supported by those Devices.
+           <ul class="rule">
+            <li>
+               Example: A Web page advertises that it is capable of controlling multiple Home Media Servers. The user can select their Home Media Server type from a drop-down list, at which point the
+               Web page sends a request to the user agent to connect with the associated service type of the Home Media Server. The Media Server selected implements a Web Socket channel for
+               bi-directional service communication and so the Web page opens a web socket to the requested Media Server and can communicate as required via that appropriate channel.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           Web pages should be able to communicate with Local-networked Services using the messaging format supported by those Devices.
+           <ul class="rule">
+            <li>
+               Example: A Web page advertises that it is capable of interacting with and controlling multiple types of Home Media Server. The user can select their Home Media Server type from a drop-down list or known Media Servers, at which point the
+               Web page sends a request to the user agent to connect with the associated service type (and, optionally, the associated event type) of the Home Media Server. The communiciation protocols supported by Home Media Servers typically vary
+               between <abbr title="Universal Plug-and-Play">UPnP</abbr>, JSON-RPC, Protocol Buffers or other messaging formats depending on the Home Media Server requested. The Web page is able to communicate with the user-selected Home Media
+               Server in the messaging format supported by that Device, which, in this example is a simple key/value pair text format.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           Web pages should not be able to communicate with Local-networked Services that have not been authorized by the user thereby maintaining the user's privacy.
+           <ul class="rule">
+            <li>
+               Example: A Web page requests access to one type of Local-networked service. The user authorizes access to that particular service. Other services running on that same device, and on other devices
+               within the network, should not be accessible to the current Web page.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           A user should be able to share one or more Local-networked Services based on a particular service type request from a Web page.
+           <ul class="rule">
+            <li>
+               Example: A Web page is capable of interacting with a specific profile of Local-networked Service. As such, it makes a request to the user agent to access those services, of which multiple matches
+               are found. The user is capable of selecting one or more of the discovered services to share with the Web page. The Web page can then implement a drag-and-drop interface for the user to drag specific
+               actions on to one or more of the authorized Local-networked Services.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           User agents should provide an <abbr title="Application Programming Interface">API</abbr> exposed to script that exposes the features above. The user is notified by UI anytime interaction with Local-networked Services is requested, giving the user
+           full ability to cancel or abort the transaction. The user selects the Local-networked Services to be connected to the current Web page, and can cancel these at any time. No invocations to
+           these APIs occur silently without user intervention.
+         </li>
+      </ul>
+    </section>
+
+          <section id="examples" class="informative appendix">
+             <!--OddPage--><h2><span class="secno">A. </span>Examples</h2><p><em>This section is non-normative.</em></p>
+
+           <div class="example">
+            <p>This sample code exposes a button. When clicked, this button is disabled and the user is prompted to offer a network service. The user may also select multiple network services. When the user has authorized a network service to be connected to the web page then the web page issues a simple command to get a list of all the albums stored on the connected media player service.
+            </p><p>The button is re-enabled only when the connected network service disconnects for whatever reason (the service becomes unavailable on the network, the user disconnects from their current network or the user revokes access to the service from the current web page). At this point the user can re-click the button to select a new network service to connect to the web page and the above steps are repeated.</p>
+            <p>The provided service type identifier and service interaction used in this example is based on the well-defined service type and messaging format supported by the <a href="http://xbmc.org/about/">XBMC Media Server</a>. </p>
+            <hr>
+            <pre class="highlight prettyprint"><span class="tag">&lt;input</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">"Start"</span><span class="pln"> </span><span class="atn">onclick</span><span class="pun">=</span><span class="atv">"</span><span class="pln">start</span><span class="pun">()</span><span class="atv">"</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"startBtn"</span><span class="tag">/&gt;</span><span class="pln">
+</span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"debugconsole"</span><span class="tag">&gt;&lt;/div&gt;</span><span class="pln">
+
+</span><span class="tag">&lt;script&gt;</span><span class="pln">
+ </span><span class="kwd">var</span><span class="pln"> startBtn </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class="pun">(</span><span class="str">'startBtn'</span><span class="pun">),</span><span class="pln">
+     debug </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class="pun">(</span><span class="str">'debugconsole'</span><span class="pun">);</span><span class="pln">
+
+ </span><span class="kwd">function</span><span class="pln"> start</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+   </span><span class="kwd">if</span><span class="pun">(</span><span class="pln">navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+      navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class="pun">(</span><span class="str">'zeroconf:_xbmc-jsonrpc._tcp'</span><span class="pun">,</span><span class="pln"> gotXBMCService</span><span class="pun">,</span><span class="pln"> error</span><span class="pun">);</span><span class="pln">
+      startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">;</span><span class="pln">
+   </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+      debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;Service Discovery API not supported!"</span><span class="pun">;</span><span class="pln">
+   </span><span class="pun">}</span><span class="pln">
+ </span><span class="pun">}</span><span class="pln">
+
+ </span><span class="kwd">function</span><span class="pln"> gotXBMCService</span><span class="pun">(</span><span class="pln">services</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+
+</span><span class="com">// Listen for service disconnect messages</span><span class="pln">
+
+   services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'readystatechange'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> e </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+     </span><span class="kwd">if</span><span class="pun">(</span><span class="pln">services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">readyState </span><span class="pun">===</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">UNAVAILABLE</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+       debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" disconnected."</span><span class="pun">;</span><span class="pln">
+       startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">;</span><span class="pln">
+     </span><span class="pun">}</span><span class="pln">
+   </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln">
+
+</span><span class="com">// Send a service message to get albums list (and process the service response)</span><span class="pln">
+
+   </span><span class="kwd">var</span><span class="pln"> svcXhr </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">XMLHttpRequest</span><span class="pun">();</span><span class="pln">
+   svcXhr</span><span class="pun">.</span><span class="pln">open</span><span class="pun">(</span><span class="str">"POST"</span><span class="pun">,</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">url </span><span class="pun">+</span><span class="pln"> </span><span class="str">"/getAlbums"</span><span class="pun">);</span><span class="pln"> </span><span class="com">// services[0].url and its subresources have been</span><span class="pln">
+                                                        </span><span class="com">// whitelisted for cross-site XHR use in this</span><span class="pln">
+                                                        </span><span class="com">// current browsing context.</span><span class="pln">
+
+   svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class="pun">(</span><span class="str">'Content-Type'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'application/json-rpc'</span><span class="pun">);</span><span class="pln">
+
+   svcXhr</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'readystatechange'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> response </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+     </span><span class="kwd">if</span><span class="pun">(</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">readyState </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">4</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">status </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">200</span><span class="pln"> </span><span class="pun">)</span><span class="pln">
+        </span><span class="kwd">return</span><span class="pun">;</span><span class="pln">
+     debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" response received: "</span><span class="pun">;</span><span class="pln">
+     debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> JSON</span><span class="pun">.</span><span class="pln">parse</span><span class="pun">(</span><span class="pln">response</span><span class="pun">.</span><span class="pln">responseText</span><span class="pun">);</span><span class="pln">
+   </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln">
+
+   </span><span class="kwd">var</span><span class="pln"> svcMsg </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="pln">
+     </span><span class="pun">{</span><span class="pln"> </span><span class="str">"jsonrpc"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2.0"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"method"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"AudioLibrary.GetAlbums"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"params"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"genreid"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln">
+         </span><span class="str">"artistid"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="str">"start"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="str">"end"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">}</span><span class="pln">
+   </span><span class="pun">];</span><span class="pln">
+
+   svcXhr</span><span class="pun">.</span><span class="pln">send</span><span class="pun">(</span><span class="pln">JSON</span><span class="pun">.</span><span class="pln">stringify</span><span class="pun">(</span><span class="pln">svcMsg</span><span class="pun">));</span><span class="pln">
+   debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" request sent: "</span><span class="pun">;</span><span class="pln">
+   debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> JSON</span><span class="pun">.</span><span class="pln">stringify</span><span class="pun">(</span><span class="pln">svcMsg</span><span class="pun">);</span><span class="pln">
+
+ </span><span class="pun">}</span><span class="pln">
+
+ </span><span class="kwd">function</span><span class="pln"> error</span><span class="pun">(</span><span class="pln"> err </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+   debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;An error occurred obtaining a local network service."</span><span class="pun">;</span><span class="pln">
+   startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">;</span><span class="pln">
+ </span><span class="pun">}</span><span class="pln">
+</span><span class="tag">&lt;/script&gt;</span></pre>
+           </div>
+
+           <div class="example">
+            <p>
+             This sample exposes a drop-down list containing a number of common Home-based audio devices. When the user selects an audio device from the list provided, they are prompted to authorize a network service
+             based on the service type requested. The user may also select multiple network services matching the selected service type.
+             In this example, the user selects their make as being <var>Sony</var> and their model as being <var>Bravia S1000</var> from which the Web page can derive a service type
+             (<var>urn:schemas-upnp-org:service:RenderingControl:1</var>).
+             <br><br>Once the user has authorized the device, the web page sends a simple mute command according to the messaging format supported by the device.
+            </p>
+            <hr>
+            <pre class="highlight prettyprint"><span class="tag">&lt;select</span><span class="pln"> </span><span class="atn">name</span><span class="pun">=</span><span class="atv">"make"</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"make"</span><span class="tag">&gt;</span><span class="pln">
+  </span><span class="tag">&lt;option</span><span class="pln"> </span><span class="atn">selected</span><span class="pun">=</span><span class="atv">"selected"</span><span class="pln"> </span><span class="atn">disabled</span><span class="pun">=</span><span class="atv">"disabled"</span><span class="tag">&gt;</span><span class="pln">Select make</span><span class="tag">&lt;/option&gt;</span><span class="pln">
+  </span><span class="tag">&lt;option&gt;</span><span class="pln">Sony</span><span class="tag">&lt;/option&gt;</span><span class="pln">
+  </span><span class="tag">&lt;option&gt;</span><span class="pln">Philips</span><span class="tag">&lt;/option&gt;</span><span class="pln">
+  </span><span class="tag">&lt;option&gt;</span><span class="pln">Alba</span><span class="tag">&lt;/option&gt;</span><span class="pln">
+</span><span class="tag">&lt;/select&gt;</span><span class="pln">
+</span><span class="tag">&lt;select</span><span class="pln"> </span><span class="atn">name</span><span class="pun">=</span><span class="atv">"model"</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"model"</span><span class="tag">&gt;&lt;/select&gt;</span><span class="pln">
+</span><span class="tag">&lt;div</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"debugconsole"</span><span class="tag">&gt;&lt;/div&gt;</span><span class="pln">
+
+</span><span class="tag">&lt;script&gt;</span><span class="pln">
+  </span><span class="kwd">var</span><span class="pln"> debug </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class="pun">(</span><span class="str">'debugconsole'</span><span class="pun">);</span><span class="pln">
+
+  </span><span class="kwd">var</span><span class="pln"> models </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+    </span><span class="str">"Sony"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln">
+      </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"Bravia TV S1000"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"upnp"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"urn:schemas-upnp-org:service:RenderingControl:1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln">
+      </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"Bravia TV S2000"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"zeroconf"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"_mediarenderer._http._tcp"</span><span class="pln"> </span><span class="pun">},</span><span class="pln">
+      </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"HiFi WD10"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"upnp"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"urn:schemas-upnp-org:service:RenderingControl:1"</span><span class="pln"> </span><span class="pun">}</span><span class="pln">
+    </span><span class="pun">],</span><span class="pln">
+    </span><span class="str">"Philips"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln"> </span><span class="com">/* ... */</span><span class="pln"> </span><span class="pun">],</span><span class="pln">
+    </span><span class="str">"Alba"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln"> </span><span class="com">/* ... */</span><span class="pln"> </span><span class="pun">]</span><span class="pln">
+  </span><span class="pun">};</span><span class="pln">
+
+  </span><span class="kwd">var</span><span class="pln"> makeEl </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class="pun">(</span><span class="str">"make"</span><span class="pun">),</span><span class="pln">
+      modelEl </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class="pun">(</span><span class="str">"model"</span><span class="pun">);</span><span class="pln">
+
+  makeEl</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'change'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+    modelEl</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">=</span><span class="pln"> </span><span class="str">""</span><span class="pun">;</span><span class="pln"> </span><span class="com">// reset</span><span class="pln">
+    </span><span class="kwd">var</span><span class="pln"> defaultOption </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">createElement</span><span class="pun">(</span><span class="str">"option"</span><span class="pun">);</span><span class="pln">
+    defaultOption</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">=</span><span class="pln"> </span><span class="str">"Select model"</span><span class="pun">;</span><span class="pln">
+    defaultOption</span><span class="pun">.</span><span class="pln">setAttribute</span><span class="pun">(</span><span class="str">"disabled"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"disabled"</span><span class="pun">);</span><span class="pln">
+    defaultOption</span><span class="pun">.</span><span class="pln">setAttribute</span><span class="pun">(</span><span class="str">"selected"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"selected"</span><span class="pun">);</span><span class="pln">
+    modelEl</span><span class="pun">.</span><span class="pln">appendChild</span><span class="pun">(</span><span class="pln">defaultOption</span><span class="pun">);</span><span class="pln">
+    </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">].</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class="pun">++)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+      </span><span class="kwd">var</span><span class="pln"> option </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">createElement</span><span class="pun">(</span><span class="str">"option"</span><span class="pun">);</span><span class="pln">
+      option</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">=</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"name"</span><span class="pun">];</span><span class="pln">
+      option</span><span class="pun">.</span><span class="pln">setAttribute</span><span class="pun">(</span><span class="str">"value"</span><span class="pun">,</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"type"</span><span class="pun">]</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">":"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"service"</span><span class="pun">]);</span><span class="pln">
+      modelEl</span><span class="pun">.</span><span class="pln">appendChild</span><span class="pun">(</span><span class="pln">option</span><span class="pun">);</span><span class="pln">
+    </span><span class="pun">}</span><span class="pln">
+  </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln">
+
+  modelEl</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'change'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+    </span><span class="kwd">if</span><span class="pun">(</span><span class="pln">navigator</span><span class="pun">.</span><span class="pln">getNetworkServices </span><span class="pun">&amp;&amp;</span><span class="pln">
+         modelEl</span><span class="pun">.</span><span class="pln">value </span><span class="pun">==</span><span class="pln"> </span><span class="str">"upnp:urn:schemas-upnp-org:service:RenderingControl:1"</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+      navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class="pun">(</span><span class="pln">modelEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">,</span><span class="pln"> successCallback</span><span class="pun">,</span><span class="pln"> errorCallback</span><span class="pun">);</span><span class="pln">
+    </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">modelEl</span><span class="pun">.</span><span class="pln">value </span><span class="pun">==</span><span class="pln"> </span><span class="str">"zeroconf:_mediarenderer._http._tcp"</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+      debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;Service type is not implemented by this application."</span><span class="pun">;</span><span class="pln">
+    </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+      debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;Service Discovery is not supported!"</span><span class="pun">;</span><span class="pln">
+    </span><span class="pun">}</span><span class="pln">
+  </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln">
+</span><span class="tag">&lt;/script&gt;</span><span class="pln">
+
+</span><span class="tag">&lt;script&gt;</span><span class="pln">
+  </span><span class="kwd">function</span><span class="pln"> successCallback</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+
+  </span><span class="com">// Listen for service push messages</span><span class="pln">
+
+    services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'message'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> msg </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+         debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" event received: "</span><span class="pun">;</span><span class="pln">
+         debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> msg</span><span class="pun">.</span><span class="pln">data</span><span class="pun">;</span><span class="pln">
+    </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln">
+
+ </span><span class="com">// Send a control signal to mute the service audio</span><span class="pln">
+
+    </span><span class="kwd">var</span><span class="pln"> svcXhr </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">XMLHttpRequest</span><span class="pun">();</span><span class="pln">
+    svcXhr</span><span class="pun">.</span><span class="pln">open</span><span class="pun">(</span><span class="str">"POST"</span><span class="pun">,</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">url</span><span class="pun">);</span><span class="pln"> </span><span class="com">// services[0].url and its</span><span class="pln">
+                                          </span><span class="com">// subresources have been whitelisted for</span><span class="pln">
+                                          </span><span class="com">// cross-site XHR use in this current</span><span class="pln">
+                                          </span><span class="com">// browsing context.</span><span class="pln">
+
+    svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class="pun">(</span><span class="str">'SOAPAction'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'urn:schemas-upnp-org:service:RenderingControl:1#SetMute'</span><span class="pun">);</span><span class="pln">
+    svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class="pun">(</span><span class="str">'Content-Type'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'text/xml; charset="utf-8";'</span><span class="pun">);</span><span class="pln">
+
+    svcXhr</span><span class="pun">.</span><span class="pln">onreadystatechange </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> response </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+      </span><span class="kwd">if</span><span class="pun">(</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">readyState </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">4</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">status </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">200</span><span class="pln"> </span><span class="pun">)</span><span class="pln">
+        </span><span class="kwd">return</span><span class="pun">;</span><span class="pln">
+      debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" response received: "</span><span class="pun">;</span><span class="pln">
+      debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">responseXML</span><span class="pun">;</span><span class="pln">
+    </span><span class="pun">}</span><span class="pln">
+
+    </span><span class="com">// Service messaging to mute the provided service</span><span class="pln">
+    </span><span class="kwd">var</span><span class="pln"> svcMsg </span><span class="pun">=</span><span class="pln"> </span><span class="str">'&lt;?xml version="1.0" encoding="utf-8"?&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                 </span><span class="str">'&lt;s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" '</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                   </span><span class="str">'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                   </span><span class="str">'&lt;s:Body&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                     </span><span class="str">'&lt;u:SetMute xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                       </span><span class="str">'&lt;InstanceID&gt;0&lt;/InstanceID&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                       </span><span class="str">'&lt;Channel&gt;Master&lt;/Channel&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                       </span><span class="str">'&lt;DesiredMute&gt;true&lt;/DesiredMute&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                     </span><span class="str">'&lt;/u:SetMute&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                   </span><span class="str">'&lt;/s:Body&gt;'</span><span class="pln"> </span><span class="pun">+</span><span class="pln">
+                 </span><span class="str">'&lt;/s:Envelope&gt;'</span><span class="pun">;</span><span class="pln">
+
+    svcXhr</span><span class="pun">.</span><span class="pln">send</span><span class="pun">(</span><span class="pln">svcMsg</span><span class="pun">);</span><span class="pln">
+    debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" request sent: "</span><span class="pun">;</span><span class="pln">
+    debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> svcMsg</span><span class="pun">;</span><span class="pln">
+  </span><span class="pun">}</span><span class="pln">
+
+  </span><span class="kwd">function</span><span class="pln"> errorCallback</span><span class="pun">(</span><span class="pln"> error </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+    debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"&lt;br&gt;An error occurred: "</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> error</span><span class="pun">.</span><span class="pln">code</span><span class="pun">;</span><span class="pln">
+  </span><span class="pun">}</span><span class="pln">
+</span><span class="tag">&lt;/script&gt;</span></pre>
+          </div>
+
+       </section>
+
+    <section id="acknowledgements">
+      <!--OddPage--><h2><span class="secno">B. </span>Acknowledgements</h2>
+
+      <p>Thanks are expressed by the editor to the following individuals for their feedback on this specification to date (in alphabetical order):
+      <br><br>
+      Gar Bergstedt, Lars-Erik Bolstad, Hari G Kumar, Bob Lund, Giuseppe Pascale, Marcin Simonides, Clarke Stevens, Christian Söderström, Mark Vickers, ...</p>
+
+      <p>Thanks are also expressed by the editor to the following organizations and groups for their support in producing this specification to date (in alphabetical order):
+      <br><br>
+      CableLabs, Opera Software ASA, <abbr title="World Wide Web Consortium">W3C</abbr> Device APIs Working Group, <abbr title="World Wide Web Consortium">W3C</abbr> Web and TV Interest Group, ...</p>
+    </section>
+
+
+<section class="appendix" id="references"><!--OddPage--><h2><span class="secno">C. </span>References</h2><section id="normative-references"><h3><span class="secno">C.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-DNS-SD">[DNS-SD]</dt><dd>S. Cheshire; M. Krochmal. <a href="http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt"><cite>DNS-Based Service Discovery.</cite></a> 27 February 2011. IETF Draft. URL: <a href="http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt">http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt</a>
+</dd><dt id="bib-DOM4">[DOM4]</dt><dd>Anne van Kesteren; Aryeh Gregor; Ms2ger. <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/"><cite>DOM4.</cite></a> URL: <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/">http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/</a> 
+</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Ian Hickson; David Hyatt. <a href="http://www.w3.org/TR/html5"><cite>HTML5.</cite></a> 25 May 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/html5">http://www.w3.org/TR/html5</a> 
+</dd><dt id="bib-MDNS">[MDNS]</dt><dd>S. Cheshire; M. Krochmal. <a href="http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt"><cite>Multicast DNS.</cite></a> 14 February 2011. IETF Draft. URL: <a href="http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt">http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt</a>
+</dd><dt id="bib-POSTMSG">[POSTMSG]</dt><dd>Ian Hickson. <a href="http://dev.w3.org/html5/postmsg"><cite>HTML5 Web Messaging.</cite></a> URL: <a href="http://dev.w3.org/html5/postmsg">http://dev.w3.org/html5/postmsg</a>
+</dd><dt id="bib-RFC2119">[RFC2119]</dt><dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in RFCs to Indicate Requirement Levels.</cite></a> March 1997. Internet RFC 2119.  URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a> 
+</dd><dt id="bib-UPNP-DEVICEARCH11">[UPNP-DEVICEARCH11]</dt><dd><a href="http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf"><cite>UPnP Device Architecture 1.1</cite></a>. 15 October 2008. UPnP Forum. PDF document. URL: <a href="http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf">http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf</a>
+</dd><dt id="bib-WEBIDL">[WEBIDL]</dt><dd>Cameron McCormack. <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/"><cite>Web IDL.</cite></a> 27 September 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/">http://www.w3.org/TR/2011/WD-WebIDL-20110927/</a> 
+</dd><dt id="bib-ZEROCONF">[ZEROCONF]</dt><dd>S. Cheshire; B. Aboba; E. Guttman. <a href="http://files.zeroconf.org/rfc3927.txt"><cite>Dynamic Configuration of IPv4 Link-Local Addresses.</cite></a> May 2005. IETF Draft. URL: <a href="http://files.zeroconf.org/rfc3927.txt">http://files.zeroconf.org/rfc3927.txt</a>
+</dd></dl></section><section id="informative-references"><h3><span class="secno">C.2 </span>Informative references</h3><p>No informative references.</p></section></section></body></html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/discovery-api/Overview.html	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,2213 @@
+<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
+<html lang="en" dir="ltr" about="" property="dc:language" content="en" prefix="dc: http://purl.org/dc/terms/ bibo: http://purl.org/ontology/bibo/ foaf: http://xmlns.com/foaf/0.1/ xsd: http://www.w3.org/2001/XMLSchema#">
+<head>
+    <title>Networked Service Discovery and Messaging</title>
+    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+    <!-- This spec has been compiled with ReSpec v2 -->
+
+
+    <style type="text/css">
+      /**
+       * SyntaxHighlighter
+       * http://alexgorbatchev.com/SyntaxHighlighter
+       *
+       * SyntaxHighlighter is donationware. If you are using it, please donate.
+       * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
+       *
+       * @version
+       * 3.0.83 (July 02 2010)
+       *
+       * @copyright
+       * Copyright (C) 2004-2010 Alex Gorbatchev.
+       *
+       * @license
+       * Dual licensed under the MIT and GPL licenses.
+       */
+      .syntaxhighlighter a,
+      .syntaxhighlighter div,
+      .syntaxhighlighter code,
+      .syntaxhighlighter table,
+      .syntaxhighlighter table td,
+      .syntaxhighlighter table tr,
+      .syntaxhighlighter table tbody,
+      .syntaxhighlighter table thead,
+      .syntaxhighlighter table caption,
+      .syntaxhighlighter textarea {
+        -moz-border-radius: 0 0 0 0 !important;
+        -webkit-border-radius: 0 0 0 0 !important;
+        background: none !important;
+        border: 0 !important;
+        bottom: auto !important;
+        float: none !important;
+        height: auto !important;
+        left: auto !important;
+        line-height: 1.1em !important;
+        margin: 0 !important;
+        outline: 0 !important;
+        overflow: visible !important;
+        padding: 0 !important;
+        position: static !important;
+        right: auto !important;
+        text-align: left !important;
+        top: auto !important;
+        vertical-align: baseline !important;
+        width: auto !important;
+        box-sizing: content-box !important;
+        font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important;
+        font-weight: normal !important;
+        font-style: normal !important;
+        font-size: 1em !important;
+        min-height: inherit !important;
+        min-height: auto !important;
+      }
+
+      .syntaxhighlighter {
+        width: 100% !important;
+        margin: 1em 0 1em 0 !important;
+        position: relative !important;
+        overflow: auto !important;
+        font-size: 0.8em !important;
+      }
+      .syntaxhighlighter.source {
+        overflow: hidden !important;
+      }
+      .syntaxhighlighter .bold {
+        font-weight: bold !important;
+      }
+      .syntaxhighlighter .italic {
+        font-style: italic !important;
+      }
+      .syntaxhighlighter .line {
+        white-space: pre !important;
+      }
+      .syntaxhighlighter table {
+        width: 100% !important;
+      }
+      .syntaxhighlighter table caption {
+        text-align: left !important;
+        padding: .5em 0 0.5em 1em !important;
+      }
+      .syntaxhighlighter table td.code {
+        width: 100% !important;
+      }
+      .syntaxhighlighter table td.code .container {
+        position: relative !important;
+      }
+      .syntaxhighlighter table td.code .container textarea {
+        box-sizing: border-box !important;
+        position: absolute !important;
+        left: 0 !important;
+        top: 0 !important;
+        width: 100% !important;
+        height: 100% !important;
+        border: none !important;
+
+        padding-left: 1em !important;
+        overflow: hidden !important;
+        white-space: pre !important;
+      }
+      .syntaxhighlighter table td.gutter .line {
+        text-align: right !important;
+        padding: 0 0.5em 0 1em !important;
+      }
+      .syntaxhighlighter table td.code .line {
+        padding: 0 1em !important;
+      }
+      .syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line {
+        padding-left: 0em !important;
+      }
+      .syntaxhighlighter.show {
+        display: block !important;
+      }
+      .syntaxhighlighter.collapsed table {
+        display: none !important;
+      }
+      .syntaxhighlighter.collapsed .toolbar {
+        padding: 0.1em 0.8em 0em 0.8em !important;
+        font-size: 1em !important;
+        position: static !important;
+        width: auto !important;
+        height: auto !important;
+      }
+      .syntaxhighlighter.collapsed .toolbar span {
+        display: inline !important;
+        margin-right: 1em !important;
+      }
+      .syntaxhighlighter.collapsed .toolbar span a {
+        padding: 0 !important;
+        display: none !important;
+      }
+      .syntaxhighlighter.collapsed .toolbar span a.expandSource {
+        display: inline !important;
+      }
+      .syntaxhighlighter .toolbar {
+        position: absolute !important;
+        right: 1px !important;
+        top: 1px !important;
+        width: 11px !important;
+        height: 11px !important;
+        font-size: 10px !important;
+        z-index: 10 !important;
+      }
+      .syntaxhighlighter .toolbar span.title {
+        display: inline !important;
+      }
+      .syntaxhighlighter .toolbar a {
+        display: block !important;
+        text-align: center !important;
+        text-decoration: none !important;
+        padding-top: 1px !important;
+      }
+      .syntaxhighlighter .toolbar a.expandSource {
+        display: none !important;
+      }
+      .syntaxhighlighter.ie {
+        font-size: .9em !important;
+        padding: 1px 0 1px 0 !important;
+      }
+      .syntaxhighlighter.ie .toolbar {
+        line-height: 8px !important;
+      }
+      .syntaxhighlighter.ie .toolbar a {
+        padding-top: 0px !important;
+      }
+      .syntaxhighlighter.printing .line.alt1 .content,
+      .syntaxhighlighter.printing .line.alt2 .content,
+      .syntaxhighlighter.printing .line.highlighted .number,
+      .syntaxhighlighter.printing .line.highlighted.alt1 .content,
+      .syntaxhighlighter.printing .line.highlighted.alt2 .content {
+        background: none !important;
+      }
+      .syntaxhighlighter.printing .line .number {
+        color: #bbbbbb !important;
+      }
+      .syntaxhighlighter.printing .line .content {
+        color: black !important;
+      }
+      .syntaxhighlighter.printing .toolbar {
+        display: none !important;
+      }
+      .syntaxhighlighter.printing a {
+        text-decoration: none !important;
+      }
+      .syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a {
+        color: black !important;
+      }
+      .syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a {
+        color: #008200 !important;
+      }
+      .syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a {
+        color: blue !important;
+      }
+      .syntaxhighlighter.printing .keyword {
+        color: #006699 !important;
+        font-weight: bold !important;
+      }
+      .syntaxhighlighter.printing .preprocessor {
+        color: gray !important;
+      }
+      .syntaxhighlighter.printing .variable {
+        color: #aa7700 !important;
+      }
+      .syntaxhighlighter.printing .value {
+        color: #009900 !important;
+      }
+      .syntaxhighlighter.printing .functions {
+        color: #ff1493 !important;
+      }
+      .syntaxhighlighter.printing .constants {
+        color: #0066cc !important;
+      }
+      .syntaxhighlighter.printing .script {
+        font-weight: bold !important;
+      }
+      .syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a {
+        color: gray !important;
+      }
+      .syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a {
+        color: #ff1493 !important;
+      }
+      .syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a {
+        color: red !important;
+      }
+      .syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a {
+        color: black !important;
+      }
+    </style>
+    <style type="text/css">
+      /**
+       * SyntaxHighlighter
+       * http://alexgorbatchev.com/SyntaxHighlighter
+       *
+       * SyntaxHighlighter is donationware. If you are using it, please donate.
+       * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
+       *
+       * @version
+       * 3.0.83 (July 02 2010)
+       *
+       * @copyright
+       * Copyright (C) 2004-2010 Alex Gorbatchev.
+       *
+       * @license
+       * Dual licensed under the MIT and GPL licenses.
+       */
+      .syntaxhighlighter {
+        background-color: none !important;
+      }
+      .syntaxhighlighter .line.alt1 {
+        background-color: none !important;
+      }
+      .syntaxhighlighter .line.alt2 {
+        background-color: none !important;
+      }
+      .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 {
+        background-color: none !important;
+      }
+      .syntaxhighlighter .line.highlighted.number {
+        color: black !important;
+      }
+      .syntaxhighlighter table caption {
+        color: black !important;
+      }
+      .syntaxhighlighter .gutter {
+        color: #afafaf !important;
+      }
+      .syntaxhighlighter .gutter .line {
+        border-right: 3px solid #6ce26c !important;
+      }
+      .syntaxhighlighter .gutter .line.highlighted {
+        background-color: #6ce26c !important;
+        color: white !important;
+      }
+      .syntaxhighlighter.printing .line .content {
+        border: none !important;
+      }
+      .syntaxhighlighter.collapsed {
+        overflow: visible !important;
+      }
+      .syntaxhighlighter.collapsed .toolbar {
+        color: blue !important;
+        background: none !important;
+        border: 1px solid #6ce26c !important;
+      }
+      .syntaxhighlighter.collapsed .toolbar a {
+        color: blue !important;
+      }
+      .syntaxhighlighter.collapsed .toolbar a:hover {
+        color: red !important;
+      }
+      .syntaxhighlighter .toolbar {
+        color: white !important;
+        background: #6ce26c !important;
+        border: none !important;
+      }
+      .syntaxhighlighter .toolbar a {
+        color: white !important;
+      }
+      .syntaxhighlighter .toolbar a:hover {
+        color: black !important;
+      }
+      .syntaxhighlighter .plain, .syntaxhighlighter .plain a {
+        color: black !important;
+      }
+      .syntaxhighlighter .comments, .syntaxhighlighter .comments a {
+        color: #008200 !important;
+      }
+      .syntaxhighlighter .string, .syntaxhighlighter .string a {
+        color: blue !important;
+      }
+      .syntaxhighlighter .keyword {
+        color: #006699 !important;
+      }
+      .syntaxhighlighter .preprocessor {
+        color: gray !important;
+      }
+      .syntaxhighlighter .variable {
+        color: #aa7700 !important;
+      }
+      .syntaxhighlighter .value {
+        color: #009900 !important;
+      }
+      .syntaxhighlighter .functions {
+        color: #ff1493 !important;
+      }
+      .syntaxhighlighter .constants {
+        color: #0066cc !important;
+      }
+      .syntaxhighlighter .script {
+        font-weight: bold !important;
+        color: #006699 !important;
+        background-color: none !important;
+      }
+      .syntaxhighlighter .color1, .syntaxhighlighter .color1 a {
+        color: gray !important;
+      }
+      .syntaxhighlighter .color2, .syntaxhighlighter .color2 a {
+        color: #ff1493 !important;
+      }
+      .syntaxhighlighter .color3, .syntaxhighlighter .color3 a {
+        color: red !important;
+      }
+
+      .syntaxhighlighter .keyword {
+        font-weight: bold !important;
+      }
+    </style>
+
+
+
+
+
+
+    <style type="text/css">
+      /* Custom CSS optimizations (Richard Tibbett) */
+
+      /* Add better spacing to sections */
+      section, .section { margin-bottom: 2em; }
+
+      /* Reduce note & issue render size */
+      .note, .issue { font-size:0.8em; }
+
+      /* Add addition spacing to <ol> and <ul> for rule definition */
+      ol.rule li, ul.rule li { padding:0.6em; }
+
+      pre.widl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; position: relative; }
+      pre.widl :link, pre.widl :visited { color: #000; background: transparent; }
+      pre.widl:before { content: "IDL"; font: bold small sans-serif; padding: 0.5em; background: white; position: absolute; top: 0; margin: -1px 0 0 -4em; width: 1.5em; border: thin solid; border-radius: 0 0 0 0.5em }
+
+      div.example { border: solid thin red; background: #F7DFE5; color: black; padding: 0.5em 1em; position: relative; margin: 1em 0 1em 4.6em; width: auto; }
+      div.example:before { content: "EXAMPLE"; font: bold small sans-serif; padding: 0.5em; background: red; color: white; position: absolute; top: 0; margin: -1px 0 0 -7.6em; width: 5em; border: thin solid red; border-radius: 0 0 0 0.5em }
+
+      dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
+      hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
+      dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
+      dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
+      dl.domintro dd p { margin: 0.5em 0; }
+      dl.domintro code {font-size: inherit; font-style: italic; }
+      dl.domintro:before { display: table; margin: -1em -0.5em 0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: red; border: solid 2px; background: white; padding: 0 0.25em; }
+    </style>
+  <style type="text/css">
+/*
+    XXX this is not up to date with the needs of various other parts, it will require
+        to be synched up with the latest developments
+        It may be that this will be split up so that only the parts that are acually used
+        by the document get to be included (e.g. WebIDL).
+*/
+
+/*****************************************************************
+ * ReSpec 2 CSS
+ * Robin Berjon, 2010-01-04
+ *****************************************************************/
+
+/* --- INLINES --- */
+em.rfc2119 {
+    text-transform:     lowercase;
+    font-variant:       small-caps;
+    font-style:         normal;
+    color:              #900;
+}
+
+h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
+h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
+    border: none;
+}
+
+dfn {
+    font-weight:    bold;
+}
+
+a.internalDFN {
+    color:  inherit;
+    border-bottom:  medium solid #99c;
+    text-decoration:    none;
+}
+
+a.externalDFN {
+    color:  inherit;
+    border-bottom:  medium dotted #ccc;
+    text-decoration:    none;
+}
+
+a.bibref {
+    text-decoration:    none;
+}
+
+code {
+    color:  #ff4500;
+}
+
+
+/* --- WEB IDL --- */
+pre.idl {
+    border-top: 1px solid #90b8de;
+    border-bottom: 1px solid #90b8de;
+    padding:    1em;
+    line-height:    120%;
+}
+
+pre.idl::before {
+    content:    "WebIDL";
+    display:    block;
+    width:      150px;
+    background: #90b8de;
+    color:  #fff;
+    font-family:    initial;
+    padding:    3px;
+    font-weight:    bold;
+    margin: -1em 0 1em -1em;
+}
+
+.idlType {
+    color:  #ff4500;
+    font-weight:    bold;
+    text-decoration:    none;
+}
+
+/*.idlModule*/
+/*.idlModuleID*/
+/*.idlInterface*/
+.idlInterfaceID {
+    font-weight:    bold;
+    color:  #005a9c;
+}
+
+.idlSuperclass {
+    font-style: italic;
+    color:  #005a9c;
+}
+
+/*.idlAttribute*/
+.idlAttrType {
+    color:  #005a9c;
+}
+.idlAttrName {
+    color:  #ff4500;
+}
+.idlAttrName a {
+    color:  #ff4500;
+    border-bottom:  1px dotted #ff4500;
+    text-decoration: none;
+}
+
+/*.idlMethod*/
+.idlMethType {
+    color:  #005a9c;
+}
+.idlMethName {
+    color:  #ff4500;
+}
+.idlMethName a {
+    color:  #ff4500;
+    border-bottom:  1px dotted #ff4500;
+    text-decoration: none;
+}
+
+/*.idlParam*/
+.idlParamType {
+    color:  #005a9c;
+}
+.idlParamName {
+    font-style: italic;
+}
+
+.extAttr {
+    color:  #666;
+}
+
+/*.idlConst*/
+.idlConstType {
+    color:  #005a9c;
+}
+.idlConstName {
+    color:  #ff4500;
+}
+.idlConstName a {
+    color:  #ff4500;
+    border-bottom:  1px dotted #ff4500;
+    text-decoration: none;
+}
+
+/*.idlException*/
+.idlExceptionID {
+    font-weight:    bold;
+    color:  #c00;
+}
+
+.idlTypedefID, .idlTypedefType {
+    color:  #005a9c;
+}
+
+.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
+    color:  #c00;
+    font-weight:    normal;
+}
+
+.excName a {
+    font-family:    monospace;
+}
+
+.idlRaises a.idlType, .excName a.idlType {
+    border-bottom:  1px dotted #c00;
+}
+
+.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
+    width:  45px;
+    text-align: center;
+}
+.excGetSetTrue, .prmNullTrue, .prmOptTrue { color:  #0c0; }
+.excGetSetFalse, .prmNullFalse, .prmOptFalse { color:  #c00; }
+
+.idlImplements a {
+    font-weight:    bold;
+}
+
+dl.attributes, dl.methods, dl.constants {
+    margin-left:    2em;
+}
+
+.attributes dt, .methods dt, .constants dt {
+    font-weight:    normal;
+}
+
+.attributes dt code, .methods dt code, .constants dt code {
+    font-weight:    bold;
+    color:  #000;
+    font-family:    monospace;
+}
+
+.attributes dt code {
+    background:  #ffffd2;
+}
+
+.attributes dt .idlAttrType code {
+    color:  #005a9c;
+    background:  transparent;
+    font-family:    inherit;
+    font-weight:    normal;
+    font-style: italic;
+}
+
+.methods dt code {
+    background:  #d9e6f8;
+}
+
+.constants dt code {
+    background:  #ddffd2;
+}
+
+.attributes dd, .methods dd, .constants dd {
+    margin-bottom:  1em;
+}
+
+table.parameters, table.exceptions {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    margin: 0.5em 0;
+    width:  100%;
+}
+table.parameters { border-bottom:  1px solid #90b8de; }
+table.exceptions { border-bottom:  1px solid #deb890; }
+
+.parameters th, .exceptions th {
+    color:  #fff;
+    padding:    3px 5px;
+    text-align: left;
+    font-family:    initial;
+    font-weight:    normal;
+    text-shadow:    #666 1px 1px 0;
+}
+.parameters th { background: #90b8de; }
+.exceptions th { background: #deb890; }
+
+.parameters td, .exceptions td {
+    padding:    3px 10px;
+    border-top: 1px solid #ddd;
+    vertical-align: top;
+}
+
+.parameters tr:first-child td, .exceptions tr:first-child td {
+    border-top: none;
+}
+
+.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
+    width:  100px;
+}
+
+.parameters td.prmType {
+    width:  120px;
+}
+
+table.exceptions table {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    width:  100%;
+}
+
+/* --- TOC --- */
+.toc a {
+    text-decoration:    none;
+}
+
+a .secno {
+    color:  #000;
+}
+
+/* --- TABLE --- */
+table.simple {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    border-bottom:  3px solid #005a9c;
+}
+
+.simple th {
+    background: #005a9c;
+    color:  #fff;
+    padding:    3px 5px;
+    text-align: left;
+}
+
+.simple th[scope="row"] {
+    background: inherit;
+    color:  inherit;
+    border-top: 1px solid #ddd;
+}
+
+.simple td {
+    padding:    3px 10px;
+    border-top: 1px solid #ddd;
+}
+
+.simple tr:nth-child(even) {
+    background: #f0f6ff;
+}
+
+/* --- DL --- */
+.section dd > p:first-child {
+    margin-top: 0;
+}
+
+.section dd > p:last-child {
+    margin-bottom: 0;
+}
+
+.section dd {
+    margin-bottom:  1em;
+}
+
+.section dl.attrs dd, .section dl.eldef dd {
+    margin-bottom:  0;
+}
+
+/* --- EXAMPLES --- */
+pre.example {
+    border-top: 1px solid #ff4500;
+    border-bottom: 1px solid #ff4500;
+    padding:    1em;
+    margin:     2em 0;
+}
+
+pre.example::before {
+    content:    "Example";
+    display:    block;
+    width:      150px;
+    background: #ff4500;
+    color:  #fff;
+    font-family:    initial;
+    padding:    3px;
+    font-weight:    bold;
+    margin: -1em 0 1em -1em;
+}
+
+/* --- EDITORIAL NOTES --- */
+.issue {
+    padding:    1em;
+    border: 1px solid #f00;
+    background: #ffc;
+}
+
+.issue::before {
+    content:    "Issue";
+    display:    block;
+    width:  150px;
+    margin: -1.5em 0 0.5em 0;
+    font-weight:    bold;
+    border: 1px solid #f00;
+    background: #fff;
+    padding:    3px 1em;
+}
+
+.note {
+    padding:    1em;
+    border: 2px solid #cff6d9;
+    background: #e2fff0;
+}
+
+.note::before {
+    content:    "Note";
+    display:    block;
+    width:  150px;
+    margin: -1.5em 0 0.5em 0;
+    font-weight:    bold;
+    border: 1px solid #cff6d9;
+    background: #fff;
+    padding:    3px 1em;
+}
+
+
+/* --- SYNTAX HIGHLIGHTING --- */
+/* Pretty printing styles. Used with prettify.js. */
+.str { color: #080; }
+.kwd { color: #008; }
+.com { color: #800; }
+.typ { color: #606; }
+.lit { color: #066; }
+.pun { color: #660; }
+.pln { color: #000; }
+.tag { color: #008; }
+.atn { color: #606; }
+.atv { color: #080; }
+.dec { color: #606; }
+/*pre.prettyprint { padding: 2px; border: 1px solid #888 }*/
+
+/* Specify class=linenums on a pre to get line numbering */
+ol.linenums { margin-top: 0; margin-bottom: 0 } /* IE indents via margin-left */
+li.L0, li.L1, li.L2, li.L3, li.L5, li.L6, li.L7, li.L8 { list-style-type: none }
+/* Alternate shading for lines */
+li.L1, li.L3, li.L5, li.L7, li.L9 { background: #eee }
+
+@media print {
+  .str { color: #060; }
+  .kwd { color: #006; font-weight: bold; }
+  .com { color: #600; font-style: italic; }
+  .typ { color: #404; font-weight: bold; }
+  .lit { color: #044; }
+  .pun { color: #440; }
+  .pln { color: #000; }
+  .tag { color: #006; font-weight: bold; }
+  .atn { color: #404; }
+  .atv { color: #060; }
+}
+</style><link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" type="text/css" media="all" charset="utf-8"></head>
+
+  <body><div class="head">
+    <p>
+
+      <a href="http://www.w3.org/"><img width="72" height="48" src="http://www.w3.org/Icons/w3c_home" alt="W3C"></a>
+
+
+    </p>
+    <h1 class="title" id="title" rel="dc:title">Networked Service Discovery and Messaging</h1>
+
+    <h2 id="w3c-editor-s-draft-22-august-2012"><acronym title="World Wide Web Consortium">W3C</acronym> Editor's Draft 22 August 2012</h2>
+    <dl>
+
+        <dt>This Version:</dt><dd>   <a href="http://w3c-test.org/dap/discovery-api/">http://w3c-test.org/dap/discovery-api/</a></dd>
+        <dt>Latest Published Version:</dt><dd>   <a href="http://www.w3.org/TR/discovery-api/">http://www.w3.org/TR/discovery-api/</a></dd>
+
+          <dt>Latest Editor's Draft:</dt><dd>   <a href="http://w3c-test.org/dap/discovery-api/">http://w3c-test.org/dap/discovery-api/</a></dd>
+
+
+
+
+          <dt>Previous version:</dt><dd>   <a href="http://www.w3.org/TR/2012/WD-discovery-api-20120807/" rel="dc:replaces">http://www.w3.org/TR/2012/WD-discovery-api-20120807/</a></dd>
+
+
+
+
+
+    <dt>Editors:</dt>
+
+      <dd class="Editor" rel="bibo:editor"><span typeof="foaf:Person"><span class="name" property="foaf:name">Rich Tibbett</span>,
+
+            <a class="company" href="http://opera.com/" rel="foaf:workplaceHomepage">Opera Software ASA</a>
+
+
+
+
+      </span></dd>
+
+      <dd class="Editor" rel="bibo:editor"><span typeof="foaf:Person"><span class="name" property="foaf:name">Clarke Stevens</span>,
+
+            <a class="company" href="http://cablelabs.com/" rel="foaf:workplaceHomepage">CableLabs</a>
+
+
+
+
+      </span></dd>
+
+
+
+
+
+
+    </dl>
+
+
+
+
+
+    <p class="copyright">
+
+      <a class="license" href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright" rel="license">Copyright</a> ©
+      2012
+
+      <span rel="dcterms:publisher"><a class="publisher" href="http://www.w3.org/" rel="foaf:homepage" property="foaf:name" content="W3C"><acronym title="World Wide Web Consortium"><acronym title="World Wide Web Consortium">W3C</acronym></acronym></a></span><sup>®</sup>
+      (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology"><acronym title="Massachusetts Institute of Technology">MIT</acronym></acronym></a>,
+      <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></acronym></a>,
+      <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
+      <acronym title="World Wide Web Consortium">W3C</acronym> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+      <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
+      <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+
+    </p><hr></div>
+    <div id="abstract" class="introductory section" property="dcterms:absract" datatype="" about="#abstract" typeof="bibo:Chapter"><h2>Abstract</h2>
+      <p>
+        This specification defines a mechanism for an HTML document to discover and subsequently communicate with <acronym title="Hypertext Transfer Protocol"><acronym title="Hypertext Transfer Protocol">HTTP</acronym></acronym>-based services
+        advertised via common discovery protocols within a user's network.
+      </p>
+    </div><div id="sotd" class="introductory section" about="#sotd" typeof="bibo:Chapter">
+      <h2>Status of This Document</h2>
+      <p><em>This section describes the status of this document at the time of its publication. Other
+      documents may supersede this document. A list of current <acronym title="World Wide Web Consortium">W3C</acronym> publications and the latest revision
+      of this technical report can be found in the <a href="http://www.w3.org/TR/"><acronym title="World Wide Web Consortium">W3C</acronym> technical reports
+      index</a> at http://www.w3.org/TR/.</em></p>
+
+      <p>
+        This document represents the early consensus of the group on the scope and features of the proposed
+        <acronym title="Application Programming Interface">API</acronym>.
+      </p>
+
+      <p>
+        This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs and Policy Working Group</a> as
+        a
+        Editor's Draft.
+         This document is intended to become a <acronym title="World Wide Web Consortium">W3C</acronym> Recommendation.
+        If you wish to make comments regarding this document, please send them to
+        <a href="mailto:public-device-apis@w3.org">public-device-apis@w3.org</a>
+        (<a href="mailto:public-device-apis-request@w3.org?subject=subscribe">subscribe</a>,
+        <a href="http://lists.w3.org/Archives/Public/public-device-apis/">archives</a>).
+
+
+        All feedback is welcome.
+      </p>
+
+        <p>
+          Publication as a Editor's Draft does not imply endorsement by the <acronym title="World Wide Web Consortium">W3C</acronym> Membership. This is a draft
+          document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate
+          to cite this document as other than work in progress.
+        </p>
+
+
+      <p>
+        This document was produced by a group operating under the
+        <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>.
+
+        <acronym title="World Wide Web Consortium">W3C</acronym> maintains a <a href="http://www.w3.org/2004/01/pp-impl/43696/status" rel="disclosure">public list of any patent disclosures</a>
+        made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An
+        individual who has actual knowledge of a patent which the individual believes contains
+        <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the
+        information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
+        6 of the <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>.
+      </p>
+    </div><div id="toc" about="#toc" typeof="bibo:Chapter" class="section"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a href="#conformance" class="tocxref"><span class="secno">2. </span>Conformance</a><ul class="toc"><li class="tocline"><a href="#dependencies" class="tocxref"><span class="secno">2.1 </span>Dependencies</a></li></ul></li><li class="tocline"><a href="#terminology" class="tocxref"><span class="secno">3. </span>Terminology</a></li><li class="tocline"><a href="#requesting-networked-services" class="tocxref"><span class="secno">4. </span>Requesting networked services</a><ul class="toc"><li class="tocline"><a href="#methods" class="tocxref"><span class="secno">4.1 </span>Methods</a></li><li class="tocline"><a href="#error-handling" class="tocxref"><span class="secno">4.2 </span>Error Handling</a></li></ul></li><li class="tocline"><a href="#obtaining-networked-services" class="tocxref"><span class="secno">5. </span>Obtaining networked services</a><ul class="toc"><li class="tocline"><a href="#attributes" class="tocxref"><span class="secno">5.1 </span>Attributes</a></li><li class="tocline"><a href="#methods-1" class="tocxref"><span class="secno">5.2 </span>Methods</a></li><li class="tocline"><a href="#events" class="tocxref"><span class="secno">5.3 </span>Events</a></li></ul></li><li class="tocline"><a href="#communicating-with-a-networked-service" class="tocxref"><span class="secno">6. </span>Communicating with a networked service</a><ul class="toc"><li class="tocline"><a href="#attributes-1" class="tocxref"><span class="secno">6.1 </span>Attributes</a></li><li class="tocline"><a href="#states" class="tocxref"><span class="secno">6.2 </span>States</a></li><li class="tocline"><a href="#events-1" class="tocxref"><span class="secno">6.3 </span>Events</a></li></ul></li><li class="tocline"><a href="#service-discovery" class="tocxref"><span class="secno">7. </span>Service Discovery</a><ul class="toc"><li class="tocline"><a href="#zeroconf--mdns---dns-sd" class="tocxref"><span class="secno">7.1 </span>Zeroconf (<acronym title="Multicast DNS"><acronym title="Multicast DNS">mDNS</acronym></acronym> + <acronym title="Domain Name System"><acronym title="Domain Name System">DNS</acronym></acronym>-<acronym title="Service Discovery"><acronym title="Service Discovery">SD</acronym></acronym>)</a></li><li class="tocline"><a href="#universal-plug-and-play--upnp" class="tocxref"><span class="secno">7.2 </span>Universal Plug-and-Play (<acronym title="Universal Plug-and-Play"><acronym title="Universal Plug-and-Play">UPnP</acronym></acronym>)</a></li><li class="tocline"><a href="#network-topology-monitoring" class="tocxref"><span class="secno">7.3 </span>Network Topology Monitoring</a></li></ul></li><li class="tocline"><a href="#garbage-collection" class="tocxref"><span class="secno">8. </span>Garbage collection</a></li><li class="tocline"><a href="#use-cases-and-requirements" class="tocxref"><span class="secno">9. </span>Use Cases and Requirements</a></li><li class="tocline"><a href="#examples" class="tocxref"><span class="secno">A. </span>Examples</a></li><li class="tocline"><a href="#acknowledgements" class="tocxref"><span class="secno">B. </span>Acknowledgements</a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">C. </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">C.1 </span>Normative references</a></li></ul></li></ul></div>
+
+
+
+    <div class="informative section" id="introduction" about="#introduction" typeof="bibo:Chapter">
+      <!--OddPage--><h2><span class="secno">1. </span>Introduction</h2><em>This section is non-normative.</em>
+
+      <p>To enable Web pages to connect and communicate with Local-networked Services provided over <acronym title="Hypertext Transfer Protocol">HTTP</acronym>, this specification introduces the
+      <a href="#navigatornetworkservice"><code>NavigatorNetworkService</code></a> interface.</p>
+
+      <p>
+         Using this <acronym title="Application Programming Interface"><acronym title="Application Programming Interface">API</acronym></acronym> consists of requesting a well-known service type, known by developers and advertised by Local-networked Devices. User authorization, where the user connects the web page to one or more discovered services,
+         is expected before the web page is able to interact with any Local-networked Services.
+      </p>
+
+      <p>
+         A web page creates a request to obtain connectivity to services running in the network by specifying a well-known discovery service type that it wishes to interact with.
+      </p>
+
+      <p>
+         The user agent, having captured all advertised services on the network from the Service Discovery mechanisms included in this recommendation, attempts to match
+      the requested service type to a discovered service according to the processing described herein.
+      </p>
+
+      <p>
+          If a service connectivity request is successful then the Web page is provided with the necessary information to communicate with the authorized Local-networked Service.
+          If the request fails then the Web page will receive an error callback containing an error code describing the cause of Local-networked Service connectivity failure.
+      </p>
+
+      <p>
+         Once connected to a Local-networked Service the Web page can send requests and receive responses to the Local-networked Service via the messaging format and appropriate channel inferred from the service type
+         authorized via the provided <acronym title="Application Programming Interface">API</acronym>.
+         The Web page, once connected, can also receive service-pushed events, in the messaging format supported by the Local-networked Device, if such event subscription functionality is provided by the
+         connected Local-networked Service.
+      </p>
+
+      <div class="example">
+       <p>Example of requesting a <acronym title="Domain Name System">DNS</acronym>-<acronym title="Service Discovery">SD</acronym> advertised service:</p>
+       <hr>
+       <div><div id="highlighter_667967" class="syntaxhighlighter nogutter  js"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="js keyword">function</code> <code class="js plain">showServices( services ) {</code></div><div class="line number2 index1 alt1"><code class="js spaces">&nbsp;&nbsp;</code><code class="js comments">// Show a list of all the services provided to the web page</code></div><div class="line number3 index2 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js keyword">for</code><code class="js plain">(</code><code class="js keyword">var</code> <code class="js plain">i = 0, l = services.length; i &lt; l; i++) console.log( services[i].name );</code></div><div class="line number4 index3 alt1"><code class="js plain">}</code></div><div class="line number5 index4 alt2">&nbsp;</div><div class="line number6 index5 alt1"><code class="js plain">navigator.getNetworkServices(</code><code class="js string">'zeroconf:_boxee-jsonrpc._tcp'</code><code class="js plain">, showServices);</code></div></div></td></tr></tbody></table></div></div>
+      </div>
+
+      <div class="example">
+        <p>Example of requesting a <acronym title="Universal Plug-and-Play">UPnP</acronym> advertised service, also handling error conditions:</p>
+        <hr>
+        <div><div id="highlighter_95512" class="syntaxhighlighter nogutter  js"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="js keyword">function</code> <code class="js plain">showServices( services ) {</code></div><div class="line number2 index1 alt1"><code class="js spaces">&nbsp;&nbsp;</code><code class="js comments">// Show a list of all the services provided to the web page</code></div><div class="line number3 index2 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js keyword">for</code><code class="js plain">(</code><code class="js keyword">var</code> <code class="js plain">i = 0, l = services.length; i &lt; l; i++) console.log( services[i].name );</code></div><div class="line number4 index3 alt1"><code class="js plain">}</code></div><div class="line number5 index4 alt2">&nbsp;</div><div class="line number6 index5 alt1"><code class="js keyword">function</code> <code class="js plain">error( e ) {</code></div><div class="line number7 index6 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js plain">console.log( </code><code class="js string">"Error occurred: "</code> <code class="js plain">+ e.code );</code></div><div class="line number8 index7 alt1"><code class="js plain">}</code></div><div class="line number9 index8 alt2">&nbsp;</div><div class="line number10 index9 alt1"><code class="js plain">navigator.getNetworkServices(</code><code class="js string">'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'</code><code class="js plain">, showServices, error);</code></div></div></td></tr></tbody></table></div></div>
+      </div>
+
+      <div class="example">
+        <p>Example of requesting either a <acronym title="Domain Name System">DNS</acronym>-<acronym title="Service Discovery">SD</acronym> or <acronym title="Universal Plug-and-Play">UPnP</acronym> advertised service:</p>
+        <hr>
+        <div><div id="highlighter_135617" class="syntaxhighlighter nogutter  js"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="js keyword">function</code> <code class="js plain">showServices( services ) {</code></div><div class="line number2 index1 alt1"><code class="js spaces">&nbsp;&nbsp;</code><code class="js comments">// Show a list of all the services provided to the web page (+ service type)</code></div><div class="line number3 index2 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js keyword">for</code><code class="js plain">(</code><code class="js keyword">var</code> <code class="js plain">i = 0, l = services.length; i &lt; l; i++)</code></div><div class="line number4 index3 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">console.log( services[i].name + </code><code class="js string">'('</code> <code class="js plain">+ services[i].type + </code><code class="js string">')'</code> <code class="js plain">);</code></div><div class="line number5 index4 alt2"><code class="js plain">}</code></div><div class="line number6 index5 alt1">&nbsp;</div><div class="line number7 index6 alt2"><code class="js plain">navigator.getNetworkServices([</code></div><div class="line number8 index7 alt1"><code class="js spaces">&nbsp;&nbsp;</code><code class="js string">'zeroconf:_boxee-jsonrpc._tcp'</code><code class="js plain">,</code></div><div class="line number9 index8 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js string">'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'</code></div><div class="line number10 index9 alt1"><code class="js plain">], showServices);</code></div></div></td></tr></tbody></table></div></div>
+      </div>
+
+      <p>For more detailed examples see the <a href="#examples" class="sec-ref">Examples</a> section.
+    </p></div>
+
+    <div id="conformance" about="#conformance" typeof="bibo:Chapter" class="section"><!--OddPage--><h2><span class="secno">2. </span>Conformance</h2><p>
+    As well as sections marked as non-normative, all authoring guidelines, diagrams, examples,
+    and notes in this specification are non-normative. Everything else in this specification is
+    normative.
+  </p>
+  <p>
+    The key words <em class="rfc2119" title="must">must</em>, <em class="rfc2119" title="must not">must not</em>, <em class="rfc2119" title="required">required</em>, <em class="rfc2119" title="should">should</em>, <em class="rfc2119" title="should not">should not</em>, <em class="rfc2119" title="recommended">recommended</em>, <em class="rfc2119" title="may">may</em>,
+    and <em class="rfc2119" title="optional">optional</em> in this specification are to be interpreted as described in [<cite><a class="bibref" rel="biblioentry" href="#bib-RFC2119">RFC2119</a></cite>].
+  </p>
+
+     <p>Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or "return false and abort these steps") are to be interpreted with the
+     meaning of the key word ("must", "should", "may", etc) used in introducing the algorithm.</p>
+
+     <p>
+      Some conformance requirements are phrased as requirements on attributes, methods or objects. Such requirements are to be interpreted as requirements on user agents.
+     </p>
+
+     <p>
+      Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent. (In particular, the algorithms defined in
+      this specification are intended to be easy to follow, and not intended to be performant.)
+     </p>
+
+     <p>
+      The only conformance class defined by this specification is a <dfn id="dfn-user-agent">user agent</dfn>.
+     </p>
+
+     <p>
+      User agents may impose implementation-specific limits on otherwise unconstrained inputs, e.g. to prevent denial of service attacks, to guard against running out of memory, or to work
+      around platform-specific limitations.
+     </p>
+
+     <p>
+      When support for a feature is disabled (e.g. as an emergency measure to mitigate a security problem, or to aid in development, or for performance reasons), user agents must act as if
+      they had no support for the feature whatsoever, and as if the feature was not mentioned in this specification. For example, if a particular feature is accessed via an attribute in a Web
+      IDL interface, the attribute itself would be omitted from the objects that implement that interface - leaving the attribute on the object but making it return null or throw an exception
+      is insufficient.
+     </p>
+
+      <section id="dependencies" about="#dependencies" typeof="bibo:Chapter">
+         <h3><span class="secno">2.1 </span>Dependencies</h3>
+
+         This specification relies on several other underlying specifications.
+
+         <dl>
+            <dt>HTML</dt>
+            <dd>Many fundamental concepts from HTML are used by this specification. [<cite><a class="bibref" rel="biblioentry" href="#bib-HTML5">HTML5</a></cite>]</dd>
+            <dt>WebIDL</dt>
+            <dd>The IDL blocks in this specification use the semantics of the WebIDL specification. [<cite><a class="bibref" rel="biblioentry" href="#bib-WEBIDL">WEBIDL</a></cite>]</dd>
+         </dl>
+      </section>
+    </div>
+
+    <div id="terminology" about="#terminology" typeof="bibo:Chapter" class="section">
+      <!--OddPage--><h2><span class="secno">3. </span>Terminology</h2>
+
+      <p>
+         The construction "a <code>Foo</code> object", where <code>Foo</code> is actually an interface, is sometimes used instead of the more accurate "an object implementing the interface <code>Foo</code>".
+      </p>
+
+      <p>
+         The term DOM is used to refer to the <acronym title="Application Programming Interface">API</acronym> set made available to scripts in Web applications, and does not necessarily imply the existence of an actual <code>Document</code> object or of any
+         other <code>Node</code> objects as defined in the DOM Core specifications. [<cite><a class="bibref" rel="biblioentry" href="#bib-DOM-CORE">DOM-CORE</a></cite>]
+      </p>
+
+      <p>
+         An IDL attribute is said to be <em>getting</em> when its value is being retrieved (e.g. by author script), and is said to be <em>setting</em> when a new value is assigned to it.
+      </p>
+
+      <p>
+        A <dfn id="dfn-valid-service-type">valid service type</dfn> is a string that begins with <code>upnp:</code> or <code>zeroconf:</code> followed by one or more characters in the ranges U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E.
+      </p>
+
+      <p>
+        A <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> provided in the <code>type</code> attribute of the <code>getNetworkServices()</code> method will be matched against the services currently contained in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> according to the algorithms defined in this specification.
+      </p>
+    </div>
+
+    <div id="requesting-networked-services" about="#requesting-networked-services" typeof="bibo:Chapter" class="section">
+     <!--OddPage--><h2><span class="secno">4. </span>Requesting networked services</h2>
+
+
+<pre class="widl">[Supplemental, NoInterfaceObject]
+interface <dfn id="navigatornetworkservice">NavigatorNetworkService</dfn> {
+  // Obtain a Local-networked Service
+  void <a href="#dom-navigator-getnetworkservices">getNetworkServices</a>( in any type,
+                           in <a href="#navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</a> successCallback,
+                           in optional <a href="#navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</a> errorCallback );
+};
+<a class="externalDFN" href="http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">Navigator</a> implements <a href="#navigatornetworkservice">NavigatorNetworkService</a>;
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id="navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</dfn> {
+  void handleEvent( in <a href="#networkservices">NetworkServices</a> services );
+};
+
+[NoInterfaceObject]
+interface <dfn id="navigatornetworkserviceerror">NavigatorNetworkServiceError</dfn> {
+  const unsigned short <a href="#dom-navigatornetworkserviceerror-permission_denied">PERMISSION_DENIED_ERR</a> = 1;
+  const unsigned short <a href="#dom-navigatornetworkserviceerror-unknown_type_prefix">UNKNOWN_TYPE_PREFIX_ERR</a> = 2;
+  readonly attribute unsigned short <a href="#dom-navigatornetworkserviceerror-code">code</a>;
+};
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id="navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</dfn> {
+  void handleEvent( in <a href="#navigatornetworkserviceerror">NavigatorNetworkServiceError</a> error );
+};
+</pre>
+
+  <section id="methods" about="#methods" typeof="bibo:Chapter">
+   <h3><span class="secno">4.1 </span>Methods</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">window</var>
+           .
+          <code title="dom-navigator">
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">navigator</a>
+          </code>
+           .
+          <code title="dom-navigator-getNetworkServices">
+            <a href="#dom-navigator-getnetworkservices">getNetworkServices</a>
+          </code>
+          (
+          <var title="">type</var>
+          ,
+          <var title="">successCallback</var>
+           [,
+          <var title="">errorCallback</var>
+           ] )
+        </dt>
+        <dd>
+          <p>Prompts the user to select one or more discovered network services that have advertised support for the requested service type.</p>
+          <p>
+            The
+            <var title="">type</var>
+             argument contains one or more <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens that the web page would like to interact with.
+          </p>
+          <p>
+            If the user accepts, the
+            <var title="">successCallback</var>
+             is
+          invoked, with one or more
+            <code>
+              <a href="#networkservice"><code>NetworkService</code></a>
+            </code>
+             objects as
+          its argument.
+          </p>
+          <p>
+            If the user declines, the
+            <var title="">errorCallback</var>
+             (if
+          any) is invoked.
+          </p>
+        </dd>
+      </dl>
+
+       <div>
+          <p>
+            When the <dfn id="dom-navigator-getnetworkservices" title="dom-navigator-getnetworkservices"><code>getNetworkServices(type, successCallback[, errorCallback])</code></dfn> method is called, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> run the following steps:
+          </p>
+
+          <ol class="rule">
+
+            <li>
+              Let <var>requested control types</var> be initially set to an empty array.
+            </li>
+
+            <li>
+               If <var>type</var> is an array consisting of one or more <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens, then let <var>requested control types</var> by the value of <var>type</var>, removing any non-<a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens from the resulting array.
+            </li>
+
+            <li>
+               If <var>type</var> is a string consisting of one <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> token, then let <var>requested control types</var> be an array containing one item with a value of <var>type</var>.
+            </li>
+
+            <li>
+               If <var>requested control types</var> is an array that contains at least one or more <a title="valid service type" href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens then continue to the step labeled <em>process</em> below. Otherwise, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 2
+                  (<a href="#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a>) as its argument,
+                   abort any remaining steps and return.
+            </li>
+
+            <li>
+               <em>Process</em>: Let <var>services found</var> be an empty array.
+            </li>
+
+            <li>
+               For each <var>available service</var> in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> run the following steps:
+               <ol class="rule">
+                  <li>
+                    For each <var>requested control type</var> in <var>requested control types</var>: If <var>available service</var>'s <code>type</code> attribute equals the <var>requested control type</var> then let <var>matched service</var> equal the value of <var>available service</var> and continue at the step labeled <var>attach</var> below.
+                  </li>
+                  <li>
+                     Continue at the next <var>available service</var>.
+                  </li>
+                  <li>
+                     <em>Attach</em>: If <var>matched service</var> is not empty then run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>new service object</var> be a new <a href="#networkservice"><code>NetworkService</code></a> object, mapping the parameters of
+                     <var>matched service</var> to this new object where possible.
+                        </li>
+                        <li>
+                           Append <var>new service object</var> to the <var>services found</var> array.
+                        </li>
+                     </ol>
+                  </li>
+               </ol>
+            </li>
+
+            <li>
+               If <var>services found</var> is an empty array, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                 (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+            </li>
+
+            <li>
+               Return, and run the remaining steps asynchronously.
+            </li>
+
+            <li>
+               Optionally, e.g. based on a previously-established user preference, for security reasons, or due to platform limitations, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="may">may</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                 (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+            </li>
+
+            <li>
+                  The <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> prompt the user in a user-agent-specific manner for permission to provide the
+                  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s
+                  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> with an array of
+                  <a href="#networkservice"><code>NetworkService</code></a> objects representing the user-authorized subset of <var>services found</var>.
+
+               <p>
+                  If the user grants permission to access one or more networked services then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="should">should</em> include an
+                  "ongoing local-network communication" indicator.
+               </p>
+
+               <p>If the user denies permission, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+              </p>
+
+              <p>
+                If the user never responds, this algorithm stalls on this step.
+              </p>
+
+            </li>
+
+            <li>
+               Let <var>services</var> be the array of one or more <a href="#networkservice"><code>NetworkService</code></a> objects for which the user granted permission.
+            </li>
+
+            <li>
+               For each Object <var>service</var> in <var>services</var>, run the following substeps:
+
+               <ol class="rule">
+                  <li>
+                     Add the <var>service</var>'s <code>url</code> parameter to the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <acronym title="Uniform Resource Locator"><acronym title="Uniform Resource Locator">URL</acronym></acronym> whitelist</a>.
+                  </li>
+                  <li>
+                    If <var>service</var>'s <code>type</code> parameter begins with the DOMString "<code>upnp:</code>" and the <var>service</var>'s <code>eventsUrl</code> parameter is not empty then <a href="#dfn-setup-a-upnp-events-subscription" class="internalDFN">setup a <acronym title="Universal Plug-and-Play">UPnP</acronym> Events Subscription</a> for <var>service</var>.
+                  </li>
+               </ol>
+            </li>
+
+            <li>
+               Let <var>services manager</var> be a new <a href="#networkservices"><code>NetworkServices</code></a> object.
+            </li>
+
+            <li>
+               Set <var>services manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to the length of <var>services</var>.
+            </li>
+
+            <li>
+              Store the set of <var>services</var> as <dfn id="current_authorized_services">current authorized services</dfn> internally against the newly created <var>services manager</var> object.
+            </li>
+
+            <li>
+               The <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>successCallback</var> with
+               <var>services manager</var> as its argument.
+            </li>
+
+          </ol>
+
+          <p>
+            The <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#task-source" class="externalDFN">task source</a> for these
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#concept-task" class="externalDFN">tasks</a> is the
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#user-interaction-task-source" class="externalDFN">user interaction task source</a>.
+          </p>
+
+          <p>
+            When a <a href="#networkservice"><code>NetworkService</code></a> object is provided to a Web page, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> add the <code>url</code> property
+             to the <dfn id="dfn-entry-script-origin-s-url-whitelist">entry script origin's <acronym title="Uniform Resource Locator">URL</acronym> whitelist</dfn>. This list enables the
+            Web page to override and initiate cross-site resource requests towards these URLs, and any sub-resources of these URLs, within the current
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> via various existing mechanisms (e.g. Web Sockets, Server-Sent Events,
+            Web Messaging, XMLHttpRequest).
+         </p>
+
+         <p>
+            If the user navigates away from the current browsing context, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> remove all previously whitelisted urls from the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <acronym title="Uniform Resource Locator">URL</acronym> whitelist</a>.
+            There is no persistence to network service selections provided to a web page. It is not possible to access a previously white-listed networked service without the necessary user authorization in all of the following cases:
+            </p><ul>
+              <li>If the current script is reloaded at any point in the same or different window.</li>
+              <li>if the current script reinvokes the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method at any point in its execution.</li>
+              <li>If the user navigates forward or back in their history to reload the current page.</li>
+              <li>If a script is running in a different origin.</li>
+            </ul>
+         <p></p>
+
+      </div>
+      </section>
+
+      <section id="error-handling" about="#error-handling" typeof="bibo:Chapter">
+         <h3><span class="secno">4.2 </span>Error Handling</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">error</var>
+           .
+          <code title="dom-NavigatorNetworkServiceError-code">
+            <a href="#dom-navigatornetworkserviceerror-code">code</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            Returns the current error's error code. At the current time, this may be <code>1</code> or <code>2</code>, for which the
+            corresponding error constants
+            <a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a> and
+            <a href="#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a> are defined.
+          </p>
+        </dd>
+      </dl>
+
+         <p>
+            The <dfn id="dom-navigatornetworkserviceerror-code" title="dom-navigatornetworkserviceerror-code"><code>code</code></dfn> attribute of a
+            <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object <em class="rfc2119" title="must">must</em> return the code for the error, which will be one of the following:
+         </p>
+
+         <dl>
+            <dt>
+               <dfn id="dom-navigatornetworkserviceerror-permission_denied" title="dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></dfn> (numeric value 1)
+            </dt>
+            <dd>
+               The user denied the page permission to access any services.
+            </dd>
+            <dt>
+               <dfn id="dom-navigatornetworkserviceerror-unknown_type_prefix" title="dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></dfn> (numeric value 2)
+            </dt>
+            <dd>
+               No <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens were provided in the method invocation.
+            </dd>
+         </dl>
+
+      </section>
+
+      </div>
+      <div id="obtaining-networked-services" about="#obtaining-networked-services" typeof="bibo:Chapter" class="section">
+      <!--OddPage--><h2><span class="secno">5. </span>Obtaining networked services</h2>
+
+      <p>
+         The <a href="#networkservices"><code>NetworkServices</code></a> interface is the top-level response object from a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> and provides access to a set of user-authorized <a href="#networkservice"><code>NetworkService</code></a> objects for the given request.
+      </p>
+
+<pre class="widl">[NoInterfaceObject]
+interface <dfn id="networkservices">NetworkServices</dfn> {
+  readonly attribute unsigned long    <a href="#dom-networkservices-length">length</a>;
+  getter <a href="#networkservice">NetworkService</a> (unsigned long index);
+  <a href="#networkservice">NetworkService</a>? <a href="#dom-networkservices-getservicebyid">getServiceById</a>(DOMString id);
+
+  readonly attribute unsigned long    <a href="#dom-networkservices-servicesavailable">servicesAvailable</a>;
+
+  // event handler attributes
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservices-onserviceavailable">onserviceavailable</a>;
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservices-onserviceunavailable">onserviceunavailable</a>;
+
+};
+
+<a href="#networkservices">NetworkServices</a> implements <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" class="externalDFN">EventTarget</a>;
+</pre>
+
+      <section id="attributes" about="#attributes" typeof="bibo:Chapter">
+      <h3><span class="secno">5.1 </span>Attributes</h3>
+
+        <dl class="domintro">
+          <dt>
+            <code title="dom-networkservices-length">
+              <a href="#dom-networkservices-length">length</a>
+            </code>
+          </dt>
+          <dd>
+            <p>
+              Returns the current number of services in the respective object's <a href="#current_authorized_services" class="internalDFN">current authorized services</a>.
+            </p>
+          </dd>
+          <dt>
+            <code title="dom-networkservices-servicesavailable">
+              <a href="#dom-networkservices-servicesavailable">servicesAvailable</a>
+            </code>
+          </dt>
+          <dd>
+            <p>
+              Returns the current number of services matching one of the app-requested <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens that are actively available within the user's current network.
+            </p>
+          </dd>
+        </dl>
+
+        <div>
+           <p>
+              The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute <em class="rfc2119" title="must">must</em> return the number of services represented in the object's corresponding <a href="#current_authorized_services" class="internalDFN">current authorized services</a> list at the time of getting.
+           </p>
+
+           <p>
+              The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute <em class="rfc2119" title="must">must</em> return the number of services available in the
+              user's network that match the <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> that was initially used to create the current <a href="#networkservices"><code>NetworkServices</code></a> object.
+           </p>
+
+           <p>
+             When a previously unknown instance of a networked service matching one of the requested <a href="#dfn-valid-service-type">valid service types</a> becomes available on the user's current network, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> increment the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> and then
+             <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+             to dispatch a newly created event with the name <code>serviceavailable</code> that uses the <code>Event</code> interface, which does
+             not bubble, is not cancellable, and has no default action, at the current <a href="#networkservices"><code>NetworkServices</code></a>
+             object.
+           </p>
+
+           <p>
+             When a previously known instance of a networked service matching one of the requested <a href="#dfn-valid-service-type">valid service types</a> becomes unavailable on the user's current network, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> decrement the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> and then
+             <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+              to dispatch a newly created event with the name <code>serviceunavailable</code> that uses the <code>Event</code> interface, which does
+              not bubble, is not cancellable, and has no default action, at the current <a href="#networkservices"><code>NetworkServices</code></a>
+              object.
+           </p>
+        </div>
+
+      </section>
+
+      <section id="methods-1" about="#methods-1" typeof="bibo:Chapter">
+      <h3><span class="secno">5.2 </span>Methods</h3>
+        <dl class="domintro">
+        <dt>
+          <code title="networkservices-getter">
+            <a href="#networkservices">services</a>
+          </code>
+          [
+          <var title="">index</var>
+          ]
+        </dt>
+        <dd>
+          <p>
+            Returns the specified <a href="#networkservice"><code>NetworkService</code></a> object.
+          </p>
+        </dd>
+        <dt>
+          <code title="networkservices-getter">
+            <a href="#networkservices">services</a>
+          </code>
+          .
+          <code title="dom-networkservices-getservicebyid">
+            <a href="#dom-networkservices-getservicebyid">getServiceById</a>
+          </code>
+          (
+          <var title="">id</var>
+          )
+        </dt>
+        <dd>
+          <p>
+            Returns the <a href="#networkservice"><code>NetworkService</code></a> object with the given identifier, or null if no
+            service has that identifier.
+          </p>
+        </dd>
+      </dl>
+
+      <p>
+        A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current list of zero or more <a href="#current_authorized_services" class="internalDFN">current authorized services</a>, of which zero or more can be available at a time. Each item in <a href="#current_authorized_services" class="internalDFN">current authorized services</a> is represented by a <a href="#networkservice"><code>NetworkService</code></a> object. The list of <a href="#current_authorized_services" class="internalDFN">current authorized services</a> is <span>immutable</span> meaning that it cannot be modified for the lifetime of a <a href="#networkservices"><code>NetworkServices</code></a> object.
+      </p>
+
+      <p class="note">
+        Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the first has the index 0, and each subsequent service is numbered one higher than the previous one. If the <a href="#dfn-user-agent" class="internalDFN">user agent</a> dynamically adds or removes network services for any reason, then the indices of the services in <a href="#current_authorized_services" class="internalDFN">current authorized services</a> will change dynamically. If the set of network services changes entirely, then all the previous services will be removed from <a href="#current_authorized_services" class="internalDFN">current authorized services</a> and replaced with new services.
+      </p>
+
+      <p>
+        The <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a> of <a href="#networkservices"><code>NetworkServices</code></a> objects at any instant are the numbers from zero to the number of items in <a href="#current_authorized_services" class="internalDFN">current authorized services</a> represented by the respective object minus one, if any services are represented in <a href="#current_authorized_services" class="internalDFN">current authorized services</a>. If a <a href="#networkservices"><code>NetworkServices</code></a> object represents no <a href="#current_authorized_services" class="internalDFN">current authorized services</a>, it has no <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a>.
+      </p>
+
+      <p>
+        To <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#determine-the-value-of-an-indexed-property" class="externalDFN">determine the value of an indexed property</a> for a given index <var>index</var> in a <a href="#networkservices"><code>NetworkServices</code></a> object's <a href="#current_authorized_services" class="internalDFN">current authorized services</a>, the user agent <em class="rfc2119" title="must">must</em> return the <a href="#networkservice"><code>NetworkService</code></a> object that represents the <var>index</var>th service in <a href="#current_authorized_services" class="internalDFN">current authorized services</a>.
+      </p>
+
+      <p>
+        The <dfn id="dom-networkservices-getservicebyid"><code>getServiceById(id)</code></dfn> method <em class="rfc2119" title="must">must</em> return the first <a href="#networkservice"><code>NetworkService</code></a> object in <a href="#current_authorized_services" class="internalDFN">current authorized services</a> represented by the respective object whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to the value of the <var>id</var> argument.
+        When no services in <a href="#current_authorized_services" class="internalDFN">current authorized services</a> match the given argument, the method <em class="rfc2119" title="must">must</em> return null.
+      </p>
+
+      <p>
+         Services available within the local network can connect and disconnect at different times during the execution of a web page. A <a href="#dfn-user-agent" class="internalDFN">user agent</a> can
+         inform a web page when the state of networked services matching the requested <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> change. Web pages can use this information to enable in-page experiences for communicating the state of networked services
+         with the ability to change the particular service or set of services the page is connected to by re-invoking the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method.
+      </p>
+
+      </section>
+
+      <section id="events" about="#events" typeof="bibo:Chapter">
+      <h3><span class="secno">5.3 </span>Events</h3>
+
+      <p>
+         The following are the event handlers (and their corresponding event handler event types) that must be supported, as IDL attributes, by all objects implementing the <a href="#networkservices"><code>NetworkServices</code></a> interface:
+       </p>
+
+       <table border="1">
+        <thead>
+          <tr>
+            <th>
+              <span title="event handlers">Event handler</span>
+            </th>
+            <th>
+              <span>Event handler event type</span>
+            </th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr>
+            <td>
+              <dfn id="dom-networkservices-onserviceavailable" title="dom-NetworkServices-onserviceavailable">
+                <code>onserviceavailable</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-serviceavailable">serviceavailable</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservices-onserviceunavailable" title="dom-NetworkServices-onserviceunavailable">
+                <code>onserviceunavailable</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-serviceunavailable">serviceunavailable</code>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+
+      <p>
+         Events with an event type of <code>serviceavailable</code> or <code>serviceunavailable</code> defined in this specification are simple <code>Event</code> objects.
+      </p>
+
+      </section>
+
+    </div>
+    <div id="communicating-with-a-networked-service" about="#communicating-with-a-networked-service" typeof="bibo:Chapter" class="section">
+    <!--OddPage--><h2><span class="secno">6. </span>Communicating with a networked service</h2>
+
+<p>
+   The <a href="#networkservice"><code>NetworkService</code></a> interface is used to provide a set of connection information for an <acronym title="Hypertext Transfer Protocol">HTTP</acronym> service endpoint and if available, service events, running on a networked device.
+</p>
+
+<pre class="widl">[NoInterfaceObject]
+interface <dfn id="networkservice">NetworkService</dfn> {
+  readonly attribute DOMString        <a href="#dom-networkservice-id">id</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-name">name</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-type">type</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-url">url</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-config">config</a>;
+
+  readonly attribute boolean          <a href="#dom-networkservice-online">online</a>;
+
+  // event handler attributes
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onserviceonline">onserviceonline</a>;
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onserviceoffline">onserviceoffline</a>;
+
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onnotify">onnotify</a>;
+};
+
+<a href="#networkservice">NetworkService</a> implements <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" class="externalDFN">EventTarget</a>;
+</pre>
+
+<section id="attributes-1" about="#attributes-1" typeof="bibo:Chapter">
+  <h3><span class="secno">6.1 </span>Attributes</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-id">
+            <a href="#dom-networkservice-id">id</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            A unique identifier for the given user-selected service instance.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-name">
+            <a href="#dom-networkservice-name">name</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The name of the user-selected service.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-type">
+            <a href="#dom-networkservice-type">type</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> token value of the user-selected service.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-url">
+            <a href="#dom-networkservice-url">url</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The control <acronym title="Uniform Resource Locator">URL</acronym> endpoint (including any required port information) of the user-selected control service that has been added to the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <acronym title="Uniform Resource Locator">URL</acronym> whitelist</a>.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-config">
+            <a href="#dom-networkservice-config">config</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The configuration information associated with the service depending on the requested service type.
+          </p>
+        </dd>
+      </dl>
+
+          <p>
+            The <dfn id="dom-networkservice-id"><code>id</code></dfn> attribute is a unique identifier for the service. Two services provided at different times or on different objects <em class="rfc2119" title="must">must</em> have the same <a href="#dom-networkservice-id"><code>id</code></a> value.
+         </p>
+
+         <p>
+            The <dfn id="dom-networkservice-name"><code>name</code></dfn> attribute represents a human-readable title for the service.
+         </p>
+
+         <p>
+             The <dfn id="dom-networkservice-type"><code>type</code></dfn> attribute reflects the value of the <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> of the service.
+          </p>
+
+         <p>
+            The <dfn id="dom-networkservice-url"><code>url</code></dfn> attribute is an <a href="http://www.w3.org/TR/html5/urls.html#absolute-url" class="externalDFN">absolute <acronym title="Uniform Resource Locator">URL</acronym></a> pointing to the root <acronym title="Hypertext Transfer Protocol">HTTP</acronym>
+            endpoint for the service that has been added to the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <acronym title="Uniform Resource Locator">URL</acronym> whitelist</a>. Web pages can subsequently use this value for implicit cross-document messaging via various existing mechanisms (e.g. Web Sockets, Server-Sent Events, Web Messaging, XMLHttpRequest).
+         </p>
+
+         <p>
+            The <dfn id="dom-networkservice-config"><code>config</code></dfn> attribute provides the raw configuration information extracted from the given network service.
+         </p>
+
+      </section>
+
+      <section id="states" about="#states" typeof="bibo:Chapter">
+         <h3><span class="secno">6.2 </span>States</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-online">
+            <a href="#dom-networkservice-online">online</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            Returns <code>true</code> if the service is reporting that it is accessible on the local network or <code>false</code> if the service is reporting that it is no longer accessible (temporarily or permanently) on the local network.
+          </p>
+        </dd>
+      </dl>
+
+      <p>
+        The <dfn id="dom-networkservice-config"><code>online</code></dfn> attribute indicates whether the service is reporting itself as being
+        either <var>online</var>, and therefore accessible on the local network, in which case this attribute will return <code>true</code> or, <var>offline</var>, and therefore not accessible on the local network, either temporarily or permanently, in which case this attribute will return <code>false</code>. This attribute <em class="rfc2119" title="must">must</em> default to <code>true</code>.
+      </p>
+
+      </section>
+
+      <section id="events-1" about="#events-1" typeof="bibo:Chapter">
+         <h3><span class="secno">6.3 </span>Events</h3>
+
+      <p>
+         The following are the event handlers (and their corresponding event handler event types) that must be supported, as IDL attributes, by all objects implementing the
+         <a href="#networkservice"><code>NetworkService</code></a> interface:
+       </p>
+
+       <table border="1">
+        <thead>
+          <tr>
+            <th>
+              <span title="event handlers">Event handler</span>
+            </th>
+            <th>
+              <span>Event handler event type</span>
+            </th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-onnotify" title="dom-NetworkService-onnotify">
+                <code>onnotify</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-notify">notify</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-onserviceonline" title="dom-NetworkService-onserviceonline">
+                <code>onserviceonline</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-onserviceonline">serviceonline</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-offserviceoffline" title="dom-NetworkService-onserviceoffline">
+                <code>onserviceoffline</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-onserviceoffline">serviceoffline</code>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+
+      <p>
+         Events with an event type of <code>notify</code>, <code>serviceonline</code> or <code>serviceoffline</code> defined in this specification are simple <code>Event</code> objects.
+      </p>
+
+      </section>
+   </div>
+
+      <div id="service-discovery" about="#service-discovery" typeof="bibo:Chapter" class="section">
+            <!--OddPage--><h2><span class="secno">7. </span>Service Discovery</h2>
+
+      <p>
+         A <a href="#dfn-user-agent" class="internalDFN">user agent</a> conforming to this specification <em class="rfc2119" title="may">may</em> implement <acronym title="Simple Service Discovery Protocol"><acronym title="Simple Service Discovery Protocol">SSDP</acronym></acronym> [<cite><a class="bibref" rel="biblioentry" href="#bib-UPNP">UPNP</a></cite>] and Zeroconf [<cite><a class="bibref" rel="biblioentry" href="#bib-DNS-SD">DNS-SD</a></cite>] + [<cite><a class="bibref" rel="biblioentry" href="#bib-MDNS">MDNS</a></cite>] service discovery mechanisms
+         to enable Web pages to request and connect with <acronym title="Hypertext Transfer Protocol">HTTP</acronym> services running on networked devices, discovered via either mechanism, through this <acronym title="Application Programming Interface">API</acronym>. When a <a href="#dfn-user-agent" class="internalDFN">user agent</a> implements either of these service discovery mechanisms, then it <em class="rfc2119" title="must">must</em> conform to the corresponding algorithms provided in this section of the specification.
+      </p>
+      <p>
+         This section presents how the results of these two service discovery
+         mechanisms will be matched to requested service types and how their properties will be applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
+      </p>
+
+      <p>
+         It is expected that user agents will perform these service discovery mechansisms asynchronously and periodically update the <a>list of networked devices</a> as required. The timing of any
+         service discovery mechanisms is an implementation detail left to the discretion of the implementer (e.g. once on user agent start-up, every X seconds during user agent execution or on
+         invocation of this <acronym title="Application Programming Interface">API</acronym> from a Web page).
+      </p>
+
+      <p>
+         The <dfn id="dfn-list-of-available-service-records">list of available service records</dfn> is a single dynamic internal lookup table within user agents that is used to track the current services available in the network at any given time.
+         At any point during the running of either of the two service discovery mechanisms then existing entries within this table can be updated, entries can be added and entries can be removed as the status of networked
+         services changes. Each record contained within this table contains the attributes: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code> and <code>config</code>.
+      </p>
+
+            <section id="zeroconf--mdns---dns-sd" about="#zeroconf--mdns---dns-sd" typeof="bibo:Chapter">
+         <h3><span class="secno">7.1 </span>Zeroconf (<acronym title="Multicast DNS"><acronym title="Multicast DNS">mDNS</acronym></acronym> + <acronym title="Domain Name System"><acronym title="Domain Name System">DNS</acronym></acronym>-<acronym title="Service Discovery"><acronym title="Service Discovery">SD</acronym></acronym>)</h3>
+
+         <p>
+            For each <acronym title="Domain Name System">DNS</acronym> response received from a user-agent-initiated Multicast <acronym title="Domain Name System">DNS</acronym> Browse for <acronym title="DNS Pointer Record"><acronym title="DNS Pointer Record">PTR</acronym></acronym> records with the name <code>_services._dns-sd._udp</code> on the resolved recommended automatic browsing
+   domain [<cite><a class="bibref" rel="biblioentry" href="#bib-MDNS">MDNS</a></cite>], the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> run the following steps:
+         </p>
+
+         <ol class="rule">
+
+            <li>Let <var>service <acronym title="Multicast DNS">mDNS</acronym> responses</var> be an array of <acronym title="DNS Pointer Record">PTR</acronym> records received by issuing a Multicast <acronym title="Domain Name System">DNS</acronym> Browse for <acronym title="DNS Pointer Record">PTR</acronym> records with the name of the current discovered service type.</li>
+
+            <li>For each Object <var>service <acronym title="Multicast DNS">mDNS</acronym> response</var> in <var>service <acronym title="Multicast DNS">mDNS</acronym> responses</var>, run the following steps:
+               <ol>
+
+                  <li>
+                     Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>config</code>.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>id</code> property to the value of the full <acronym title="DNS Pointer Record">PTR</acronym> Service Instance Name [<cite><a class="bibref" rel="biblioentry" href="#bib-MDNS">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>name</code> property to the value of the <acronym title="DNS Pointer Record">PTR</acronym> Service Instance Name's <var>Instance</var> component [<cite><a class="bibref" rel="biblioentry" href="#bib-MDNS">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string <code>zeroconf:</code> followed by the value of the <acronym title="DNS Pointer Record">PTR</acronym> Service Instance Name's <var>Service</var> component [<cite><a class="bibref" rel="biblioentry" href="#bib-MDNS">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>url</code> property to the resolvable Service <acronym title="Uniform Resource Locator">URL</acronym> obtained from performing an <acronym title="Domain Name System">DNS</acronym>-<acronym title="Service Discovery">SD</acronym> Lookup [<cite><a class="bibref" rel="biblioentry" href="#bib-DNS-SD">DNS-SD</a></cite>] of the current service from the <acronym title="DNS Pointer Record">PTR</acronym> record provided [<cite><a class="bibref" rel="biblioentry" href="#bib-MDNS">MDNS</a></cite>].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>config</code> property to the string value of the contents of the first <acronym title="Domain Name System">DNS</acronym>-<acronym title="Service Discovery">SD</acronym> TXT record associated with the <var>service <acronym title="Multicast DNS">mDNS</acronym> response</var> as defined in [<cite><a class="bibref" rel="biblioentry" href="#bib-DNS-SD">DNS-SD</a></cite>].
+                  </li>
+
+                  <li>
+                     For each Object <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>, run the following sub-steps:
+                     <ol class="rule">
+
+                       <li>
+                        If the <var>existing service record</var>'s <code>id</code> property matches the value of the <var>network service record</var>'s <code>id</code>, then set the
+                        value of <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>  to the value of the
+                        <var>network service record</var> and skip the next step.
+                       </li>
+                     </ol>
+                  </li>
+
+                  <li>
+                     Add <var>network service record</var> to the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>.
+                  </li>
+
+                  <li>
+                     For each non-garbage collected <a href="#networkservice"><code>NetworkService</code></a> object run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           If the <a href="#networkservice"><code>NetworkService</code></a> object's <code>type</code> attribute does not equal the
+                           current <a>network service record</a>'s <code>type</code> property then continue at the next available active
+                           <a href="#networkservice"><code>NetworkService</code></a> object.
+                        </li>
+                        <li>
+                           Increment the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <a href="#networkservices"><code>NetworkServices</code></a> object by <code>1</code>.
+                        </li>
+                        <li>
+                          <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
+                           to dispatch a newly created event with the name <code>serviceavailable</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                            <a href="#networkservices"><code>NetworkServices</code></a> object.
+                        </li>
+                        <li>
+                          <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
+                           to dispatch a newly created event with the name <code>serviceonline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                           <a href="#networkservice"><code>NetworkService</code></a> object.
+                        </li>
+                     </ol>
+                  </li>
+            </ol>
+           </li>
+         </ol>
+
+      </section>
+
+      <section id="universal-plug-and-play--upnp" about="#universal-plug-and-play--upnp" typeof="bibo:Chapter">
+         <h3><span class="secno">7.2 </span>Universal Plug-and-Play (<acronym title="Universal Plug-and-Play"><acronym title="Universal Plug-and-Play">UPnP</acronym></acronym>)</h3>
+
+         <p>
+            For each <acronym title="Simple Service Discovery Protocol">SSDP</acronym> Presence Announcement [<cite><a class="bibref" rel="biblioentry" href="#bib-UPNP">UPNP</a></cite>] - a <acronym title="Hypertext Transfer Protocol">HTTP</acronym> NOTIFY request - received from a user-agent-initiated <acronym title="Simple Service Discovery Protocol">SSDP</acronym> Discovery Request [<cite><a class="bibref" rel="biblioentry" href="#bib-UPNP">UPNP</a></cite>], the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> run the following steps:
+         </p>
+
+         <ol class="rule">
+            <li>
+               Let <var>ssdp device</var> be an Object with a property for each <acronym title="Hypertext Transfer Protocol">HTTP</acronym> header received in the received <acronym title="Simple Service Discovery Protocol">SSDP</acronym> Presence Announcement, with each key being the name of a <acronym title="Hypertext Transfer Protocol">HTTP</acronym> header and its
+               value being that <acronym title="Hypertext Transfer Protocol">HTTP</acronym> header's accompanying value.
+            </li>
+
+            <li>
+               If <var>ssdp device</var> does not contain at least one <var>NTS</var>, <var>USN</var> and <var>Location</var> parameter, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> abort these steps.
+            </li>
+
+            <li>
+               If the first occurrence of <var>NTS</var> has a value other than <code>ssdp:alive</code>, then continue to the step labeled <var>update service monitor</var> below.
+            </li>
+
+            <li>
+               Let <var>root device descriptor file</var> contain the contents of the file located at the <acronym title="Uniform Resource Locator">URL</acronym> provided in the first occurrence of <var>Location</var> obtained according to the rules
+               defined in the section 'Retrieving a description using <acronym title="Hypertext Transfer Protocol">HTTP</acronym>' [<cite><a class="bibref" rel="biblioentry" href="#bib-UPNP">UPNP</a></cite>].
+            </li>
+
+            <li>
+               If <var>root device descriptor file</var> is empty, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> abort these steps.
+            </li>
+
+            <li>
+               Let <var>advertised services</var> be a <a>list of all advertised services</a> obtained from the <var>root device descriptor file</var> containing all sub-nodes of the <code>serviceList</code> node as described in
+               the section 'Device Description' [<cite><a class="bibref" rel="biblioentry" href="#bib-UPNP">UPNP</a></cite>].
+            </li>
+
+            <li>
+               For each Object <var>advertised service</var> in <var>advertised services</var> run the following steps:
+               <ol class="rule">
+
+                  <li>
+                     Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>eventsUrl</code>, <code>config</code>.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>id</code> property to the string value of the first occurrence of <var>ssdp device</var>'s <var>USN</var> parameter.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>name</code> property to the string value of the first occurrence of the <var>service</var>'s <code>serviceId</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string <code>upnp:</code> followed by the string value of the first occurrence of the <var>service</var>'s <code>serviceType</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>url</code> property to the string value of the first occurrence of the <var>service</var>'s <code>controlURL</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>config</code> property to the string value of the first occurrence of the <var>device</var> property.
+                  </li>
+
+                  <li>
+                     If <var>service</var>'s <code>eventSubURL</code> property is empty, then continue to the step labeled <em>register</em> below.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>eventsUrl</code> property to the string value of the first occurrence of the <var>service</var>'s <code>eventSubURL</code> property.
+                  </li>
+
+                  <li>
+                     <em>Register</em>: For each Object <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>, run the following sub-steps:
+                     <ol class="rule">
+
+                       <li>
+                        If the <var>existing service record</var>'s <var>id</var> property matches the value of the first occurrence of <var>USN</var> and the
+                        <var>existing service record</var>'s <code>type</code> property matches the value of <var>network service record</var>'s <code>type</code>, then set the
+                        value of <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>  to the value of the
+                        <var>network service record</var> and skip the next step.
+                       </li>
+                     </ol>
+                  </li>
+
+                  <li>
+                     Add <var>network service record</var> to the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>.
+                  </li>
+
+               </ol>
+            </li>
+            <li>
+               <em>Update Service Monitor</em>: For each non-garbage collected <a href="#networkservice"><code>NetworkService</code></a> object run the following steps:
+
+               <ol class="rule">
+                  <li>
+                     If this <a href="#networkservice"><code>NetworkService</code></a> object's <code>type</code> attribute does not equal the
+                     current <a>network service record</a>'s <code>type</code> property then continue at the next available active
+                     <a href="#networkservice"><code>NetworkService</code></a> object.
+                  </li>
+                  <li>
+                     If the <var>announcement type</var> equals <code>ssdp:alive</code> then Increment the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <a href="#networkservices"><code>NetworkServices</code></a>
+                     object by <code>1</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+                      to dispatch a newly created event with the name <code>serviceonline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                      <a href="#networkservice"><code>NetworkService</code></a> object. Otherwise, decrement the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <a href="#networkservices"><code>NetworkServices</code></a>
+                     object by <code>1</code> and then  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+                       to dispatch a newly created event with the name <code>serviceoffline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                       <a href="#networkservice"><code>NetworkService</code></a> object..
+                  </li>
+               </ol>
+            </li>
+         </ol>
+
+         <p>
+            A <dfn id="dfn-user-agent-generated-callback-url">user-agent generated callback url</dfn> is a Local-network accessible <acronym title="Uniform Resource Locator">URL</acronym> endpoint that a <a href="#dfn-user-agent" class="internalDFN">user agent</a> must generate and maintain for receiving <acronym title="Hypertext Transfer Protocol">HTTP</acronym> NOTIFY requests from <acronym title="Universal Plug-and-Play">UPnP</acronym> Event sources.
+         </p>
+
+         <p>When the <a href="#dfn-user-agent" class="internalDFN">user agent</a> is to <dfn id="dfn-setup-a-upnp-events-subscription">setup a <acronym title="Universal Plug-and-Play">UPnP</acronym> Events Subscription</dfn>, it is to run the following steps with the current <var>network service record</var> object:</p>
+
+         <ol class="rule">
+            <li>
+               If <var>network service record</var>'s <code>eventsUrl</code> property is empty then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> abort these steps.
+            </li>
+
+            <li>
+               Let <var>callback <acronym title="Uniform Resource Locator">URL</acronym></var> be the value of creating a new <a href="#dfn-user-agent-generated-callback-url" class="internalDFN">user-agent generated callback url</a>.
+            </li>
+
+            <li>
+               Send a <acronym title="Hypertext Transfer Protocol">HTTP</acronym> SUBSCRIBE request with a <em>NT</em> header with a string value of <code>upnp:event</code>, a <em>TIMEOUT</em> header with an integer value ofƒ
+               <code>86400</code> and a <em>CALLBACK</em> header
+               with a string value of <var>callback <acronym title="Uniform Resource Locator">URL</acronym></var> towards the <var>network service record</var>'s <code>eventsUrl</code> property.
+            </li>
+
+            <li>
+               If a non-200 OK response is received from the <acronym title="Hypertext Transfer Protocol">HTTP</acronym> SUBSCRIBE request then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> abort these steps.
+            </li>
+
+            <li>
+               On receiving a valid 200 OK response, run the following steps:
+
+               <ol class="rule">
+                  <li>
+                     Let <var>callback ID</var> equal the string value of the first included <em>SID</em> header, if it exists.
+                  </li>
+                  <li>
+                     Let <var>timeout date</var> equal the sum of the current UTC date value plus the integer value of the first included <em>TIMEOUT</em> header, if it exists.
+                  </li>
+                  <li>
+                     Run the following steps aynchronously and continue to the step labeled <em>listen</em> below.
+                  </li>
+                  <li>
+                     <em>Refresh Subscription</em>: Run the following steps at a set interval (X) within the <a href="#dfn-user-agent" class="internalDFN">user agent</a>:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>current date</var> equal the current UTC date.
+                        </li>
+                        <li>
+                           If <var>current date</var> is less than the <var>timeout date</var> then continue to the step labeled <em>refresh subscription</em> above.
+                        </li>
+                        <li>
+                           Send a <acronym title="Hypertext Transfer Protocol">HTTP</acronym> SUBSCRIBE request with a <em>SID</em> header with the string value of <var>callback ID</var> and a <em>TIMEOUT</em> header
+                           with an integer value of <code>86400</code> towards the <var>network service record</var>'s <code>eventsUrl</code> property.
+                        </li>
+                        <li>
+                           On receiving a valid 200 OK, update <var>callback ID</var> with the string value of the first included <em>SID</em> header, if it exists. All other <acronym title="Hypertext Transfer Protocol">HTTP</acronym>
+                           responses should cause the <a href="#dfn-user-agent" class="internalDFN">user agent</a> to continue from the step labeled <em>refresh subscription</em> above.
+                        </li>
+                     </ol>
+
+                  </li>
+
+                  <li>
+                     <em>Listen</em>: For each <acronym title="Hypertext Transfer Protocol">HTTP</acronym> NOTIFY request received at the <var>callback <acronym title="Uniform Resource Locator">URL</acronym></var> the <a href="#dfn-user-agent" class="internalDFN">user agent</a> is to run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>content clone</var> be the result of obtaining the message body of the <acronym title="Hypertext Transfer Protocol">HTTP</acronym> NOTIFY request. If <var>content clone</var> is empty, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> abort these steps.
+                        </li>
+                        <li>
+                          Let <var>notification event</var> be a new simple event that uses the <code>Event</code> interface with the name <code>notify</code>,
+                           which does not bubble, is not cancellable, and has no default action.
+                        </li>
+                        <li>
+                           Let the <code>data</code> attribute of <var>notification event</var> have the DOMString value of <var>content clone</var>.
+                        </li>
+                        <li>
+                           <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a> to
+                            dispatch <var>notification event</var> at the current <a href="#networkservice" class="internalDFN"><code>NetworkService</code></a> object.
+                        </li>
+                     </ol>
+                  </li>
+
+               </ol>
+
+            </li>
+         </ol>
+
+         </section>
+
+         <section id="network-topology-monitoring" about="#network-topology-monitoring" typeof="bibo:Chapter">
+            <h3><span class="secno">7.3 </span>Network Topology Monitoring</h3>
+
+                  <div>
+                     <p>
+                        When the <a href="#dfn-user-agent" class="internalDFN">user agent</a> detects that the user has dropped from their connected network, then it <em class="rfc2119" title="must">must</em> run the following steps:
+                     </p>
+
+                     <ol class="rule">
+                        <li>
+                           Flush all entries from the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>.
+                        </li>
+                        <li>
+                           For each <a href="#networkservice"><code>NetworkService</code></a> object currently active in the <a href="#dfn-user-agent" class="internalDFN">user agent</a> perform the following steps:
+
+                           <ol class="rule">
+                              <li>
+                                 Set the <a href="#dom-networkservice-online"><code>online</code></a> attribute to <code>false</code>.
+                              </li>
+                              <li>
+                                 <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
+                                                      to dispatch a newly created event with the name <code>serviceoffline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                                                      <a href="#networkservice"><code>NetworkService</code></a> object.
+                           </li></ol>
+                        </li>
+                        <li>
+                          For each <a href="#networkservices"><code>NetworkServices</code></a> object currently active in the <a href="#dfn-user-agent" class="internalDFN">user agent</a> perform the following steps:
+
+                          <ol class="rule">
+                            <li>
+                              Let <var>number of available services</var> equal the value of <a href="#networkservices"><code>NetworkServices</code></a>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute.
+                            </li>
+                            <li>
+                              Set the <a href="#networkservices"><code>NetworkServices</code></a>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to zero (<code>0</code>).
+                            </li>
+                            <li>
+                              For each <var>available service</var> in <var>number of available services</var> the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> fire a new simple event with the name <code>serviceunavailable</code> that has no default action, does not bubble and is not cancellable, at the current <a href="#networkservices"><code>NetworkServices</code></a> object.
+                            </li>
+                          </ol>
+                        </li>
+
+                     </ol>
+
+                     <p>
+                        When the <a href="#dfn-user-agent" class="internalDFN">user agent</a> detects that the user has connected to a new network, then it <em class="rfc2119" title="should">should</em> run the following steps:
+                     </p>
+
+                     <ol class="rule">
+                        <li>
+                           Re-issue an <acronym title="Multicast DNS">mDNS</acronym> search and <acronym title="Simple Service Discovery Protocol">SSDP</acronym> discovery search using all of the <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens initially provided to all active <a href="#networkservices"><code>NetworkServices</code></a> objects and handle all discovery responses according to the processing defined in <a href="#service-discovery" class="sec-ref">Section 7: Service Discovery</a>.
+                        </li>
+                     </ol>
+                  </div>
+         </section>
+      </div>
+
+   <div id="garbage-collection" about="#garbage-collection" typeof="bibo:Chapter" class="section">
+      <!--OddPage--><h2><span class="secno">8. </span>Garbage collection</h2>
+
+      <p>
+         A <a href="#networkservice" class="internalDFN"><code>NetworkService</code></a> object containing a <code>url</code> parameter currently in the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <acronym title="Uniform Resource Locator">URL</acronym> whitelist</a> <em class="rfc2119" title="must not">must not</em> be garbage collected.
+      </p>
+
+      <p>
+         Only when the user navigates away from the current browsing context can <a href="#networkservice" class="internalDFN"><code>NetworkService</code></a> objects be garbage-collected and records in the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <acronym title="Uniform Resource Locator">URL</acronym> whitelist</a> be removed.
+      </p>
+
+   </div>
+
+
+    <div id="use-cases-and-requirements" about="#use-cases-and-requirements" typeof="bibo:Chapter" class="section">
+      <!--OddPage--><h2><span class="secno">9. </span>Use Cases and Requirements</h2>
+
+      <p>This section covers what the requirements are for this <acronym title="Application Programming Interface">API</acronym>, as well as illustrates some use cases.</p>
+
+      <ul class="rule">
+         <li>
+            Once a user has given permission, user agents should provide the ability for Web pages to communicate directly with a Local-networked Service.
+            <ul class="rule">
+               <li>
+                  Example: A web-based TV remote control. A Web page wants to control the current user's TV, changing the programming shown or increasing/decreasing/muting the
+                  volume of the Local-networked Device. The Web page requests a service type that is known to be implemented by television sets to which it has the
+                  application logic to communicate. Local devices providing the request service types are discovered and presented to the user for authorization. The user selects one
+                  or more of the discovered television sets to be accessible to the current Web page and then clicks 'Share'. The Web page can now communicate directly with
+                  the user-authorized Local-networked services.
+               </li>
+            </ul>
+         </li>
+
+         <li>
+           Web pages should be able to communicate with Local-networked Services using the messaging channel supported by those Devices.
+           <ul class="rule">
+            <li>
+               Example: A Web page advertises that it is capable of controlling multiple Home Media Servers. The user can select their Home Media Server type from a drop-down list, at which point the
+               Web page sends a request to the user agent to connect with the associated service type of the Home Media Server. The Media Server selected implements a Web Socket channel for
+               bi-directional service communication and so the Web page opens a web socket to the requested Media Server and can communicate as required via that appropriate channel.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           Web pages should be able to communicate with Local-networked Services using the messaging format supported by those Devices.
+           <ul class="rule">
+            <li>
+               Example: A Web page advertises that it is capable of interacting with and controlling multiple types of Home Media Server. The user can select their Home Media Server type from a drop-down list or known Media Servers, at which point the
+               Web page sends a request to the user agent to connect with the associated service type (and, optionally, the associated event type) of the Home Media Server. The communiciation protocols supported by Home Media Servers typically vary
+               between <acronym title="Universal Plug-and-Play">UPnP</acronym>, JSON-RPC, Protocol Buffers or other messaging formats depending on the Home Media Server requested. The Web page is able to communicate with the user-selected Home Media
+               Server in the messaging format supported by that Device, which, in this example is a simple key/value pair text format.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           Web pages should not be able to communicate with Local-networked Services that have not been authorized by the user thereby maintaining the user's privacy.
+           <ul class="rule">
+            <li>
+               Example: A Web page requests access to one type of Local-networked service. The user authorizes access to that particular service. Other services running on that same device, and on other devices
+               within the network, should not be accessible to the current Web page.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           A user should be able to share one or more Local-networked Services based on a particular service type request from a Web page.
+           <ul class="rule">
+            <li>
+               Example: A Web page is capable of interacting with a specific profile of Local-networked Service. As such, it makes a request to the user agent to access those services, of which multiple matches
+               are found. The user is capable of selecting one or more of the discovered services to share with the Web page. The Web page can then implement a drag-and-drop interface for the user to drag specific
+               actions on to one or more of the authorized Local-networked Services.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           User agents should provide an <acronym title="Application Programming Interface">API</acronym> exposed to script that exposes the features above. The user is notified by UI anytime interaction with Local-networked Services is requested, giving the user
+           full ability to cancel or abort the transaction. The user selects the Local-networked Services to be connected to the current Web page, and can cancel these at any time. No invocations to
+           these APIs occur silently without user intervention.
+         </li>
+      </ul>
+    </div>
+
+          <div class="informative appendix section" id="examples" about="#examples" typeof="bibo:Chapter">
+             <!--OddPage--><h2><span class="secno">A. </span>Examples</h2><em>This section is non-normative.</em>
+
+           <div class="example">
+            <p>This sample code exposes a button. When clicked, this button is disabled and the user is prompted to offer a network service. The user may also select multiple network services. When the user has authorized a network service to be connected to the web page then the web page issues a simple command to get a list of all the albums stored on the connected media player service.
+            </p><p>The button is re-enabled only when the connected network service disconnects for whatever reason (the service becomes unavailable on the network, the user disconnects from their current network or the user revokes access to the service from the current web page). At this point the user can re-click the button to select a new network service to connect to the web page and the above steps are repeated.</p>
+            <p>The provided service type identifier and service interaction used in this example is based on the well-defined service type and messaging format supported by the <a href="http://xbmc.org/about/">XBMC Media Server</a>. </p>
+            <hr>
+            <div><div id="highlighter_143333" class="syntaxhighlighter nogutter  js"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="js plain">&lt;input type=</code><code class="js string">"button"</code> <code class="js plain">value=</code><code class="js string">"Start"</code> <code class="js plain">onclick=</code><code class="js string">"start()"</code> <code class="js plain">id=</code><code class="js string">"startBtn"</code><code class="js plain">/&gt;</code></div><div class="line number2 index1 alt1"><code class="js plain">&lt;div id=</code><code class="js string">"debugconsole"</code><code class="js plain">&gt;&lt;/div&gt;</code></div><div class="line number3 index2 alt2">&nbsp;</div><div class="line number4 index3 alt1"><code class="js plain">&lt;script&gt;</code></div><div class="line number5 index4 alt2"><code class="js spaces">&nbsp;</code><code class="js keyword">var</code> <code class="js plain">startBtn = document.getElementById(</code><code class="js string">'startBtn'</code><code class="js plain">),</code></div><div class="line number6 index5 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug = document.getElementById(</code><code class="js string">'debugconsole'</code><code class="js plain">);</code></div><div class="line number7 index6 alt2">&nbsp;</div><div class="line number8 index7 alt1"><code class="js spaces">&nbsp;</code><code class="js keyword">function</code> <code class="js plain">start() {</code></div><div class="line number9 index8 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js keyword">if</code><code class="js plain">(navigator.getNetworkServices) {</code></div><div class="line number10 index9 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">navigator.getNetworkServices(</code><code class="js string">'zeroconf:_xbmc-jsonrpc._tcp'</code><code class="js plain">, gotXBMCService, error);</code></div><div class="line number11 index10 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">startBtn.disabled = </code><code class="js keyword">true</code><code class="js plain">;</code></div><div class="line number12 index11 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js plain">} </code><code class="js keyword">else</code> <code class="js plain">{</code></div><div class="line number13 index12 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.innerHTML += </code><code class="js string">"&lt;br&gt;Service Discovery not supported!"</code><code class="js plain">;</code></div><div class="line number14 index13 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js plain">}</code></div><div class="line number15 index14 alt2"><code class="js spaces">&nbsp;</code><code class="js plain">}</code></div><div class="line number16 index15 alt1">&nbsp;</div><div class="line number17 index16 alt2"><code class="js spaces">&nbsp;</code><code class="js keyword">function</code> <code class="js plain">gotXBMCService(services) {</code></div><div class="line number18 index17 alt1">&nbsp;</div><div class="line number19 index18 alt2"><code class="js comments">// Listen for service disconnect messages</code></div><div class="line number20 index19 alt1">&nbsp;</div><div class="line number21 index20 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js plain">services[0].addEventListener(</code><code class="js string">'serviceoffline'</code><code class="js plain">, </code><code class="js keyword">function</code> <code class="js plain">( e ) {</code></div><div class="line number22 index21 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.innerHTML += </code><code class="js string">"&lt;br&gt;"</code> <code class="js plain">+ services[0].name + </code><code class="js string">" disconnected."</code><code class="js plain">;</code></div><div class="line number23 index22 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">startBtn.disabled = </code><code class="js keyword">false</code><code class="js plain">;</code></div><div class="line number24 index23 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js plain">}, </code><code class="js keyword">false</code><code class="js plain">);</code></div><div class="line number25 index24 alt2">&nbsp;</div><div class="line number26 index25 alt1"><code class="js comments">// Send a service message to get albums list (and process the service response)</code></div><div class="line number27 index26 alt2">&nbsp;</div><div class="line number28 index27 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js keyword">var</code> <code class="js plain">svcXhr = </code><code class="js keyword">new</code> <code class="js plain">XMLHttpRequest();</code></div><div class="line number29 index28 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js plain">svcXhr.open(</code><code class="js string">"POST"</code><code class="js plain">, services[0].url + </code><code class="js string">"/getAlbums"</code><code class="js plain">); </code><code class="js comments">// services[0].url and its subresources have been</code></div><div class="line number30 index29 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js comments">// whitelisted for cross-site XHR use in this</code></div><div class="line number31 index30 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js comments">// current browsing context.</code></div><div class="line number32 index31 alt1">&nbsp;</div><div class="line number33 index32 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js plain">svcXhr.setRequestHeader(</code><code class="js string">'Content-Type'</code><code class="js plain">, </code><code class="js string">'application/json-rpc'</code><code class="js plain">);</code></div><div class="line number34 index33 alt1">&nbsp;</div><div class="line number35 index34 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js plain">svcXhr.addEventListener(</code><code class="js string">'readystatechange'</code><code class="js plain">, </code><code class="js keyword">function</code> <code class="js plain">( response ) {</code></div><div class="line number36 index35 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js keyword">if</code><code class="js plain">( response.readyState != 4 || response.status != 200 )</code></div><div class="line number37 index36 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js keyword">return</code><code class="js plain">;</code></div><div class="line number38 index37 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.innerHTML += </code><code class="js string">"&lt;br&gt;"</code> <code class="js plain">+ services[0].name + </code><code class="js string">" response received: "</code><code class="js plain">;</code></div><div class="line number39 index38 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.textContent += JSON.parse(response.responseText);</code></div><div class="line number40 index39 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js plain">}, </code><code class="js keyword">false</code><code class="js plain">);</code></div><div class="line number41 index40 alt2">&nbsp;</div><div class="line number42 index41 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js keyword">var</code> <code class="js plain">svcMsg = [</code></div><div class="line number43 index42 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">{ </code><code class="js string">"jsonrpc"</code><code class="js plain">: </code><code class="js string">"2.0"</code><code class="js plain">, </code><code class="js string">"method"</code><code class="js plain">: </code><code class="js string">"AudioLibrary.GetAlbums"</code><code class="js plain">, </code><code class="js string">"params"</code><code class="js plain">: { </code><code class="js string">"genreid"</code><code class="js plain">: -1,</code></div><div class="line number44 index43 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js string">"artistid"</code><code class="js plain">: -1, </code><code class="js string">"start"</code><code class="js plain">: -1, </code><code class="js string">"end"</code><code class="js plain">: -1 }, </code><code class="js string">"id"</code><code class="js plain">: </code><code class="js string">"1"</code> <code class="js plain">}</code></div><div class="line number45 index44 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js plain">];</code></div><div class="line number46 index45 alt1">&nbsp;</div><div class="line number47 index46 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js plain">svcXhr.send(JSON.stringify(svcMsg));</code></div><div class="line number48 index47 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.innerHTML += </code><code class="js string">"&lt;br&gt;"</code> <code class="js plain">+ services[0].name + </code><code class="js string">" request sent: "</code><code class="js plain">;</code></div><div class="line number49 index48 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.textContent += JSON.stringify(svcMsg);</code></div><div class="line number50 index49 alt1">&nbsp;</div><div class="line number51 index50 alt2"><code class="js spaces">&nbsp;</code><code class="js plain">}</code></div><div class="line number52 index51 alt1">&nbsp;</div><div class="line number53 index52 alt2"><code class="js spaces">&nbsp;</code><code class="js keyword">function</code> <code class="js plain">error( err ) {</code></div><div class="line number54 index53 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.innerHTML += </code><code class="js string">"&lt;br&gt;An error occurred obtaining a local network service."</code><code class="js plain">;</code></div><div class="line number55 index54 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;</code><code class="js plain">startBtn.disabled = </code><code class="js keyword">false</code><code class="js plain">;</code></div><div class="line number56 index55 alt1"><code class="js spaces">&nbsp;</code><code class="js plain">}</code></div><div class="line number57 index56 alt2"><code class="js plain">&lt;/script&gt;</code></div></div></td></tr></tbody></table></div></div>
+           </div>
+
+           <div class="example">
+            <p>
+             This sample exposes a drop-down list containing a number of common Home-based audio devices. When the user selects an audio device from the list provided, they are prompted to authorize a network service
+             based on the service type requested. The user may also select multiple network services matching the selected service type.
+             In this example, the user selects their make as being <var>Sony</var> and their model as being <var>Bravia S1000</var> from which the Web page can derive a service type
+             (<var>urn:schemas-upnp-org:service:RenderingControl:1</var>).
+             <br><br>Once the user has authorized the device, the web page sends a simple mute command according to the messaging format supported by the device.
+            </p>
+            <hr>
+            <div><div id="highlighter_960554" class="syntaxhighlighter nogutter  js"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="code"><div class="container"><div class="line number1 index0 alt2"><code class="js plain">&lt;select name=</code><code class="js string">"make"</code> <code class="js plain">id=</code><code class="js string">"make"</code><code class="js plain">&gt;</code></div><div class="line number2 index1 alt1"><code class="js spaces">&nbsp;&nbsp;</code><code class="js plain">&lt;option selected=</code><code class="js string">"selected"</code> <code class="js plain">disabled=</code><code class="js string">"disabled"</code><code class="js plain">&gt;Select make&lt;/option&gt;</code></div><div class="line number3 index2 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js plain">&lt;option&gt;Sony&lt;/option&gt;</code></div><div class="line number4 index3 alt1"><code class="js spaces">&nbsp;&nbsp;</code><code class="js plain">&lt;option&gt;Philips&lt;/option&gt;</code></div><div class="line number5 index4 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js plain">&lt;option&gt;Alba&lt;/option&gt;</code></div><div class="line number6 index5 alt1"><code class="js plain">&lt;/select&gt;</code></div><div class="line number7 index6 alt2"><code class="js plain">&lt;select name=</code><code class="js string">"model"</code> <code class="js plain">id=</code><code class="js string">"model"</code><code class="js plain">&gt;&lt;/select&gt;</code></div><div class="line number8 index7 alt1"><code class="js plain">&lt;div id=</code><code class="js string">"debugconsole"</code><code class="js plain">&gt;&lt;/div&gt;</code></div><div class="line number9 index8 alt2">&nbsp;</div><div class="line number10 index9 alt1"><code class="js plain">&lt;script&gt;</code></div><div class="line number11 index10 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js keyword">var</code> <code class="js plain">debug = document.getElementById(</code><code class="js string">'debugconsole'</code><code class="js plain">);</code></div><div class="line number12 index11 alt1">&nbsp;</div><div class="line number13 index12 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js keyword">var</code> <code class="js plain">models = {</code></div><div class="line number14 index13 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js string">"Sony"</code><code class="js plain">: [</code></div><div class="line number15 index14 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">{</code><code class="js string">"name"</code><code class="js plain">: </code><code class="js string">"Bravia TV S1000"</code><code class="js plain">, </code><code class="js string">"type"</code><code class="js plain">: </code><code class="js string">"upnp"</code><code class="js plain">, </code><code class="js string">"service"</code><code class="js plain">: </code><code class="js string">"urn:schemas-upnp-org:service:RenderingControl:1"</code> <code class="js plain">},</code></div><div class="line number16 index15 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">{</code><code class="js string">"name"</code><code class="js plain">: </code><code class="js string">"Bravia TV S2000"</code><code class="js plain">, </code><code class="js string">"type"</code><code class="js plain">: </code><code class="js string">"zeroconf"</code><code class="js plain">, </code><code class="js string">"service"</code><code class="js plain">: </code><code class="js string">"_mediarenderer._http._tcp"</code> <code class="js plain">},</code></div><div class="line number17 index16 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">{</code><code class="js string">"name"</code><code class="js plain">: </code><code class="js string">"HiFi WD10"</code><code class="js plain">, </code><code class="js string">"type"</code><code class="js plain">: </code><code class="js string">"upnp"</code><code class="js plain">, </code><code class="js string">"service"</code><code class="js plain">: </code><code class="js string">"urn:schemas-upnp-org:service:RenderingControl:1"</code> <code class="js plain">}</code></div><div class="line number18 index17 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">],</code></div><div class="line number19 index18 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js string">"Philips"</code><code class="js plain">: [ </code><code class="js comments">/* ... */</code> <code class="js plain">],</code></div><div class="line number20 index19 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js string">"Alba"</code><code class="js plain">: [ </code><code class="js comments">/* ... */</code> <code class="js plain">]</code></div><div class="line number21 index20 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js plain">};</code></div><div class="line number22 index21 alt1">&nbsp;</div><div class="line number23 index22 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js keyword">var</code> <code class="js plain">makeEl = document.getElementById(</code><code class="js string">"make"</code><code class="js plain">),</code></div><div class="line number24 index23 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">modelEl = document.getElementById(</code><code class="js string">"model"</code><code class="js plain">);</code></div><div class="line number25 index24 alt2">&nbsp;</div><div class="line number26 index25 alt1"><code class="js spaces">&nbsp;&nbsp;</code><code class="js plain">makeEl.addEventListener(</code><code class="js string">'change'</code><code class="js plain">, </code><code class="js keyword">function</code><code class="js plain">() {</code></div><div class="line number27 index26 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">modelEl.innerHTML = </code><code class="js string">""</code><code class="js plain">; </code><code class="js comments">// reset</code></div><div class="line number28 index27 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js keyword">var</code> <code class="js plain">defaultOption = document.createElement(</code><code class="js string">"option"</code><code class="js plain">);</code></div><div class="line number29 index28 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">defaultOption.textContent = </code><code class="js string">"Select model"</code><code class="js plain">;</code></div><div class="line number30 index29 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">defaultOption.setAttribute(</code><code class="js string">"disabled"</code><code class="js plain">, </code><code class="js string">"disabled"</code><code class="js plain">);</code></div><div class="line number31 index30 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">defaultOption.setAttribute(</code><code class="js string">"selected"</code><code class="js plain">, </code><code class="js string">"selected"</code><code class="js plain">);</code></div><div class="line number32 index31 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">modelEl.appendChild(defaultOption);</code></div><div class="line number33 index32 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js keyword">for</code><code class="js plain">(</code><code class="js keyword">var</code> <code class="js plain">i = 0, l = models[makeEl.value].length; i &lt; l; i++) {</code></div><div class="line number34 index33 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js keyword">var</code> <code class="js plain">option = document.createElement(</code><code class="js string">"option"</code><code class="js plain">);</code></div><div class="line number35 index34 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">option.textContent = models[makeEl.value][i][</code><code class="js string">"name"</code><code class="js plain">];</code></div><div class="line number36 index35 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">option.setAttribute(</code><code class="js string">"value"</code><code class="js plain">, models[makeEl.value][i][</code><code class="js string">"type"</code><code class="js plain">] + </code><code class="js string">":"</code> <code class="js plain">+ models[makeEl.value][i][</code><code class="js string">"service"</code><code class="js plain">]);</code></div><div class="line number37 index36 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">modelEl.appendChild(option);</code></div><div class="line number38 index37 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">}</code></div><div class="line number39 index38 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js plain">}, </code><code class="js keyword">false</code><code class="js plain">);</code></div><div class="line number40 index39 alt1">&nbsp;</div><div class="line number41 index40 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js plain">modelEl.addEventListener(</code><code class="js string">'change'</code><code class="js plain">, </code><code class="js keyword">function</code><code class="js plain">() {</code></div><div class="line number42 index41 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js keyword">if</code><code class="js plain">(navigator.getNetworkServices &amp;&amp;</code></div><div class="line number43 index42 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">modelEl.value == </code><code class="js string">"upnp:urn:schemas-upnp-org:service:RenderingControl:1"</code><code class="js plain">) {</code></div><div class="line number44 index43 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">navigator.getNetworkServices(modelEl.value, successCallback, errorCallback);</code></div><div class="line number45 index44 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">} </code><code class="js keyword">else</code> <code class="js keyword">if</code> <code class="js plain">(modelEl.value == </code><code class="js string">"zeroconf:_mediarenderer._http._tcp"</code><code class="js plain">) {</code></div><div class="line number46 index45 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.innerHTML += </code><code class="js string">"&lt;br&gt;Service type is not implemented by this application."</code><code class="js plain">;</code></div><div class="line number47 index46 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">} </code><code class="js keyword">else</code> <code class="js plain">{</code></div><div class="line number48 index47 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.innerHTML += </code><code class="js string">"&lt;br&gt;Service Discovery is not supported!"</code><code class="js plain">;</code></div><div class="line number49 index48 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">}</code></div><div class="line number50 index49 alt1"><code class="js spaces">&nbsp;&nbsp;</code><code class="js plain">}, </code><code class="js keyword">false</code><code class="js plain">);</code></div><div class="line number51 index50 alt2"><code class="js plain">&lt;/script&gt;</code></div><div class="line number52 index51 alt1">&nbsp;</div><div class="line number53 index52 alt2"><code class="js plain">&lt;script&gt;</code></div><div class="line number54 index53 alt1"><code class="js spaces">&nbsp;&nbsp;</code><code class="js keyword">function</code> <code class="js plain">successCallback( services ) {</code></div><div class="line number55 index54 alt2">&nbsp;</div><div class="line number56 index55 alt1"><code class="js spaces">&nbsp;&nbsp;</code><code class="js comments">// Listen for service push notification messages</code></div><div class="line number57 index56 alt2">&nbsp;</div><div class="line number58 index57 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">services[0].addEventListener(</code><code class="js string">'notify'</code><code class="js plain">, </code><code class="js keyword">function</code> <code class="js plain">( msg ) {</code></div><div class="line number59 index58 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.innerHTML += </code><code class="js string">"&lt;br&gt;"</code> <code class="js plain">+ services[0].name + </code><code class="js string">" event received: "</code><code class="js plain">;</code></div><div class="line number60 index59 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.textContent += msg.data;</code></div><div class="line number61 index60 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">}, </code><code class="js keyword">false</code><code class="js plain">);</code></div><div class="line number62 index61 alt1">&nbsp;</div><div class="line number63 index62 alt2"><code class="js spaces">&nbsp;</code><code class="js comments">// Send a control signal to mute the service audio</code></div><div class="line number64 index63 alt1">&nbsp;</div><div class="line number65 index64 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js keyword">var</code> <code class="js plain">svcXhr = </code><code class="js keyword">new</code> <code class="js plain">XMLHttpRequest();</code></div><div class="line number66 index65 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">svcXhr.open(</code><code class="js string">"POST"</code><code class="js plain">, services[0].url); </code><code class="js comments">// services[0].url and its</code></div><div class="line number67 index66 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js comments">// subresources have been whitelisted for</code></div><div class="line number68 index67 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js comments">// cross-site XHR use in this current</code></div><div class="line number69 index68 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js comments">// browsing context.</code></div><div class="line number70 index69 alt1">&nbsp;</div><div class="line number71 index70 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">svcXhr.setRequestHeader(</code><code class="js string">'SOAPAction'</code><code class="js plain">, </code><code class="js string">'urn:schemas-upnp-org:service:RenderingControl:1#SetMute'</code><code class="js plain">);</code></div><div class="line number72 index71 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">svcXhr.setRequestHeader(</code><code class="js string">'Content-Type'</code><code class="js plain">, </code><code class="js string">'text/xml; charset="utf-8";'</code><code class="js plain">);</code></div><div class="line number73 index72 alt2">&nbsp;</div><div class="line number74 index73 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">svcXhr.onreadystatechange = </code><code class="js keyword">function</code> <code class="js plain">( response ) {</code></div><div class="line number75 index74 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js keyword">if</code><code class="js plain">( response.readyState != 4 || response.status != 200 )</code></div><div class="line number76 index75 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js keyword">return</code><code class="js plain">;</code></div><div class="line number77 index76 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.innerHTML += </code><code class="js string">"&lt;br&gt;"</code> <code class="js plain">+ services[0].name + </code><code class="js string">" response received: "</code><code class="js plain">;</code></div><div class="line number78 index77 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.textContent += response.responseXML;</code></div><div class="line number79 index78 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">}</code></div><div class="line number80 index79 alt1">&nbsp;</div><div class="line number81 index80 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js comments">// Service messaging to mute the provided service</code></div><div class="line number82 index81 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js keyword">var</code> <code class="js plain">svcMsg = </code><code class="js string">'&lt;?xml version="1.0" encoding="utf-8"?&gt;'</code> <code class="js plain">+</code></div><div class="line number83 index82 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js string">'&lt;s:Envelope s:encodingStyle="<a href="http://schemas.xmlsoap.org/soap/encoding/">http://schemas.xmlsoap.org/soap/encoding/</a>" '</code> <code class="js plain">+</code></div><div class="line number84 index83 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js string">'xmlns:s="<a href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</a>"&gt;'</code> <code class="js plain">+</code></div><div class="line number85 index84 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js string">'&lt;s:Body&gt;'</code> <code class="js plain">+</code></div><div class="line number86 index85 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js string">'&lt;u:SetMute xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"&gt;'</code> <code class="js plain">+</code></div><div class="line number87 index86 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js string">'&lt;InstanceID&gt;0&lt;/InstanceID&gt;'</code> <code class="js plain">+</code></div><div class="line number88 index87 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js string">'&lt;Channel&gt;Master&lt;/Channel&gt;'</code> <code class="js plain">+</code></div><div class="line number89 index88 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js string">'&lt;DesiredMute&gt;true&lt;/DesiredMute&gt;'</code> <code class="js plain">+</code></div><div class="line number90 index89 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js string">'&lt;/u:SetMute&gt;'</code> <code class="js plain">+</code></div><div class="line number91 index90 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js string">'&lt;/s:Body&gt;'</code> <code class="js plain">+</code></div><div class="line number92 index91 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js string">'&lt;/s:Envelope&gt;'</code><code class="js plain">;</code></div><div class="line number93 index92 alt2">&nbsp;</div><div class="line number94 index93 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">svcXhr.send(svcMsg);</code></div><div class="line number95 index94 alt2"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.innerHTML += </code><code class="js string">"&lt;br&gt;"</code> <code class="js plain">+ services[0].name + </code><code class="js string">" request sent: "</code><code class="js plain">;</code></div><div class="line number96 index95 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.textContent += svcMsg;</code></div><div class="line number97 index96 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js plain">}</code></div><div class="line number98 index97 alt1">&nbsp;</div><div class="line number99 index98 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js keyword">function</code> <code class="js plain">errorCallback( error ) {</code></div><div class="line number100 index99 alt1"><code class="js spaces">&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="js plain">debug.innerHTML += </code><code class="js string">"&lt;br&gt;An error occurred: "</code> <code class="js plain">+ error.code;</code></div><div class="line number101 index100 alt2"><code class="js spaces">&nbsp;&nbsp;</code><code class="js plain">}</code></div><div class="line number102 index101 alt1"><code class="js plain">&lt;/script&gt;</code></div></div></td></tr></tbody></table></div></div>
+          </div>
+
+       </div>
+
+    <div id="acknowledgements" about="#acknowledgements" typeof="bibo:Chapter" class="section">
+      <!--OddPage--><h2><span class="secno">B. </span>Acknowledgements</h2>
+
+      <p>Thanks are expressed by the editor to the following individuals for their feedback on this specification to date (in alphabetical order):
+      <br><br>
+      Gar Bergstedt, Lars-Erik Bolstad, Cathy Chan, Hari G Kumar, Bob Lund, Giuseppe Pascale, Marcin Simonides, Clarke Stevens, Christian Söderström, Mark Vickers, ...</p>
+
+      <p>Thanks are also expressed by the editor to the following organizations and groups for their support in producing this specification to date (in alphabetical order):
+      <br><br>
+      CableLabs, Opera Software ASA, <acronym title="World Wide Web Consortium">W3C</acronym> Device APIs Working Group, <acronym title="World Wide Web Consortium">W3C</acronym> Web and TV Interest Group, ...</p>
+    </div>
+
+
+
+
+
+<div id="references" class="appendix section" about="#references" typeof="bibo:Chapter"><!--OddPage--><h2><span class="secno">C. </span>References</h2><section id="normative-references" about="#normative-references" typeof="bibo:Chapter"><h3><span class="secno">C.1 </span>Normative references</h3><dl class="bibliography" about=""><dt id="bib-DNS-SD">[DNS-SD]</dt><dd rel="dc:requires">S. Cheshire; M. Krochmal. <a href="http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt"><cite>DNS-Based Service Discovery.</cite></a> 27 February 2011. IETF Draft. URL: <a href="http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt">http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt</a></dd><dt id="bib-DOM-CORE">[DOM-CORE]</dt><dd rel="dc:requires">Anne van Kesteren; et al. <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/"><cite>Web DOM Core</cite></a>. W3C Working Draft. (Work in progress.) URL: <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/">http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html</a> </dd><dt id="bib-HTML5">[HTML5]</dt><dd rel="dc:requires">Ian Hickson; David Hyatt. <a href="http://www.w3.org/TR/2010/WD-html5-20100304/"><cite>HTML 5.</cite></a> 4 March 2010. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2010/WD-html5-20100304/">http://www.w3.org/TR/2010/WD-html5-20100304/</a> </dd><dt id="bib-MDNS">[MDNS]</dt><dd rel="dc:requires">S. Cheshire; M. Krochmal. <a href="http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt"><cite>Multicast DNS.</cite></a> 14 February 2011. IETF Draft. URL: <a href="http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt">http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt</a></dd><dt id="bib-RFC2119">[RFC2119]</dt><dd rel="dc:requires">S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in RFCs to Indicate Requirement Levels.</cite></a> March 1997. Internet RFC 2119.  URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a> </dd><dt id="bib-UPNP">[UPNP]</dt><dd rel="dc:requires">UPnP Forum. <a href="http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf"><cite>UPnP Device Architecture. Version 1.1.</cite></a>. URL: <a href="http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf">http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf</a></dd><dt id="bib-WEBIDL">[WEBIDL]</dt><dd rel="dc:requires">Cameron McCormack. <a href="http://www.w3.org/TR/2008/WD-WebIDL-20081219"><cite>Web IDL.</cite></a> 19 December 2008. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2008/WD-WebIDL-20081219">http://www.w3.org/TR/2008/WD-WebIDL-20081219</a> </dd></dl></section></div></body></html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/discovery-api/Overview.src.html	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,1549 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Networked Service Discovery and Messaging</title>
+    <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
+    <script type="text/javascript" class='remove'>
+      var respecConfig = {
+          specStatus:   "ED",
+          //publishDate:  "2012-08-22",
+          shortName:    "discovery-api",
+          edDraftURI:   "http://w3c-test.org/dap/discovery-api/",
+          previousMaturity: "WD",
+          previousPublishDate: "2012-08-07",
+          editors: [
+            {
+              name:       "Rich Tibbett",
+              //url:        "http://richt.me/",
+              company:    "Opera Software ASA",
+              companyURL: "http://opera.com/"
+            },
+            {
+              name:       "Clarke Stevens",
+              //url:      "",
+              company:    "CableLabs",
+              companyURL: "http://cablelabs.com/"
+            }
+          ],
+          noIDLIn:      true,
+          wg:           "Device APIs and Policy Working Group",
+          wgURI:        "http://www.w3.org/2009/dap/",
+          wgPublicList: "public-device-apis",
+          wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/43696/status"
+      };
+    </script>
+
+    <script src='http://www.w3.org/Tools/respec/respec-w3c-common' type="text/javascript" class='remove' async></script>
+    <style type="text/css">
+      /* Custom CSS optimizations (Richard Tibbett) */
+
+      /* Add better spacing to sections */
+      section, .section { margin-bottom: 2em; }
+
+      /* Reduce note & issue render size */
+      .note, .issue { font-size:0.8em; }
+
+      /* Add addition spacing to <ol> and <ul> for rule definition */
+      ol.rule li, ul.rule li { padding:0.6em; }
+
+      pre.widl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; position: relative; }
+      pre.widl :link, pre.widl :visited { color: #000; background: transparent; }
+      pre.widl:before { content: "IDL"; font: bold small sans-serif; padding: 0.5em; background: white; position: absolute; top: 0; margin: -1px 0 0 -4em; width: 1.5em; border: thin solid; border-radius: 0 0 0 0.5em }
+
+      div.example { border: solid thin red; background: #F7DFE5; color: black; padding: 0.5em 1em; position: relative; margin: 1em 0 1em 4.6em; width: auto; }
+      div.example:before { content: "EXAMPLE"; font: bold small sans-serif; padding: 0.5em; background: red; color: white; position: absolute; top: 0; margin: -1px 0 0 -7.6em; width: 5em; border: thin solid red; border-radius: 0 0 0 0.5em }
+
+      dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
+      hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
+      dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
+      dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
+      dl.domintro dd p { margin: 0.5em 0; }
+      dl.domintro code {font-size: inherit; font-style: italic; }
+      dl.domintro:before { display: table; margin: -1em -0.5em 0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: red; border: solid 2px; background: white; padding: 0 0.25em; }
+    </style>
+  </head>
+
+  <body>
+    <section id='abstract'>
+      <p>
+        This specification defines a mechanism for an HTML document to discover and subsequently communicate with <abbr title="Hypertext Transfer Protocol">HTTP</abbr>-based services
+        advertised via common discovery protocols within a user's network.
+      </p>
+    </section>
+
+    <section id='sotd'>
+      <p>
+        This document represents the early consensus of the group on the scope and features of the proposed
+        API.
+      </p>
+    </section>
+
+    <section class="informative">
+      <h3>Introduction</h3>
+
+      <p>To enable Web pages to connect and communicate with Local-networked Services provided over HTTP, this specification introduces the
+      <a href="#navigatornetworkservice"><code>NavigatorNetworkService</code></a> interface.</p>
+
+      <p>
+         Using this <abbr title="Application Programming Interface">API</abbr> consists of requesting a well-known service type, known by developers and advertised by Local-networked Devices. User authorization, where the user connects the web page to one or more discovered services,
+         is expected before the web page is able to interact with any Local-networked Services.
+      </p>
+
+      <p>
+         A web page creates a request to obtain connectivity to services running in the network by specifying a well-known discovery service type that it wishes to interact with.
+      </p>
+
+      <p>
+         The user agent, having captured all advertised services on the network from the Service Discovery mechanisms included in this recommendation, attempts to match
+      the requested service type to a discovered service according to the processing described herein.
+      </p>
+
+      <p>
+          If a service connectivity request is successful then the Web page is provided with the necessary information to communicate with the authorized Local-networked Service.
+          If the request fails then the Web page will receive an error callback containing an error code describing the cause of Local-networked Service connectivity failure.
+      </p>
+
+      <p>
+         Once connected to a Local-networked Service the Web page can send requests and receive responses to the Local-networked Service via the messaging format and appropriate channel inferred from the service type
+         authorized via the provided API.
+         The Web page, once connected, can also receive service-pushed events, in the messaging format supported by the Local-networked Device, if such event subscription functionality is provided by the
+         connected Local-networked Service.
+      </p>
+
+      <div class="example">
+       <p>Example of requesting a DNS-SD advertised service:</p>
+       <hr />
+       <pre class="highlight">function showServices( services ) {
+  // Show a list of all the services provided to the web page
+  for(var i = 0, l = services.length; i < l; i++) console.log( services[i].name );
+}
+
+navigator.getNetworkServices('zeroconf:_boxee-jsonrpc._tcp', showServices);</pre>
+      </div>
+
+      <div class="example">
+        <p>Example of requesting a UPnP advertised service, also handling error conditions:</p>
+        <hr />
+        <pre class="highlight">function showServices( services ) {
+  // Show a list of all the services provided to the web page
+  for(var i = 0, l = services.length; i < l; i++) console.log( services[i].name );
+}
+
+function error( e ) {
+  console.log( "Error occurred: " + e.code );
+}
+
+navigator.getNetworkServices('upnp:urn:schemas-upnp-org:service:ContentDirectory:1', showServices, error);</pre>
+      </div>
+
+      <div class="example">
+        <p>Example of requesting either a DNS-SD or UPnP advertised service:</p>
+        <hr />
+        <pre class="highlight">function showServices( services ) {
+  // Show a list of all the services provided to the web page (+ service type)
+  for(var i = 0, l = services.length; i < l; i++)
+     console.log( services[i].name + '(' + services[i].type + ')' );
+}
+
+navigator.getNetworkServices([
+  'zeroconf:_boxee-jsonrpc._tcp',
+  'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'
+], showServices);</pre>
+      </div>
+
+      <p>For more detailed examples see the <a href="#examples">Examples</a> section.
+    </section>
+
+    <section
+     id='conformance'>
+
+     <p>Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or "return false and abort these steps") are to be interpreted with the
+     meaning of the key word ("must", "should", "may", etc) used in introducing the algorithm.</p>
+
+     <p>
+      Some conformance requirements are phrased as requirements on attributes, methods or objects. Such requirements are to be interpreted as requirements on user agents.
+     </p>
+
+     <p>
+      Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent. (In particular, the algorithms defined in
+      this specification are intended to be easy to follow, and not intended to be performant.)
+     </p>
+
+     <p>
+      The only conformance class defined by this specification is a <dfn>user agent</dfn>.
+     </p>
+
+     <p>
+      User agents may impose implementation-specific limits on otherwise unconstrained inputs, e.g. to prevent denial of service attacks, to guard against running out of memory, or to work
+      around platform-specific limitations.
+     </p>
+
+     <p>
+      When support for a feature is disabled (e.g. as an emergency measure to mitigate a security problem, or to aid in development, or for performance reasons), user agents must act as if
+      they had no support for the feature whatsoever, and as if the feature was not mentioned in this specification. For example, if a particular feature is accessed via an attribute in a Web
+      IDL interface, the attribute itself would be omitted from the objects that implement that interface - leaving the attribute on the object but making it return null or throw an exception
+      is insufficient.
+     </p>
+
+      <section>
+         <h3>Dependencies</h3>
+
+         This specification relies on several other underlying specifications.
+
+         <dl>
+            <dt>HTML</dt>
+            <dd>Many fundamental concepts from HTML are used by this specification. [[!HTML5]]</dd>
+            <dt>WebIDL</dt>
+            <dd>The IDL blocks in this specification use the semantics of the WebIDL specification. [[!WEBIDL]]</dd>
+         </dl>
+      </section>
+    </section>
+
+    <section>
+      <h3>Terminology</h3>
+
+      <p>
+         The construction "a <code>Foo</code> object", where <code>Foo</code> is actually an interface, is sometimes used instead of the more accurate "an object implementing the interface <code>Foo</code>".
+      </p>
+
+      <p>
+         The term DOM is used to refer to the API set made available to scripts in Web applications, and does not necessarily imply the existence of an actual <code>Document</code> object or of any
+         other <code>Node</code> objects as defined in the DOM Core specifications. [[!DOM4]]
+      </p>
+
+      <p>
+         An IDL attribute is said to be <em>getting</em> when its value is being retrieved (e.g. by author script), and is said to be <em>setting</em> when a new value is assigned to it.
+      </p>
+
+      <p>
+        A <dfn>valid service type</dfn> is a string that begins with <code>upnp:</code> or <code>zeroconf:</code> followed by one or more characters in the ranges U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E.
+      </p>
+
+      <p>
+        A <a>valid service type</a> provided in the <code>type</code> attribute of the <code>getNetworkServices()</code> method will be matched against the services currently contained in the <a>list of available service records</a> according to the algorithms defined in this specification.
+      </p>
+    </section>
+
+    <section>
+     <h2>Requesting networked services</h2>
+
+
+<pre class="widl">[Supplemental, NoInterfaceObject]
+interface <dfn id="navigatornetworkservice">NavigatorNetworkService</dfn> {
+  // Obtain a Local-networked Service
+  void <a href="#dom-navigator-getnetworkservices">getNetworkServices</a>( in any type,
+                           in <a href="#navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</a> successCallback,
+                           in optional <a href="#navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</a> errorCallback );
+};
+<a class="externalDFN" href="http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">Navigator</a> implements <a href="#navigatornetworkservice">NavigatorNetworkService</a>;
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id="navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</dfn> {
+  void handleEvent( in <a href="#networkservices">NetworkServices</a> services );
+};
+
+[NoInterfaceObject]
+interface <dfn id="navigatornetworkserviceerror">NavigatorNetworkServiceError</dfn> {
+  const unsigned short <a href="#dom-navigatornetworkserviceerror-permission_denied">PERMISSION_DENIED_ERR</a> = 1;
+  const unsigned short <a href="#dom-navigatornetworkserviceerror-unknown_type_prefix">UNKNOWN_TYPE_PREFIX_ERR</a> = 2;
+  readonly attribute unsigned short <a href="#dom-navigatornetworkserviceerror-code">code</a>;
+};
+
+[Callback=FunctionOnly, NoInterfaceObject]
+interface <dfn id="navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</dfn> {
+  void handleEvent( in <a href="#navigatornetworkserviceerror">NavigatorNetworkServiceError</a> error );
+};
+</pre>
+
+  <section>
+   <h2>Methods</h2>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">window</var>
+           .
+          <code title="dom-navigator">
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">navigator</a>
+          </code>
+           .
+          <code title="dom-navigator-getNetworkServices">
+            <a href="#dom-navigator-getnetworkservices">getNetworkServices</a>
+          </code>
+          (
+          <var title="">type</var>
+          ,
+          <var title="">successCallback</var>
+           [,
+          <var title="">errorCallback</var>
+           ] )
+        </dt>
+        <dd>
+          <p>Prompts the user to select one or more discovered network services that have advertised support for the requested service type.</p>
+          <p>
+            The
+            <var title="">type</var>
+             argument contains one or more <a>valid service type</a> tokens that the web page would like to interact with.
+          </p>
+          <p>
+            If the user accepts, the
+            <var title="">successCallback</var>
+             is
+          invoked, with one or more
+            <code>
+              <a href="#networkservice"><code>NetworkService</code></a>
+            </code>
+             objects as
+          its argument.
+          </p>
+          <p>
+            If the user declines, the
+            <var title="">errorCallback</var>
+             (if
+          any) is invoked.
+          </p>
+        </dd>
+      </dl>
+
+       <div>
+          <p>
+            When the <dfn id="dom-navigator-getnetworkservices" title="dom-navigator-getnetworkservices"><code>getNetworkServices(type, successCallback[, errorCallback])</code></dfn> method is called, the <a>user agent</a> MUST run the following steps:
+          </p>
+
+          <ol class="rule">
+
+            <li>
+              Let <var>requested control types</var> be initially set to an empty array.
+            </li>
+
+            <li>
+               If <var>type</var> is an array consisting of one or more <a>valid service type</a> tokens, then let <var>requested control types</var> by the value of <var>type</var>, removing any non-<a>valid service type</a> tokens from the resulting array.
+            </li>
+
+            <li>
+               If <var>type</var> is a string consisting of one <a>valid service type</a> token, then let <var>requested control types</var> be an array containing one item with a value of <var>type</var>.
+            </li>
+
+            <li>
+               If <var>requested control types</var> is an array that contains at least one or more <a title="valid service type">valid service type</a> tokens then continue to the step labeled <em>process</em> below. Otherwise, the <a>user agent</a> MUST <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 2
+                  (<a href="#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a>) as its argument,
+                   abort any remaining steps and return.
+            </li>
+
+            <li>
+               <em>Process</em>: Let <var>services found</var> be an empty array.
+            </li>
+
+            <li>
+               For each <var>available service</var> in the <a>list of available service records</a> run the following steps:
+               <ol class="rule">
+                  <li>
+                    For each <var>requested control type</var> in <var>requested control types</var>: If <var>available service</var>'s <code>type</code> attribute equals the <var>requested control type</var> then let <var>matched service</var> equal the value of <var>available service</var> and continue at the step labeled <var>attach</var> below.
+                  </li>
+                  <li>
+                     Continue at the next <var>available service</var>.
+                  </li>
+                  <li>
+                     <em>Attach</em>: If <var>matched service</var> is not empty then run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>new service object</var> be a new <a href="#networkservice"><code>NetworkService</code></a> object, mapping the parameters of
+                     <var>matched service</var> to this new object where possible.
+                        </li>
+                        <li>
+                           Append <var>new service object</var> to the <var>services found</var> array.
+                        </li>
+                     </ol>
+                  </li>
+               </ol>
+            </li>
+
+            <li>
+               If <var>services found</var> is an empty array, then the <a>user agent</a> MUST <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                 (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+            </li>
+
+            <li>
+               Return, and run the remaining steps asynchronously.
+            </li>
+
+            <li>
+               Optionally, e.g. based on a previously-established user preference, for security reasons, or due to platform limitations, the <a>user agent</a> MAY <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                 <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                 (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+            </li>
+
+            <li>
+                  The <a>user agent</a> MUST prompt the user in a user-agent-specific manner for permission to provide the
+                  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s
+                  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> with an array of
+                  <a href="#networkservice"><code>NetworkService</code></a> objects representing the user-authorized subset of <var>services found</var>.
+
+               <p>
+                  If the user grants permission to access one or more networked services then the <a>user agent</a> SHOULD include an
+                  "ongoing local-network communication" indicator.
+               </p>
+
+               <p>If the user denies permission, then the <a>user agent</a> MUST <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose
+                <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
+                (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return.
+              </p>
+
+              <p>
+                If the user never responds, this algorithm stalls on this step.
+              </p>
+
+            </li>
+
+            <li>
+               Let <var>services</var> be the array of one or more <a href="#networkservice"><code>NetworkService</code></a> objects for which the user granted permission.
+            </li>
+
+            <li>
+               For each Object <var>service</var> in <var>services</var>, run the following substeps:
+
+               <ol class="rule">
+                  <li>
+                     Add the <var>service</var>'s <code>url</code> parameter to the <a>entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
+                  </li>
+                  <li>
+                    If <var>service</var>'s <code>type</code> parameter begins with the DOMString &quot;<code>upnp:</code>&quot; and the <var>service</var>'s <code>eventsUrl</code> parameter is not empty then <a>setup a UPnP Events Subscription</a> for <var>service</var>.
+                  </li>
+               </ol>
+            </li>
+
+            <li>
+               Let <var>services manager</var> be a new <a href="#networkservices"><code>NetworkServices</code></a> object.
+            </li>
+
+            <li>
+               Set <var>services manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to the length of <var>services</var>.
+            </li>
+
+            <li>
+              Store the set of <var>services</var> as <dfn id="current_authorized_services">current authorized services</dfn> internally against the newly created <var>services manager</var> object.
+            </li>
+
+            <li>
+               The <a>user agent</a> MUST <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>successCallback</var> with
+               <var>services manager</var> as its argument.
+            </li>
+
+          </ol>
+
+          <p>
+            The <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#task-source" class="externalDFN">task source</a> for these
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#concept-task" class="externalDFN">tasks</a> is the
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#user-interaction-task-source" class="externalDFN">user interaction task source</a>.
+          </p>
+
+          <p>
+            When a <a href="#networkservice"><code>NetworkService</code></a> object is provided to a Web page, the <a>user agent</a> MUST add the <code>url</code> property
+             to the <dfn>entry script origin's URL whitelist</dfn>. This list enables the
+            Web page to override and initiate cross-site resource requests towards these URLs, and any sub-resources of these URLs, within the current
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s
+            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> via various existing mechanisms (e.g. Web Sockets, Server-Sent Events,
+            Web Messaging, XMLHttpRequest).
+         </p>
+
+         <p>
+            If the user navigates away from the current browsing context, the <a>user agent</a> MUST remove all previously whitelisted urls from the <a>entry script origin's URL whitelist</a>.
+            There is no persistence to network service selections provided to a web page. It is not possible to access a previously white-listed networked service without the necessary user authorization in all of the following cases:
+            <ul>
+              <li>If the current script is reloaded at any point in the same or different window.</li>
+              <li>if the current script reinvokes the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method at any point in its execution.</li>
+              <li>If the user navigates forward or back in their history to reload the current page.</li>
+              <li>If a script is running in a different origin.</li>
+            </ul>
+         </p>
+
+      </div>
+      </section>
+
+      <section>
+         <h3>Error Handling</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">error</var>
+           .
+          <code title="dom-NavigatorNetworkServiceError-code">
+            <a href="#dom-navigatornetworkserviceerror-code">code</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            Returns the current error's error code. At the current time, this may be <code>1</code> or <code>2</code>, for which the
+            corresponding error constants
+            <a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a> and
+            <a href="#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a> are defined.
+          </p>
+        </dd>
+      </dl>
+
+         <p>
+            The <dfn id="dom-navigatornetworkserviceerror-code" title="dom-navigatornetworkserviceerror-code"><code>code</code></dfn> attribute of a
+            <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object MUST return the code for the error, which will be one of the following:
+         </p>
+
+         <dl>
+            <dt>
+               <dfn id="dom-navigatornetworkserviceerror-permission_denied" title="dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></dfn> (numeric value 1)
+            </dt>
+            <dd>
+               The user denied the page permission to access any services.
+            </dd>
+            <dt>
+               <dfn id="dom-navigatornetworkserviceerror-unknown_type_prefix" title="dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></dfn> (numeric value 2)
+            </dt>
+            <dd>
+               No <a>valid service type</a> tokens were provided in the method invocation.
+            </dd>
+         </dl>
+
+      </section>
+
+      </section>
+      <section>
+      <h2>Obtaining networked services</h2>
+
+      <p>
+         The <a href="#networkservices"><code>NetworkServices</code></a> interface is the top-level response object from a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> and provides access to a set of user-authorized <a href="#networkservice"><code>NetworkService</code></a> objects for the given request.
+      </p>
+
+<pre class="widl">
+[NoInterfaceObject]
+interface <dfn id="networkservices">NetworkServices</dfn> {
+  readonly attribute unsigned long    <a href="#dom-networkservices-length">length</a>;
+  getter <a href="#networkservice">NetworkService</a> (unsigned long index);
+  <a href="#networkservice">NetworkService</a>? <a href="#dom-networkservices-getservicebyid">getServiceById</a>(DOMString id);
+
+  readonly attribute unsigned long    <a href="#dom-networkservices-servicesavailable">servicesAvailable</a>;
+
+  // event handler attributes
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservices-onserviceavailable">onserviceavailable</a>;
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservices-onserviceunavailable">onserviceunavailable</a>;
+
+};
+
+<a href="#networkservices">NetworkServices</a> implements <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" class="externalDFN">EventTarget</a>;
+</pre>
+
+      <section>
+      <h2>Attributes</h2>
+
+        <dl class="domintro">
+          <dt>
+            <code title="dom-networkservices-length">
+              <a href="#dom-networkservices-length">length</a>
+            </code>
+          </dt>
+          <dd>
+            <p>
+              Returns the current number of services in the respective object's <a>current authorized services</a>.
+            </p>
+          </dd>
+          <dt>
+            <code title="dom-networkservices-servicesavailable">
+              <a href="#dom-networkservices-servicesavailable">servicesAvailable</a>
+            </code>
+          </dt>
+          <dd>
+            <p>
+              Returns the current number of services matching one of the app-requested <a>valid service type</a> tokens that are actively available within the user's current network.
+            </p>
+          </dd>
+        </dl>
+
+        <div>
+           <p>
+              The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute MUST return the number of services represented in the object's corresponding <a>current authorized services</a> list at the time of getting.
+           </p>
+
+           <p>
+              The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute MUST return the number of services available in the
+              user's network that match the <a>valid service type</a> that was initially used to create the current <a href="#networkservices"><code>NetworkServices</code></a> object.
+           </p>
+
+           <p>
+             When a previously unknown instance of a networked service matching one of the requested <a href="#dfn-valid-service-type">valid service types</a> becomes available on the user's current network, the <a>user agent</a> MUST increment the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> and then
+             <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+             to dispatch a newly created event with the name <code>serviceavailable</code> that uses the <code>Event</code> interface, which does
+             not bubble, is not cancellable, and has no default action, at the current <a href="#networkservices"><code>NetworkServices</code></a>
+             object.
+           </p>
+
+           <p>
+             When a previously known instance of a networked service matching one of the requested <a href="#dfn-valid-service-type">valid service types</a> becomes unavailable on the user's current network, the <a>user agent</a> MUST decrement the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> and then
+             <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+              to dispatch a newly created event with the name <code>serviceunavailable</code> that uses the <code>Event</code> interface, which does
+              not bubble, is not cancellable, and has no default action, at the current <a href="#networkservices"><code>NetworkServices</code></a>
+              object.
+           </p>
+        </div>
+
+      </section>
+
+      <section>
+      <h2>Methods</h2>
+        <dl class="domintro">
+        <dt>
+          <code title="networkservices-getter">
+            <a href="#networkservices">services</a>
+          </code>
+          [
+          <var title="">index</var>
+          ]
+        </dt>
+        <dd>
+          <p>
+            Returns the specified <a href="#networkservice"><code>NetworkService</code></a> object.
+          </p>
+        </dd>
+        <dt>
+          <code title="networkservices-getter">
+            <a href="#networkservices">services</a>
+          </code>
+          .
+          <code title="dom-networkservices-getservicebyid">
+            <a href="#dom-networkservices-getservicebyid">getServiceById</a>
+          </code>
+          (
+          <var title="">id</var>
+          )
+        </dt>
+        <dd>
+          <p>
+            Returns the <a href="#networkservice"><code>NetworkService</code></a> object with the given identifier, or null if no
+            service has that identifier.
+          </p>
+        </dd>
+      </dl>
+
+      <p>
+        A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current list of zero or more <a>current authorized services</a>, of which zero or more can be available at a time. Each item in <a>current authorized services</a> is represented by a <a href="#networkservice"><code>NetworkService</code></a> object. The list of <a>current authorized services</a> is <span>immutable</span> meaning that it cannot be modified for the lifetime of a <a href="#networkservices"><code>NetworkServices</code></a> object.
+      </p>
+
+      <p class="note">
+        Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the first has the index 0, and each subsequent service is numbered one higher than the previous one. If the <a>user agent</a> dynamically adds or removes network services for any reason, then the indices of the services in <a>current authorized services</a> will change dynamically. If the set of network services changes entirely, then all the previous services will be removed from <a>current authorized services</a> and replaced with new services.
+      </p>
+
+      <p>
+        The <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a> of <a href="#networkservices"><code>NetworkServices</code></a> objects at any instant are the numbers from zero to the number of items in <a>current authorized services</a> represented by the respective object minus one, if any services are represented in <a>current authorized services</a>. If a <a href="#networkservices"><code>NetworkServices</code></a> object represents no <a>current authorized services</a>, it has no <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices" class="externalDFN">supported property indices</a>.
+      </p>
+
+      <p>
+        To <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#determine-the-value-of-an-indexed-property" class="externalDFN">determine the value of an indexed property</a> for a given index <var>index</var> in a <a href="#networkservices"><code>NetworkServices</code></a> object's <a>current authorized services</a>, the user agent MUST return the <a href="#networkservice"><code>NetworkService</code></a> object that represents the <var>index</var>th service in <a>current authorized services</a>.
+      </p>
+
+      <p>
+        The <dfn id="dom-networkservices-getservicebyid"><code>getServiceById(id)</code></dfn> method MUST return the first <a href="#networkservice"><code>NetworkService</code></a> object in <a>current authorized services</a> represented by the respective object whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to the value of the <var>id</var> argument.
+        When no services in <a>current authorized services</a> match the given argument, the method MUST return null.
+      </p>
+
+      <p>
+         Services available within the local network can connect and disconnect at different times during the execution of a web page. A <a>user agent</a> can
+         inform a web page when the state of networked services matching the requested <a>valid service type</a> change. Web pages can use this information to enable in-page experiences for communicating the state of networked services
+         with the ability to change the particular service or set of services the page is connected to by re-invoking the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method.
+      </p>
+
+      </section>
+
+      <section>
+      <h2>Events</h2>
+
+      <p>
+         The following are the event handlers (and their corresponding event handler event types) that must be supported, as IDL attributes, by all objects implementing the <a href="#networkservices"><code>NetworkServices</code></a> interface:
+       </p>
+
+       <table border="1">
+        <thead>
+          <tr>
+            <th>
+              <span title="event handlers">Event handler</span>
+            </th>
+            <th>
+              <span>Event handler event type</span>
+            </th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr>
+            <td>
+              <dfn id="dom-networkservices-onserviceavailable" title="dom-NetworkServices-onserviceavailable">
+                <code>onserviceavailable</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-serviceavailable">serviceavailable</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservices-onserviceunavailable" title="dom-NetworkServices-onserviceunavailable">
+                <code>onserviceunavailable</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-serviceunavailable">serviceunavailable</code>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+
+      <p>
+         Events with an event type of <code>serviceavailable</code> or <code>serviceunavailable</code> defined in this specification are simple <code>Event</code> objects.
+      </p>
+
+      </section>
+
+    </section>
+    <section>
+    <h2>Communicating with a networked service</h3>
+
+<p>
+   The <a href="#networkservice"><code>NetworkService</code></a> interface is used to provide a set of connection information for an HTTP service endpoint and if available, service events, running on a networked device.
+</p>
+
+<pre class="widl">
+[NoInterfaceObject]
+interface <dfn id="networkservice">NetworkService</dfn> {
+  readonly attribute DOMString        <a href="#dom-networkservice-id">id</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-name">name</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-type">type</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-url">url</a>;
+  readonly attribute DOMString        <a href="#dom-networkservice-config">config</a>;
+
+  readonly attribute boolean          <a href="#dom-networkservice-online">online</a>;
+
+  // event handler attributes
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onserviceonline">onserviceonline</a>;
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onserviceoffline">onserviceoffline</a>;
+
+           attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a>     <a href="#dom-networkservice-onnotify">onnotify</a>;
+};
+
+<a href="#networkservice">NetworkService</a> implements <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" class="externalDFN">EventTarget</a>;
+</pre>
+
+<section>
+  <h2>Attributes</h2>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-id">
+            <a href="#dom-networkservice-id">id</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            A unique identifier for the given user-selected service instance.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-name">
+            <a href="#dom-networkservice-name">name</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The name of the user-selected service.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-type">
+            <a href="#dom-networkservice-type">type</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The <a>valid service type</a> token value of the user-selected service.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-url">
+            <a href="#dom-networkservice-url">url</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The control URL endpoint (including any required port information) of the user-selected control service that has been added to the <a>entry script origin's URL whitelist</a>.
+          </p>
+        </dd>
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-config">
+            <a href="#dom-networkservice-config">config</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            The configuration information associated with the service depending on the requested service type.
+          </p>
+        </dd>
+      </dl>
+
+          <p>
+            The <dfn id="dom-networkservice-id"><code>id</code></dfn> attribute is a unique identifier for the service. Two services provided at different times or on different objects MUST have the same <a href="#dom-networkservice-id"><code>id</code></a> value.
+         </p>
+
+         <p>
+            The <dfn id="dom-networkservice-name"><code>name</code></dfn> attribute represents a human-readable title for the service.
+         </p>
+
+         <p>
+             The <dfn id="dom-networkservice-type"><code>type</code></dfn> attribute reflects the value of the <a>valid service type</a> of the service.
+          </p>
+
+         <p>
+            The <dfn id="dom-networkservice-url"><code>url</code></dfn> attribute is an <a href="http://www.w3.org/TR/html5/urls.html#absolute-url" class="externalDFN">absolute URL</a> pointing to the root HTTP
+            endpoint for the service that has been added to the <a>entry script origin's URL whitelist</a>. Web pages can subsequently use this value for implicit cross-document messaging via various existing mechanisms (e.g. Web Sockets, Server-Sent Events, Web Messaging, XMLHttpRequest).
+         </p>
+
+         <p>
+            The <dfn id="dom-networkservice-config"><code>config</code></dfn> attribute provides the raw configuration information extracted from the given network service.
+         </p>
+
+      </section>
+
+      <section>
+         <h3>States</h3>
+
+      <dl class="domintro">
+        <dt>
+          <var title="">service</var>
+           .
+          <code title="dom-networkservice-online">
+            <a href="#dom-networkservice-online">online</a>
+          </code>
+        </dt>
+        <dd>
+          <p>
+            Returns <code>true</code> if the service is reporting that it is accessible on the local network or <code>false</code> if the service is reporting that it is no longer accessible (temporarily or permanently) on the local network.
+          </p>
+        </dd>
+      </dl>
+
+      <p>
+        The <dfn id="dom-networkservice-config"><code>online</code></dfn> attribute indicates whether the service is reporting itself as being
+        either <var>online</var>, and therefore accessible on the local network, in which case this attribute will return <code>true</code> or, <var>offline</var>, and therefore not accessible on the local network, either temporarily or permanently, in which case this attribute will return <code>false</code>. This attribute MUST default to <code>true</code>.
+      </p>
+
+      </section>
+
+      <section>
+         <h3>Events</h3>
+
+      <p>
+         The following are the event handlers (and their corresponding event handler event types) that must be supported, as IDL attributes, by all objects implementing the
+         <a href="#networkservice"><code>NetworkService</code></a> interface:
+       </p>
+
+       <table border="1">
+        <thead>
+          <tr>
+            <th>
+              <span title="event handlers">Event handler</span>
+            </th>
+            <th>
+              <span>Event handler event type</span>
+            </th>
+          </tr>
+        </thead>
+        <tbody>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-onnotify" title="dom-NetworkService-onnotify">
+                <code>onnotify</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-notify">notify</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-onserviceonline" title="dom-NetworkService-onserviceonline">
+                <code>onserviceonline</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-onserviceonline">serviceonline</code>
+            </td>
+          </tr>
+          <tr>
+            <td>
+              <dfn id="dom-networkservice-offserviceoffline" title="dom-NetworkService-onserviceoffline">
+                <code>onserviceoffline</code>
+              </dfn>
+            </td>
+            <td>
+              <code title="event-onserviceoffline">serviceoffline</code>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+
+      <p>
+         Events with an event type of <code>notify</code>, <code>serviceonline</code> or <code>serviceoffline</code> defined in this specification are simple <code>Event</code> objects.
+      </p>
+
+      </section>
+   </section>
+
+      <section>
+            <h2>Service Discovery</h2>
+
+      <p>
+         A <a>user agent</a> conforming to this specification MAY implement <acronym title="Simple Service Discovery Protocol">SSDP</acronym> [[!UPNP-DEVICEARCH11]] and Zeroconf [[!DNS-SD]] + [[!MDNS]] service discovery mechanisms
+         to enable Web pages to request and connect with HTTP services running on networked devices, discovered via either mechanism, through this API. When a <a>user agent</a> implements either of these service discovery mechanisms, then it MUST conform to the corresponding algorithms provided in this section of the specification.
+      </p>
+      <p>
+         This section presents how the results of these two service discovery
+         mechanisms will be matched to requested service types and how their properties will be applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
+      </p>
+
+      <p>
+         It is expected that user agents will perform these service discovery mechansisms asynchronously and periodically update the <a>list of networked devices</a> as required. The timing of any
+         service discovery mechanisms is an implementation detail left to the discretion of the implementer (e.g. once on user agent start-up, every X seconds during user agent execution or on
+         invocation of this API from a Web page).
+      </p>
+
+      <p>
+         The <dfn>list of available service records</dfn> is a single dynamic internal lookup table within user agents that is used to track the current services available in the network at any given time.
+         At any point during the running of either of the two service discovery mechanisms then existing entries within this table can be updated, entries can be added and entries can be removed as the status of networked
+         services changes. Each record contained within this table contains the attributes: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code> and <code>config</code>.
+      </p>
+
+            <section>
+         <h4>Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> + <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>)</h4>
+
+         <p>
+            For each DNS response received from a user-agent-initiated Multicast DNS Browse for <abbr title="DNS Pointer Record">PTR</abbr> records with the name <code>_services._dns-sd._udp</code> on the resolved recommended automatic browsing
+   domain [[!MDNS]], the <a>user agent</a> MUST run the following steps:
+         </p>
+
+         <ol class="rule">
+
+            <li>Let <var>service mDNS responses</var> be an array of PTR records received by issuing a Multicast DNS Browse for PTR records with the name of the current discovered service type.</li>
+
+            <li>For each Object <var>service mDNS response</var> in <var>service mDNS responses</var>, run the following steps:
+               <ol>
+
+                  <li>
+                     Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>config</code>.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>id</code> property to the value of the full PTR Service Instance Name [[!MDNS]].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>name</code> property to the value of the PTR Service Instance Name's <var>Instance</var> component [[!MDNS]].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string <code>zeroconf:</code> followed by the value of the PTR Service Instance Name's <var>Service</var> component [[!MDNS]].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>url</code> property to the resolvable Service URL obtained from performing an DNS-SD Lookup [[!DNS-SD]] of the current service from the PTR record provided [[!MDNS]].
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>config</code> property to the string value of the contents of the first DNS-SD TXT record associated with the <var>service mDNS response</var> as defined in [[!DNS-SD]].
+                  </li>
+
+                  <li>
+                     For each Object <var>existing service record</var> in the current <a>list of available service records</a>, run the following sub-steps:
+                     <ol class="rule">
+
+                       <li>
+                        If the <var>existing service record</var>'s <code>id</code> property matches the value of the <var>network service record</var>'s <code>id</code>, then set the
+                        value of <var>existing service record</var> in the current <a>list of available service records</a>  to the value of the
+                        <var>network service record</var> and skip the next step.
+                       </li>
+                     </ol>
+                  </li>
+
+                  <li>
+                     Add <var>network service record</var> to the <a>list of available service records</a>.
+                  </li>
+
+                  <li>
+                     For each non-garbage collected <a href="#networkservice"><code>NetworkService</code></a> object run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           If the <a href="#networkservice"><code>NetworkService</code></a> object's <code>type</code> attribute does not equal the
+                           current <a>network service record</a>'s <code>type</code> property then continue at the next available active
+                           <a href="#networkservice"><code>NetworkService</code></a> object.
+                        </li>
+                        <li>
+                           Increment the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <a href="#networkservices"><code>NetworkServices</code></a> object by <code>1</code>.
+                        </li>
+                        <li>
+                          <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
+                           to dispatch a newly created event with the name <code>serviceavailable</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                            <a href="#networkservices"><code>NetworkServices</code></a> object.
+                        </li>
+                        <li>
+                          <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
+                           to dispatch a newly created event with the name <code>serviceonline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                           <a href="#networkservice"><code>NetworkService</code></a> object.
+                        </li>
+                     </ol>
+                  </li>
+            </ol>
+           </li>
+         </ol>
+
+      </section>
+
+      <section>
+         <h5>Universal Plug-and-Play (<abbr title="Universal Plug-and-Play">UPnP</abbr>)</h5>
+
+         <p>
+            For each SSDP Presence Announcement [[!UPNP-DEVICEARCH11]] - a HTTP NOTIFY request - received from a user-agent-initiated SSDP Discovery Request [[!UPNP-DEVICEARCH11]], the <a>user agent</a> MUST run the following steps:
+         </p>
+
+         <ol class="rule">
+            <li>
+               Let <var>ssdp device</var> be an Object with a property for each HTTP header received in the received SSDP Presence Announcement, with each key being the name of a HTTP header and its
+               value being that HTTP header's accompanying value.
+            </li>
+
+            <li>
+               If <var>ssdp device</var> does not contain at least one <var>NTS</var>, <var>USN</var> and <var>Location</var> parameter, then the <a>user agent</a> MUST abort these steps.
+            </li>
+
+            <li>
+               If the first occurrence of <var>NTS</var> has a value other than <code>ssdp:alive</code>, then continue to the step labeled <var>update service monitor</var> below.
+            </li>
+
+            <li>
+               Let <var>root device descriptor file</var> contain the contents of the file located at the URL provided in the first occurrence of <var>Location</var> obtained according to the rules
+               defined in the section 'Retrieving a description using HTTP' [[!UPNP-DEVICEARCH11]].
+            </li>
+
+            <li>
+               If <var>root device descriptor file</var> is empty, then the <a>user agent</a> MUST abort these steps.
+            </li>
+
+            <li>
+               Let <var>advertised services</var> be a <a>list of all advertised services</a> obtained from the <var>root device descriptor file</var> containing all sub-nodes of the <code>serviceList</code> node as described in
+               the section 'Device Description' [[!UPNP-DEVICEARCH11]].
+            </li>
+
+            <li>
+               For each Object <var>advertised service</var> in <var>advertised services</var> run the following steps:
+               <ol class="rule">
+
+                  <li>
+                     Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>eventsUrl</code>, <code>config</code>.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>id</code> property to the string value of the first occurrence of <var>ssdp device</var>'s <var>USN</var> parameter.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>name</code> property to the string value of the first occurrence of the <var>service</var>'s <code>serviceId</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string <code>upnp:</code> followed by the string value of the first occurrence of the <var>service</var>'s <code>serviceType</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>url</code> property to the string value of the first occurrence of the <var>service</var>'s <code>controlURL</code> property.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>config</code> property to the string value of the first occurrence of the <var>device</var> property.
+                  </li>
+
+                  <li>
+                     If <var>service</var>'s <code>eventSubURL</code> property is empty, then continue to the step labeled <em>register</em> below.
+                  </li>
+
+                  <li>
+                     Set <var>network service record</var>'s <code>eventsUrl</code> property to the string value of the first occurrence of the <var>service</var>'s <code>eventSubURL</code> property.
+                  </li>
+
+                  <li>
+                     <em>Register</em>: For each Object <var>existing service record</var> in the current <a>list of available service records</a>, run the following sub-steps:
+                     <ol class="rule">
+
+                       <li>
+                        If the <var>existing service record</var>'s <var>id</var> property matches the value of the first occurrence of <var>USN</var> and the
+                        <var>existing service record</var>'s <code>type</code> property matches the value of <var>network service record</var>'s <code>type</code>, then set the
+                        value of <var>existing service record</var> in the current <a>list of available service records</a>  to the value of the
+                        <var>network service record</var> and skip the next step.
+                       </li>
+                     </ol>
+                  </li>
+
+                  <li>
+                     Add <var>network service record</var> to the <a>list of available service records</a>.
+                  </li>
+
+               </ol>
+            </li>
+            <li>
+               <em>Update Service Monitor</em>: For each non-garbage collected <a href="#networkservice"><code>NetworkService</code></a> object run the following steps:
+
+               <ol class="rule">
+                  <li>
+                     If this <a href="#networkservice"><code>NetworkService</code></a> object's <code>type</code> attribute does not equal the
+                     current <a>network service record</a>'s <code>type</code> property then continue at the next available active
+                     <a href="#networkservice"><code>NetworkService</code></a> object.
+                  </li>
+                  <li>
+                     If the <var>announcement type</var> equals <code>ssdp:alive</code> then Increment the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <a href="#networkservices"><code>NetworkServices</code></a>
+                     object by <code>1</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+                      to dispatch a newly created event with the name <code>serviceonline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                      <a href="#networkservice"><code>NetworkService</code></a> object. Otherwise, decrement the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the <a href="#networkservices"><code>NetworkServices</code></a>
+                     object by <code>1</code> and then  <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a>
+                       to dispatch a newly created event with the name <code>serviceoffline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                       <a href="#networkservice"><code>NetworkService</code></a> object..
+                  </li>
+               </ol>
+            </li>
+         </ol>
+
+         <p>
+            A <dfn>user-agent generated callback url</dfn> is a Local-network accessible URL endpoint that a <a>user agent</a> must generate and maintain for receiving HTTP NOTIFY requests from UPnP Event sources.
+         </p>
+
+         <p>When the <a>user agent</a> is to <dfn>setup a UPnP Events Subscription</dfn>, it is to run the following steps with the current <var>network service record</var> object:</p>
+
+         <ol class="rule">
+            <li>
+               If <var>network service record</var>'s <code>eventsUrl</code> property is empty then the <a>user agent</a> MUST abort these steps.
+            </li>
+
+            <li>
+               Let <var>callback URL</var> be the value of creating a new <a>user-agent generated callback url</a>.
+            </li>
+
+            <li>
+               Send a HTTP SUBSCRIBE request with a <em>NT</em> header with a string value of <code>upnp:event</code>, a <em>TIMEOUT</em> header with an integer value ofƒ
+               <code>86400</code> and a <em>CALLBACK</em> header
+               with a string value of <var>callback URL</var> towards the <var>network service record</var>'s <code>eventsUrl</code> property.
+            </li>
+
+            <li>
+               If a non-200 OK response is received from the HTTP SUBSCRIBE request then the <a>user agent</a> MUST abort these steps.
+            </li>
+
+            <li>
+               On receiving a valid 200 OK response, run the following steps:
+
+               <ol class="rule">
+                  <li>
+                     Let <var>callback ID</var> equal the string value of the first included <em>SID</em> header, if it exists.
+                  </li>
+                  <li>
+                     Let <var>timeout date</var> equal the sum of the current UTC date value plus the integer value of the first included <em>TIMEOUT</em> header, if it exists.
+                  </li>
+                  <li>
+                     Run the following steps aynchronously and continue to the step labeled <em>listen</em> below.
+                  </li>
+                  <li>
+                     <em>Refresh Subscription</em>: Run the following steps at a set interval (X) within the <a>user agent</a>:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>current date</var> equal the current UTC date.
+                        </li>
+                        <li>
+                           If <var>current date</var> is less than the <var>timeout date</var> then continue to the step labeled <em>refresh subscription</em> above.
+                        </li>
+                        <li>
+                           Send a HTTP SUBSCRIBE request with a <em>SID</em> header with the string value of <var>callback ID</var> and a <em>TIMEOUT</em> header
+                           with an integer value of <code>86400</code> towards the <var>network service record</var>'s <code>eventsUrl</code> property.
+                        </li>
+                        <li>
+                           On receiving a valid 200 OK, update <var>callback ID</var> with the string value of the first included <em>SID</em> header, if it exists. All other HTTP
+                           responses should cause the <a>user agent</a> to continue from the step labeled <em>refresh subscription</em> above.
+                        </li>
+                     </ol>
+
+                  </li>
+
+                  <li>
+                     <em>Listen</em>: For each HTTP NOTIFY request received at the <var>callback URL</var> the <a>user agent</a> is to run the following steps:
+
+                     <ol class="rule">
+                        <li>
+                           Let <var>content clone</var> be the result of obtaining the message body of the HTTP NOTIFY request. If <var>content clone</var> is empty, then the <a>user agent</a> MUST abort these steps.
+                        </li>
+                        <li>
+                          Let <var>notification event</var> be a new simple event that uses the <code>Event</code> interface with the name <code>notify</code>,
+                           which does not bubble, is not cancellable, and has no default action.
+                        </li>
+                        <li>
+                           Let the <code>data</code> attribute of <var>notification event</var> have the DOMString value of <var>content clone</var>.
+                        </li>
+                        <li>
+                           <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a> to
+                            dispatch <var>notification event</var> at the current <a><code>NetworkService</code></a> object.
+                        </li>
+                     </ol>
+                  </li>
+
+               </ol>
+
+            </li>
+         </ol>
+
+         </section>
+
+         <section>
+            <h3>Network Topology Monitoring</h3>
+
+                  <div>
+                     <p>
+                        When the <a>user agent</a> detects that the user has dropped from their connected network, then it MUST run the following steps:
+                     </p>
+
+                     <ol class="rule">
+                        <li>
+                           Flush all entries from the <a>list of available service records</a>.
+                        </li>
+                        <li>
+                           For each <a href="#networkservice"><code>NetworkService</code></a> object currently active in the <a>user agent</a> perform the following steps:
+
+                           <ol class="rule">
+                              <li>
+                                 Set the <a href="#dom-networkservice-online"><code>online</code></a> attribute to <code>false</code>.
+                              </li>
+                              <li>
+                                 <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">Queue a task</a>
+                                                      to dispatch a newly created event with the name <code>serviceoffline</code> that uses the <code>Event</code> interface, which does not bubble, is not cancellable, and has no default action, at the current
+                                                      <a href="#networkservice"><code>NetworkService</code></a> object.
+                           </ol>
+                        </li>
+                        <li>
+                          For each <a href="#networkservices"><code>NetworkServices</code></a> object currently active in the <a>user agent</a> perform the following steps:
+
+                          <ol class="rule">
+                            <li>
+                              Let <var>number of available services</var> equal the value of <a href="#networkservices"><code>NetworkServices</code></a>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute.
+                            </li>
+                            <li>
+                              Set the <a href="#networkservices"><code>NetworkServices</code></a>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to zero (<code>0</code>).
+                            </li>
+                            <li>
+                              For each <var>available service</var> in <var>number of available services</var> the <a>user agent</a> MUST fire a new simple event with the name <code>serviceunavailable</code> that has no default action, does not bubble and is not cancellable, at the current <a href="#networkservices"><code>NetworkServices</code></a> object.
+                            </li>
+                          </ol>
+                        </li>
+
+                     </ol>
+
+                     <p>
+                        When the <a>user agent</a> detects that the user has connected to a new network, then it SHOULD run the following steps:
+                     </p>
+
+                     <ol class="rule">
+                        <li>
+                           Re-issue an mDNS search and SSDP discovery search using all of the <a>valid service type</a> tokens initially provided to all active <a href="#networkservices"><code>NetworkServices</code></a> objects and handle all discovery responses according to the processing defined in <a href="#service-discovery">Section 7: Service Discovery</a>.
+                        </li>
+                     </ol>
+                  </div>
+         </section>
+      </section>
+
+   <section>
+      <h3>Garbage collection</h3>
+
+      <p>
+         A <a><code>NetworkService</code></a> object containing a <code>url</code> parameter currently in the <a>entry script origin's URL whitelist</a> MUST NOT be garbage collected.
+      </p>
+
+      <p>
+         Only when the user navigates away from the current browsing context can <a><code>NetworkService</code></a> objects be garbage-collected and records in the <a>entry script origin's URL whitelist</a> be removed.
+      </p>
+
+   </section>
+
+
+    <section>
+      <h3>Use Cases and Requirements</h3>
+
+      <p>This section covers what the requirements are for this API, as well as illustrates some use cases.</p>
+
+      <ul class="rule">
+         <li>
+            Once a user has given permission, user agents should provide the ability for Web pages to communicate directly with a Local-networked Service.
+            <ul class="rule">
+               <li>
+                  Example: A web-based TV remote control. A Web page wants to control the current user's TV, changing the programming shown or increasing/decreasing/muting the
+                  volume of the Local-networked Device. The Web page requests a service type that is known to be implemented by television sets to which it has the
+                  application logic to communicate. Local devices providing the request service types are discovered and presented to the user for authorization. The user selects one
+                  or more of the discovered television sets to be accessible to the current Web page and then clicks 'Share'. The Web page can now communicate directly with
+                  the user-authorized Local-networked services.
+               </li>
+            </ul>
+         </li>
+
+         <li>
+           Web pages should be able to communicate with Local-networked Services using the messaging channel supported by those Devices.
+           <ul class="rule">
+            <li>
+               Example: A Web page advertises that it is capable of controlling multiple Home Media Servers. The user can select their Home Media Server type from a drop-down list, at which point the
+               Web page sends a request to the user agent to connect with the associated service type of the Home Media Server. The Media Server selected implements a Web Socket channel for
+               bi-directional service communication and so the Web page opens a web socket to the requested Media Server and can communicate as required via that appropriate channel.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           Web pages should be able to communicate with Local-networked Services using the messaging format supported by those Devices.
+           <ul class="rule">
+            <li>
+               Example: A Web page advertises that it is capable of interacting with and controlling multiple types of Home Media Server. The user can select their Home Media Server type from a drop-down list or known Media Servers, at which point the
+               Web page sends a request to the user agent to connect with the associated service type (and, optionally, the associated event type) of the Home Media Server. The communiciation protocols supported by Home Media Servers typically vary
+               between UPnP, JSON-RPC, Protocol Buffers or other messaging formats depending on the Home Media Server requested. The Web page is able to communicate with the user-selected Home Media
+               Server in the messaging format supported by that Device, which, in this example is a simple key/value pair text format.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           Web pages should not be able to communicate with Local-networked Services that have not been authorized by the user thereby maintaining the user's privacy.
+           <ul class="rule">
+            <li>
+               Example: A Web page requests access to one type of Local-networked service. The user authorizes access to that particular service. Other services running on that same device, and on other devices
+               within the network, should not be accessible to the current Web page.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           A user should be able to share one or more Local-networked Services based on a particular service type request from a Web page.
+           <ul class="rule">
+            <li>
+               Example: A Web page is capable of interacting with a specific profile of Local-networked Service. As such, it makes a request to the user agent to access those services, of which multiple matches
+               are found. The user is capable of selecting one or more of the discovered services to share with the Web page. The Web page can then implement a drag-and-drop interface for the user to drag specific
+               actions on to one or more of the authorized Local-networked Services.
+            </li>
+           </ul>
+         </li>
+
+         <li>
+           User agents should provide an API exposed to script that exposes the features above. The user is notified by UI anytime interaction with Local-networked Services is requested, giving the user
+           full ability to cancel or abort the transaction. The user selects the Local-networked Services to be connected to the current Web page, and can cancel these at any time. No invocations to
+           these APIs occur silently without user intervention.
+         </li>
+      </ul>
+    </section>
+
+          <section class="informative appendix">
+             <h3>Examples</h3>
+
+           <div class="example">
+            <p>This sample code exposes a button. When clicked, this button is disabled and the user is prompted to offer a network service. The user may also select multiple network services. When the user has authorized a network service to be connected to the web page then the web page issues a simple command to get a list of all the albums stored on the connected media player service.
+            <p>The button is re-enabled only when the connected network service disconnects for whatever reason (the service becomes unavailable on the network, the user disconnects from their current network or the user revokes access to the service from the current web page). At this point the user can re-click the button to select a new network service to connect to the web page and the above steps are repeated.</p>
+            <p>The provided service type identifier and service interaction used in this example is based on the well-defined service type and messaging format supported by the <a href="http://xbmc.org/about/">XBMC Media Server</a>. </p>
+            <hr />
+            <pre class="highlight">&lt;input type="button" value="Start" onclick="start()" id="startBtn"/&gt;
+&lt;div id="debugconsole">&lt;/div>
+
+&lt;script>
+ var startBtn = document.getElementById('startBtn'),
+     debug = document.getElementById('debugconsole');
+
+ function start() {
+   if(navigator.getNetworkServices) {
+      navigator.getNetworkServices('zeroconf:_xbmc-jsonrpc._tcp', gotXBMCService, error);
+      startBtn.disabled = true;
+   } else {
+      debug.innerHTML += "&lt;br&gt;Service Discovery not supported!";
+   }
+ }
+
+ function gotXBMCService(services) {
+
+// Listen for service disconnect messages
+
+   services[0].addEventListener('serviceoffline', function ( e ) {
+       debug.innerHTML += "&lt;br>" + services[0].name + " disconnected.";
+       startBtn.disabled = false;
+   }, false);
+
+// Send a service message to get albums list (and process the service response)
+
+   var svcXhr = new XMLHttpRequest();
+   svcXhr.open("POST", services[0].url + "/getAlbums"); // services[0].url and its subresources have been
+                                                        // whitelisted for cross-site XHR use in this
+                                                        // current browsing context.
+
+   svcXhr.setRequestHeader('Content-Type', 'application/json-rpc');
+
+   svcXhr.addEventListener('readystatechange', function ( response ) {
+     if( response.readyState != 4 || response.status != 200 )
+        return;
+     debug.innerHTML += "&lt;br>" + services[0].name + " response received: ";
+     debug.textContent += JSON.parse(response.responseText);
+   }, false);
+
+   var svcMsg = [
+     { "jsonrpc": "2.0", "method": "AudioLibrary.GetAlbums", "params": { "genreid": -1,
+         "artistid": -1, "start": -1, "end": -1 }, "id": "1" }
+   ];
+
+   svcXhr.send(JSON.stringify(svcMsg));
+   debug.innerHTML += "&lt;br>" + services[0].name + " request sent: ";
+   debug.textContent += JSON.stringify(svcMsg);
+
+ }
+
+ function error( err ) {
+   debug.innerHTML += "&lt;br>An error occurred obtaining a local network service.";
+   startBtn.disabled = false;
+ }
+&lt;/script></pre>
+           </div>
+
+           <div class="example">
+            <p>
+             This sample exposes a drop-down list containing a number of common Home-based audio devices. When the user selects an audio device from the list provided, they are prompted to authorize a network service
+             based on the service type requested. The user may also select multiple network services matching the selected service type.
+             In this example, the user selects their make as being <var>Sony</var> and their model as being <var>Bravia S1000</var> from which the Web page can derive a service type
+             (<var>urn:schemas-upnp-org:service:RenderingControl:1</var>).
+             <br /><br />Once the user has authorized the device, the web page sends a simple mute command according to the messaging format supported by the device.
+            </p>
+            <hr />
+            <pre class="highlight">&lt;select name="make" id="make"&gt;
+  &lt;option selected="selected" disabled="disabled"&gt;Select make&lt;/option&gt;
+  &lt;option&gt;Sony&lt;/option&gt;
+  &lt;option&gt;Philips&lt;/option&gt;
+  &lt;option&gt;Alba&lt;/option&gt;
+&lt;/select&gt;
+&lt;select name="model" id="model"&gt;&lt;/select&gt;
+&lt;div id="debugconsole"&gt;&lt;/div&gt;
+
+&lt;script&gt;
+  var debug = document.getElementById('debugconsole');
+
+  var models = {
+    "Sony": [
+      {"name": "Bravia TV S1000", "type": "upnp", "service": "urn:schemas-upnp-org:service:RenderingControl:1" },
+      {"name": "Bravia TV S2000", "type": "zeroconf", "service": "_mediarenderer._http._tcp" },
+      {"name": "HiFi WD10", "type": "upnp", "service": "urn:schemas-upnp-org:service:RenderingControl:1" }
+    ],
+    "Philips": [ /* ... */ ],
+    "Alba": [ /* ... */ ]
+  };
+
+  var makeEl = document.getElementById("make"),
+      modelEl = document.getElementById("model");
+
+  makeEl.addEventListener('change', function() {
+    modelEl.innerHTML = ""; // reset
+    var defaultOption = document.createElement("option");
+    defaultOption.textContent = "Select model";
+    defaultOption.setAttribute("disabled", "disabled");
+    defaultOption.setAttribute("selected", "selected");
+    modelEl.appendChild(defaultOption);
+    for(var i = 0, l = models[makeEl.value].length; i < l; i++) {
+      var option = document.createElement("option");
+      option.textContent = models[makeEl.value][i]["name"];
+      option.setAttribute("value", models[makeEl.value][i]["type"] + ":" + models[makeEl.value][i]["service"]);
+      modelEl.appendChild(option);
+    }
+  }, false);
+
+  modelEl.addEventListener('change', function() {
+    if(navigator.getNetworkServices &&
+         modelEl.value == "upnp:urn:schemas-upnp-org:service:RenderingControl:1") {
+      navigator.getNetworkServices(modelEl.value, successCallback, errorCallback);
+    } else if (modelEl.value == "zeroconf:_mediarenderer._http._tcp") {
+      debug.innerHTML += "&lt;br&gt;Service type is not implemented by this application.";
+    } else {
+      debug.innerHTML += "&lt;br&gt;Service Discovery is not supported!";
+    }
+  }, false);
+&lt;/script&gt;
+
+&lt;script&gt;
+  function successCallback( services ) {
+
+  // Listen for service push notification messages
+
+    services[0].addEventListener('notify', function ( msg ) {
+         debug.innerHTML += "&lt;br>" + services[0].name + " event received: ";
+         debug.textContent += msg.data;
+    }, false);
+
+ // Send a control signal to mute the service audio
+
+    var svcXhr = new XMLHttpRequest();
+    svcXhr.open("POST", services[0].url); // services[0].url and its
+                                          // subresources have been whitelisted for
+                                          // cross-site XHR use in this current
+                                          // browsing context.
+
+    svcXhr.setRequestHeader('SOAPAction', 'urn:schemas-upnp-org:service:RenderingControl:1#SetMute');
+    svcXhr.setRequestHeader('Content-Type', 'text/xml; charset="utf-8";');
+
+    svcXhr.onreadystatechange = function ( response ) {
+      if( response.readyState != 4 || response.status != 200 )
+        return;
+      debug.innerHTML += "&lt;br&gt;" + services[0].name + " response received: ";
+      debug.textContent += response.responseXML;
+    }
+
+    // Service messaging to mute the provided service
+    var svcMsg = '&lt;?xml version="1.0" encoding="utf-8"?&gt;' +
+                 '&lt;s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ' +
+                   'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;' +
+                   '&lt;s:Body&gt;' +
+                     '&lt;u:SetMute xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1"&gt;' +
+                       '&lt;InstanceID&gt;0&lt;/InstanceID&gt;' +
+                       '&lt;Channel&gt;Master&lt;/Channel&gt;' +
+                       '&lt;DesiredMute&gt;true&lt;/DesiredMute&gt;' +
+                     '&lt;/u:SetMute&gt;' +
+                   '&lt;/s:Body&gt;' +
+                 '&lt;/s:Envelope&gt;';
+
+    svcXhr.send(svcMsg);
+    debug.innerHTML += "&lt;br&gt;" + services[0].name + " request sent: ";
+    debug.textContent += svcMsg;
+  }
+
+  function errorCallback( error ) {
+    debug.innerHTML += "&lt;br&gt;An error occurred: " + error.code;
+  }
+&lt;/script&gt;</pre>
+          </div>
+
+       </section>
+
+    <section>
+      <h3>Acknowledgements</h3>
+
+      <p>Thanks are expressed by the editor to the following individuals for their feedback on this specification to date (in alphabetical order):
+      <br /><br />
+      Gar Bergstedt, Lars-Erik Bolstad, Cathy Chan, Hari G Kumar, Bob Lund, Giuseppe Pascale, Marcin Simonides, Clarke Stevens, Christian S&ouml;derstr&ouml;m, Mark Vickers, ...</p>
+
+      <p>Thanks are also expressed by the editor to the following organizations and groups for their support in producing this specification to date (in alphabetical order):
+      <br /></br />
+      CableLabs, Opera Software ASA, W3C Device APIs Working Group, W3C Web and TV Interest Group, ...</p>
+    </section>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gallery/FPWD.html	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,971 @@
+<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
+<html lang="en" dir="ltr">
+<head>
+    <title>Pick Media Intent</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    
+    
+  <style type="text/css">/*****************************************************************
+ * ReSpec 3 CSS
+ * Robin Berjon - http://berjon.com/
+ *****************************************************************/
+
+/* --- INLINES --- */
+em.rfc2119 { 
+    text-transform:     lowercase;
+    font-variant:       small-caps;
+    font-style:         normal;
+    color:              #900;
+}
+
+h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
+h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
+    border: none;
+}
+
+dfn {
+    font-weight:    bold;
+}
+
+a.internalDFN {
+    color:  inherit;
+    border-bottom:  1px solid #99c;
+    text-decoration:    none;
+}
+
+a.externalDFN {
+    color:  inherit;
+    border-bottom:  1px dotted #ccc;
+    text-decoration:    none;
+}
+
+a.bibref {
+    text-decoration:    none;
+}
+
+cite .bibref {
+    font-style: normal;
+}
+
+code {
+    color:  #ff4500;
+}
+
+
+/* --- --- */
+ol.algorithm { counter-reset:numsection; list-style-type: none; }
+ol.algorithm li { margin: 0.5em 0; }
+ol.algorithm li:before { font-weight: bold; counter-increment: numsection; content: counters(numsection, ".") ") "; }
+
+/* --- TOC --- */
+.toc a, .tof a {
+    text-decoration:    none;
+}
+
+a .secno, a .figno {
+    color:  #000;
+}
+
+ul.tof, ol.tof {
+    list-style: none outside none;
+}
+
+.caption {
+    margin-top: 0.5em;
+    font-style:   italic;
+}
+
+/* --- TABLE --- */
+table.simple {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    border-bottom:  3px solid #005a9c;
+}
+
+.simple th {
+    background: #005a9c;
+    color:  #fff;
+    padding:    3px 5px;
+    text-align: left;
+}
+
+.simple th[scope="row"] {
+    background: inherit;
+    color:  inherit;
+    border-top: 1px solid #ddd;
+}
+
+.simple td {
+    padding:    3px 10px;
+    border-top: 1px solid #ddd;
+}
+
+.simple tr:nth-child(even) {
+    background: #f0f6ff;
+}
+
+/* --- DL --- */
+.section dd > p:first-child {
+    margin-top: 0;
+}
+
+.section dd > p:last-child {
+    margin-bottom: 0;
+}
+
+.section dd {
+    margin-bottom:  1em;
+}
+
+.section dl.attrs dd, .section dl.eldef dd {
+    margin-bottom:  0;
+}
+</style><style type="text/css">/* --- EXAMPLES --- */
+div.example-title {
+    min-width: 7.5em;
+    color: #b9ab2d;
+}
+div.example-title span {
+    text-transform: uppercase;   
+}
+div.example, div.illegal-example {
+    padding: 0.5em;
+    margin: 1em 0;
+    position: relative;
+    clear: both;
+}
+div.illegal-example { color: red }
+div.illegal-example p { color: black }
+div.example {
+    padding: .5em;
+    border-left-width: .5em;
+    border-left-style: solid;
+    border-color: #e0cb52;
+    background: #fcfaee;    
+}
+</style><style type="text/css">/* --- ISSUES/NOTES --- */
+div.issue-title, div.note-title {
+    padding-right:  1em;
+    min-width: 7.5em;
+    color: #b9ab2d;
+}
+div.issue-title { color: #e05252; }
+div.note-title { color: #52e052; }
+div.issue-title span, div.note-title span {
+    text-transform: uppercase;
+}
+div.note, div.issue {
+    margin-top: 1em;
+    margin-bottom: 1em;
+}
+.note > p:first-child, .issue > p:first-child { margin-top: 0 }
+.issue, .note {
+    padding: .5em;
+    border-left-width: .5em;
+    border-left-style: solid;
+}
+div.issue, div.note {
+    padding: 0.5em;
+    margin: 1em 0;
+    position: relative;
+    clear: both;
+}
+span.note, span.issue { padding: .1em .5em .15em; }
+
+.issue {
+    border-color: #e05252;
+    background: #fbe9e9;
+}
+.note {
+    border-color: #52e052;
+    background: #e9fbe9;
+}
+
+
+</style><style type="text/css">/* HIGHLIGHTS */
+code.prettyprint {
+    color:  inherit;
+}
+
+/* this from google-code-prettify */
+.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
+</style><style type="text/css">/* --- WEB IDL --- */
+pre.idl {
+    border-top: 1px solid #90b8de;
+    border-bottom: 1px solid #90b8de;
+    padding:    1em;
+    line-height:    120%;
+}
+
+pre.idl::before {
+    content:    "WebIDL";
+    display:    block;
+    width:      150px;
+    background: #90b8de;
+    color:  #fff;
+    font-family:    initial;
+    padding:    3px;
+    font-weight:    bold;
+    margin: -1em 0 1em -1em;
+}
+
+.idlType {
+    color:  #ff4500;
+    font-weight:    bold;
+    text-decoration:    none;
+}
+
+/*.idlModule*/
+/*.idlModuleID*/
+/*.idlInterface*/
+.idlInterfaceID, .idlDictionaryID, .idlCallbackID, .idlEnumID {
+    font-weight:    bold;
+    color:  #005a9c;
+}
+
+.idlSuperclass {
+    font-style: italic;
+    color:  #005a9c;
+}
+
+/*.idlAttribute*/
+.idlAttrType, .idlFieldType, .idlMemberType {
+    color:  #005a9c;
+}
+.idlAttrName, .idlFieldName, .idlMemberName {
+    color:  #ff4500;
+}
+.idlAttrName a, .idlFieldName a, .idlMemberName a {
+    color:  #ff4500;
+    border-bottom:  1px dotted #ff4500;
+    text-decoration: none;
+}
+
+/*.idlMethod*/
+.idlMethType, .idlCallbackType {
+    color:  #005a9c;
+}
+.idlMethName {
+    color:  #ff4500;
+}
+.idlMethName a {
+    color:  #ff4500;
+    border-bottom:  1px dotted #ff4500;
+    text-decoration: none;
+}
+
+/*.idlParam*/
+.idlParamType {
+    color:  #005a9c;
+}
+.idlParamName {
+    font-style: italic;
+}
+
+.extAttr {
+    color:  #666;
+}
+
+/*.idlConst*/
+.idlConstType {
+    color:  #005a9c;
+}
+.idlConstName {
+    color:  #ff4500;
+}
+.idlConstName a {
+    color:  #ff4500;
+    border-bottom:  1px dotted #ff4500;
+    text-decoration: none;
+}
+
+/*.idlException*/
+.idlExceptionID {
+    font-weight:    bold;
+    color:  #c00;
+}
+
+.idlTypedefID, .idlTypedefType {
+    color:  #005a9c;
+}
+
+.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
+    color:  #c00;
+    font-weight:    normal;
+}
+
+.excName a {
+    font-family:    monospace;
+}
+
+.idlRaises a.idlType, .excName a.idlType {
+    border-bottom:  1px dotted #c00;
+}
+
+.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
+    width:  45px;
+    text-align: center;
+}
+.excGetSetTrue, .prmNullTrue, .prmOptTrue { color:  #0c0; }
+.excGetSetFalse, .prmNullFalse, .prmOptFalse { color:  #c00; }
+
+.idlImplements a {
+    font-weight:    bold;
+}
+
+dl.attributes, dl.methods, dl.constants, dl.fields, dl.dictionary-members {
+    margin-left:    2em;
+}
+
+.attributes dt, .methods dt, .constants dt, .fields dt, .dictionary-members dt {
+    font-weight:    normal;
+}
+
+.attributes dt code, .methods dt code, .constants dt code, .fields dt code, .dictionary-members dt code {
+    font-weight:    bold;
+    color:  #000;
+    font-family:    monospace;
+}
+
+.attributes dt code, .fields dt code, .dictionary-members dt code {
+    background:  #ffffd2;
+}
+
+.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code {
+    color:  #005a9c;
+    background:  transparent;
+    font-family:    inherit;
+    font-weight:    normal;
+    font-style: italic;
+}
+
+.methods dt code {
+    background:  #d9e6f8;
+}
+
+.constants dt code {
+    background:  #ddffd2;
+}
+
+.attributes dd, .methods dd, .constants dd, .fields dd, .dictionary-members dd {
+    margin-bottom:  1em;
+}
+
+table.parameters, table.exceptions {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    margin: 0.5em 0;
+    width:  100%;
+}
+table.parameters { border-bottom:  1px solid #90b8de; }
+table.exceptions { border-bottom:  1px solid #deb890; }
+
+.parameters th, .exceptions th {
+    color:  #fff;
+    padding:    3px 5px;
+    text-align: left;
+    font-family:    initial;
+    font-weight:    normal;
+    text-shadow:    #666 1px 1px 0;
+}
+.parameters th { background: #90b8de; }
+.exceptions th { background: #deb890; }
+
+.parameters td, .exceptions td {
+    padding:    3px 10px;
+    border-top: 1px solid #ddd;
+    vertical-align: top;
+}
+
+.parameters tr:first-child td, .exceptions tr:first-child td {
+    border-top: none;
+}
+
+.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
+    width:  100px;
+}
+
+.parameters td.prmType {
+    width:  120px;
+}
+
+table.exceptions table {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    width:  100%;
+}
+</style><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet"></head>
+  <body><div class="head">
+  <p>
+    
+      <a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72"></a>
+    
+  </p>
+  <h1 class="title" id="title">Pick Media Intent</h1>
+  
+  <h2 id="w3c-working-draft-12-july-2012"><abbr title="World Wide Web Consortium">W3C</abbr> Working Draft 12 July 2012</h2>
+  <dl>
+    
+      <dt>This version:</dt>
+      <dd><a href="http://www.w3.org/TR/2012/WD-gallery-20120712/">http://www.w3.org/TR/2012/WD-gallery-20120712/</a></dd>
+      <dt>Latest published version:</dt>
+      <dd><a href="http://www.w3.org/TR/gallery/">http://www.w3.org/TR/gallery/</a></dd>
+    
+    
+      <dt>Latest editor's draft:</dt>
+      <dd><a href="http://w3c-test.org/dap/gallery/">http://w3c-test.org/dap/gallery/</a></dd>
+    
+    
+    
+    
+    
+    
+    <dt>Editors:</dt>
+    <dd><span>송정기(Jungkee Song)</span>, <a href="http://www.samsung.com/sec/">Samsung Electronics Co., Ltd.</a></dd>
+<dd><a href="http://wonsuk73.com/">이원석(Wonsuk Lee)</a>, <a href="http://www.samsung.com/sec/">Samsung Electronics Co., Ltd.</a></dd>
+
+    
+  </dl>
+  
+  
+  
+  
+    
+      <p class="copyright">
+        <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 
+        2012
+        
+        <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> 
+        (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
+        <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
+        <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
+        <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+        <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
+        <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+      </p>
+    
+  
+  <hr>
+</div>
+    <div class="introductory section" id="abstract"><h2>Abstract</h2>
+      <p>
+        The Pick Media Intent defines a Web Intent [<cite><a href="#bib-WEBINTENTS" class="bibref">WEBINTENTS</a></cite>] that enables
+         access to a user's media gallery from inside a Web application. It 
+         defines both an Intent action/type pair that selects this operation, 
+         and the format of the media data that is returned by services implementing this specification.
+      </p>
+    </div><div id="sotd" class="introductory section"><h2>Status of This Document</h2>
+  
+    
+      
+        <p>
+          <em>This section describes the status of this document at the time of its publication. Other
+          documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision
+          of this technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports
+          index</a> at http://www.w3.org/TR/.</em>
+        </p>
+        
+      <p>
+        This document recasts the previous pure JavaScript APIs version as an API built using Web Intents, while refining the metadata format based on related media data definitions and practical web-based media services.
+      </p>
+    
+        <p>
+          This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs Working Group</a> as a First Public Working Draft.
+          
+            This document is intended to become a <abbr title="World Wide Web Consortium">W3C</abbr> Recommendation.
+          
+          If you wish to make comments regarding this document, please send them to 
+          <a href="mailto:public-device-apis@w3.org">public-device-apis@w3.org</a> 
+          (<a href="mailto:public-device-apis-request@w3.org?subject=subscribe">subscribe</a>,
+          <a href="http://lists.w3.org/Archives/Public/public-device-apis/">archives</a>).
+          
+          
+          All feedback is welcome.
+        </p>
+        
+          <p>
+            Publication as a Working Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr> Membership.
+            This is a draft document and may be updated, replaced or obsoleted by other documents at 
+            any time. It is inappropriate to cite this document as other than work in progress.
+          </p>
+        
+        
+        <p>
+          
+            This document was produced by a group operating under the 
+            <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
+          
+          
+          
+            
+              <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/43696/status" rel="disclosure">public list of any patent disclosures</a> 
+            
+            made in connection with the deliverables of the group; that page also includes instructions for 
+            disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains
+            <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the
+            information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
+            6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
+          
+          
+        </p>
+        
+      
+    
+  
+</div><div class="section" id="toc"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a class="tocxref" href="#introduction"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a class="tocxref" href="#conformance"><span class="secno">2. </span>Conformance</a></li><li class="tocline"><a class="tocxref" href="#security-and-privacy-considerations"><span class="secno">3. </span>Security and Privacy Considerations</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#privacy-considerations-for-implementers-of-the-pick-media-intent"><span class="secno">3.1 </span>Privacy considerations for implementers of the Pick Media Intent</a></li><li class="tocline"><a class="tocxref" href="#privacy-considerations-for-recipients-of-media-objects"><span class="secno">3.2 </span>Privacy considerations for recipients of media objects</a></li><li class="tocline"><a class="tocxref" href="#additional-implementation-considerations"><span class="secno">3.3 </span>Additional implementation considerations</a></li></ul></li><li class="tocline"><a class="tocxref" href="#intent-description"><span class="secno">4. </span>Intent Description</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#intent-extras"><span class="secno">4.1 </span>Intent Extras</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#the-mediaintentextras-dictionary"><span class="secno">4.1.1 </span>The <span class="formerLink"><code>MediaIntentExtras</code></span> dictionary</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#dictionary-mediaintentextras-members"><span class="secno">4.1.1.1 </span>Dictionary <span class="formerLink"><code>MediaIntentExtras</code></span> Members</a></li></ul></li></ul></li></ul></li><li class="tocline"><a class="tocxref" href="#data-format"><span class="secno">5. </span>Data Format</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#the-media-dictionary"><span class="secno">5.1 </span>The <span class="formerLink"><code>Media</code></span> dictionary</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#dictionary-media-members"><span class="secno">5.1.1 </span>Dictionary <span class="formerLink"><code>Media</code></span> Members</a></li></ul></li><li class="tocline"><a class="tocxref" href="#the-mediacontent-dictionary"><span class="secno">5.2 </span>The <span class="formerLink"><code>MediaContent</code></span> dictionary</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#dictionary-mediacontent-members"><span class="secno">5.2.1 </span>Dictionary <span class="formerLink"><code>MediaContent</code></span> Members</a></li></ul></li><li class="tocline"><a class="tocxref" href="#the-mediaerror-dictionary"><span class="secno">5.3 </span>The <span class="formerLink"><code>MediaError</code></span> dictionary</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#dictionary-mediaerror-members"><span class="secno">5.3.1 </span>Dictionary <span class="formerLink"><code>MediaError</code></span> Members</a></li></ul></li><li class="tocline"><a class="tocxref" href="#extended-media-properties-and-parameters"><span class="secno">5.4 </span>Extended Media Properties and Parameters</a></li></ul></li><li class="tocline"><a class="tocxref" href="#media-service-example"><span class="secno">A. </span>Media Service Example</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#accessing-mediaintentextras-values---example-1"><span class="secno">A.1 </span>Accessing <span class="formerLink"><code>MediaIntentExtras</code></span> Values  - Example #1</a></li><li class="tocline"><a class="tocxref" href="#creating-media-object---example-2"><span class="secno">A.2 </span>Creating Media Object - Example #2</a></li></ul></li><li class="tocline"><a class="tocxref" href="#references"><span class="secno">B. </span>References</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#normative-references"><span class="secno">B.1 </span>Normative references</a></li><li class="tocline"><a class="tocxref" href="#informative-references"><span class="secno">B.2 </span>Informative references</a></li></ul></li></ul></div>
+
+    
+
+    <div id="introduction" class="informative section">
+      <!--OddPage--><h2><span class="secno">1. </span>Introduction</h2><p><em>This section is non-normative.</em></p>
+      <p>
+        On account of a number of media applications and services accessed from various devices, users tend to maintain their media data in multiple sources including local storage of devices and web-based media galleries. For instance, users upload subset of their photos to several different social media galleries with different metadata. For another example, users collect their favourite audio and video resources in several different media galleries which provide inconsistent metadata attributes one another.
+      </p>
+      <div class="note"><div class="note-title"><span>Note</span></div><p class="">
+              A terminology, <b>media object</b>, is used hereunder to denote <b>media data</b> that contain a media content and its related metadata. (See <a class="idlType" href="#idl-def-Media"><code>Media</code></a> dictionary)
+      </p></div>
+      <p>
+        This specification enables a Web application to have access to a selected subset of user's media objects, obtained from arbitrary services not known to the Web application. The interactions, brokered using Web Intents [<cite><a href="#bib-WEBINTENTS" class="bibref">WEBINTENTS</a></cite>] are designed in order to maximise the user's security and privacy. Media objects may be sourced from a plurality of sources — both online and local to the user's device — so long as those sources are registered as Intent services with the user agent. It defines a common media object format which services use to provide data to Web applications in a consistent and interoperable manner.
+      </p>
+      <p>
+        For a Pick Media Intent request, user permission can be naturally asked by a necessary user authentication process that a service implementer <em title="may" class="rfc2119">may</em> provide. Also, users can determine the result media objects to bring to the client with the searching and selecting functionalities that a service implementer <em title="may" class="rfc2119">may</em> provide.
+      </p>
+      <p>
+        A set of <a href="#security-and-privacy-considerations">Security and Privacy Considerations</a> are
+        presented for the discretion of both implementers of Pick Media Intent services and recipients of media
+        data (i.e. Web applications).
+      </p>
+      <p>
+        The following code illustrates how to obtain media object from a user's media gallery:
+      </p>
+      <div class="example"><div class="example-title"><span>Example 1</span></div><pre class="example highlight prettyprint"><span class="kwd">var</span><span class="pln"> intent </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Intent</span><span class="pun">({</span><span class="pln"> action</span><span class="pun">:</span><span class="pln">   </span><span class="str">"http://webintents.org/pick"</span><span class="pun">,</span><span class="pln">
+                          type</span><span class="pun">:</span><span class="pln">     </span><span class="str">"http://w3.org/type/media"</span><span class="pun">,</span><span class="pln">
+                          extras</span><span class="pun">:</span><span class="pln">   </span><span class="pun">{</span><span class="pln"> search</span><span class="pun">:</span><span class="pln"> </span><span class="str">"olympic"</span><span class="pun">,</span><span class="pln">
+                                      filters</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="str">"title"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"description"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"author"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"tags"</span><span class="pun">],</span><span class="pln">
+                                      limit</span><span class="pun">:</span><span class="pln"> </span><span class="lit">100</span><span class="pln"> </span><span class="pun">}});</span><span class="pln">
+navigator</span><span class="pun">.</span><span class="pln">startActivity</span><span class="pun">(</span><span class="pln">intent</span><span class="pun">,</span><span class="pln"> mediaOK</span><span class="pun">,</span><span class="pln"> mediaFail</span><span class="pun">);</span><span class="pln">
+
+</span><span class="kwd">function</span><span class="pln"> mediaOK </span><span class="pun">(</span><span class="pln">mediaObjectArray</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+    </span><span class="com">// iterate over the array of media objects to do something useful with them</span><span class="pln">
+</span><span class="pun">}</span><span class="pln">
+</span><span class="kwd">function</span><span class="pln"> mediaFail </span><span class="pun">(</span><span class="pln">err</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+    </span><span class="com">// display an error to the user</span><span class="pln">
+</span><span class="pun">}</span></pre></div>
+      <p>
+        When the above code is run, the user would typically be prompted by her user agent to select
+        a service able to pick media objects (there may be several such services, if she has multiple media galleries). Upon selecting a service, she will be presented with an interface enabling her
+        to choose what media objects are returned to the Web application. Upon completing her
+        choice, an array of the media objects would be returned to the Web application in the <code>mediaOK</code>
+        callback.
+      </p>
+    </div>
+
+    <div class="section" id="conformance"><!--OddPage--><h2><span class="secno">2. </span>Conformance</h2>
+<p>
+  As well as sections marked as non-normative, all authoring guidelines, diagrams, examples,
+  and notes in this specification are non-normative. Everything else in this specification is
+  normative.
+</p>
+<p>
+  The key words <em title="must" class="rfc2119">must</em>, <em title="must not" class="rfc2119">must not</em>, <em title="required" class="rfc2119">required</em>, <em title="should" class="rfc2119">should</em>, <em title="should not" class="rfc2119">should not</em>, <em title="recommended" class="rfc2119">recommended</em>, <em title="may" class="rfc2119">may</em>,
+  and <em title="optional" class="rfc2119">optional</em> in this specification are to be interpreted as described in [<cite><a href="#bib-RFC2119" class="bibref">RFC2119</a></cite>].
+</p>
+
+      <p>
+        There is only one single conformance requirement placed upon the <dfn id="dfn-user-agent">user agent</dfn>
+        product: a <a class="internalDFN" href="#dfn-user-agent">user agent</a> <em title="must" class="rfc2119">must</em> support Web Intents [<cite><a href="#bib-WEBINTENTS" class="bibref">WEBINTENTS</a></cite>].
+      </p>
+      <p>
+        The conformance criteria in this specification apply to a single product: the
+        <dfn id="dfn-media-service">Media service</dfn> which exposes a Web Intent service that
+        handles Pick Media Intents as defined in this specification.
+      </p>
+      <p>
+        The data returned by the <a class="internalDFN" href="#dfn-media-service">Media service</a> is described in this specification using [<cite><a href="#bib-WEBIDL" class="bibref">WEBIDL</a></cite>].
+        When this data is provided using JavaScript, then the <a class="internalDFN" href="#dfn-media-service">Media service</a> <em title="must" class="rfc2119">must</em> do so in a manner
+        consistent with the ECMAScript Bindings defined in the Web IDL specification.
+      </p>
+    </div>
+
+    <div id="security-and-privacy-considerations" class="informative section">
+      <!--OddPage--><h2><span class="secno">3. </span>Security and Privacy Considerations</h2><p><em>This section is non-normative.</em></p>
+      <p>
+        The Intent defined in this specification can be used to find media objects from user's media galleries. The media objects, in the form of photos, videos, voice recordings with related metadata, may contain user's private information. The distribution of this information could
+        potentially compromise the user's privacy. A conforming implementation
+        of this specification should provide a mechanism that protects the user's privacy and this mechanism should ensure that no such information is retrievable without the user's express permission.
+      </p>
+      <div class="section" id="privacy-considerations-for-implementers-of-the-pick-media-intent">
+        <h3><span class="secno">3.1 </span>Privacy considerations for implementers of the Pick Media Intent</h3><p><em>This section is non-normative.</em></p>
+        <p>
+          A <a>media service</a> should not provide media objects to Web sites without the express
+          permission of the user. Obtaining the user's express permission to access a set of media objects does 
+          not imply that the user has granted permission for the same Web site to access more media objects.
+          A <a>media service</a> should take great care to ensure that the user can clearly see which information
+          is about to be shared, and must not share more information than has been requested by the Web application.
+        </p>
+        <p>
+          A <a class="internalDFN" href="#dfn-user-agent">user agent</a> may have prearranged trust relationships with a specific <a>media service</a> 
+          that do not require such user interaction.
+        </p>
+      </div>
+      <div class="section" id="privacy-considerations-for-recipients-of-media-objects">
+        <h3><span class="secno">3.2 </span>Privacy considerations for recipients of media objects</h3>
+        <p>
+          Web sites operators that retrieve media objects using this Intent are denoted as recipients
+          below.
+        </p>
+        <p>
+          Recipients should only request media objects when necessary, and only use the media objects for the task for which it was provided to them.
+        </p>
+        <p>
+          Recipients should dispose of media objects once that task is completed, unless expressly
+          permitted to retain it by the user. Recipients should also take measures to protect this information
+          against unauthorised access. If media objects are stored, users should be allowed to update and
+          delete this information.
+        </p>
+        <p>
+          The recipient of media objects should not retransmit the media objects without the
+          user's express permission. Care should be taken when retransmitting and use of encryption is
+          encouraged.
+        </p>
+        <p>
+          Recipients should clearly and conspicuously disclose the fact that they are collecting media objects,
+          the purpose of the collection, how long the data is retained, how the data is secured, how the data is
+          shared if it is shared, how users can access, update and delete the data, and any other choices that
+          users have with respect to the data. This disclosure should include an explanation of any exceptions to
+          the guidelines listed above.
+        </p>
+        <p>
+          Note that even if a user gives permission to share their media objects this can have serious
+          privacy implications for those parties whose media objects are shared, as they may not wish such sharing to
+          occur. This should be considered by Web applications when requesting and using such information.
+        </p>
+      </div>
+      <div class="section" id="additional-implementation-considerations">
+        <h3><span class="secno">3.3 </span>Additional implementation considerations</h3>
+        <p>
+          Further to the requirements listed in the previous section, implementers of a <a>user agents</a> are
+          also advised to consider the following aspects that can negatively affect the privacy of their users:
+          in certain cases, users can inadvertently grant permission to disclose their media objects
+          to Web sites. In other cases, the content hosted at a certain URL changes in such a way that the
+          previously granted permissions no longer apply as far as the user is concerned. Or the users
+          might simply change their minds.
+        </p>
+        <p>
+          Predicting or preventing these situations is inherently difficult. Mitigation and in-depth defensive
+          measures are a <a class="internalDFN" href="#dfn-user-agent">user agent</a>'s responsibility and not prescribed by this specification. However, in
+          designing these measures, implementers are advised to enable user awareness of information sharing, and to
+          provide easy access to user interfaces that enable revocation of permissions that Web applications have to
+          access this Intent.
+        </p>
+      </div>
+    </div>
+
+    <div class="section" id="intent-description">
+      <!--OddPage--><h2><span class="secno">4. </span>Intent Description</h2>
+      <p>
+        The action for this Intent is <code>http://webintents.org/pick</code>.
+      </p>
+      <p>
+        The type for this Intent is <code>http://w3.org/type/media</code>.
+      </p>
+      <p>
+        When a <a>media service</a> is matched for delivery using these action and type, it
+        <em title="must" class="rfc2119">must</em> respond in one of two ways:
+      </p>
+      <ul>
+        <li>
+          If media objects have been successfully selected for delivery, then a successful payload is returned
+          to the client (using <code>postResult()</code>) matching the data format defined below.
+        </li>
+        <li>
+          If an error of any kind takes place in the service, then an error payload is returned (using
+          <code>postFailure()</code>) matching the error data format defined below. The <a>media service</a>
+          <em title="must not" class="rfc2119">must not</em> treat the user selecting zero media object or cancelling the service as error conditions.
+        </li>
+      </ul>
+      <div class="section" id="intent-extras">
+        <h3><span class="secno">4.1 </span>Intent Extras</h3>
+        <p>
+          The Pick Media Intent can be instantiated with an <code>extras</code> field that adheres to the 
+          following dictionary.
+        </p>
+        <div class="section" id="the-mediaintentextras-dictionary">
+          <h4><span class="secno">4.1.1 </span>The <a class="idlType" href="#idl-def-MediaIntentExtras"><code>MediaIntentExtras</code></a> dictionary</h4>
+          <p>
+            The <a class="idlType" href="#idl-def-MediaIntentExtras"><code>MediaIntentExtras</code></a> dictionary describes the options that the invoker can inform to the service as hints in searching the media objects. None of the fields are mandatory.
+          </p>
+          <pre class="idl"><span class="idlDictionary" id="idl-def-MediaIntentExtras">dictionary <span class="idlDictionaryID">MediaIntentExtras</span> {
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a>?</span>     <span class="idlMemberName"><a href="#widl-MediaIntentExtras-search">search</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a>[]?</span>   <span class="idlMemberName"><a href="#widl-MediaIntentExtras-filters">filters</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>unsigned long</a>?</span> <span class="idlMemberName"><a href="#widl-MediaIntentExtras-limit">limit</a></span>;</span>
+};</span></pre><div class="section" id="dictionary-mediaintentextras-members"><h5><span class="secno">4.1.1.1 </span>Dictionary <a href="#idl-def-MediaIntentExtras" class="idlType"><code>MediaIntentExtras</code></a> Members</h5><dl class="dictionary-members"><dt id="widl-MediaIntentExtras-filters"><code>filters</code> of type array of <span class="idlMemberType"><a>DOMString</a></span>, nullable</dt><dd>
+              An array of string which contain hints to the <a>media service</a> to the DOMString and DOMString[] fields in the <a class="idlType" href="#idl-def-Media"><code>Media</code></a> dictionary that
+              the Web application prefers to use as search criteria. The <a>media service</a> <em title="may" class="rfc2119">may</em>
+              use the values of the <a>filters</a> to search media objects in the media gallery. If a filter name is provided that the <a>media service</a> does not recognise as a field
+              of the <a class="idlType" href="#idl-def-Media"><code>Media</code></a> dictionary, then it <em title="must" class="rfc2119">must</em> ignore it.
+            </dd><dt id="widl-MediaIntentExtras-limit"><code>limit</code> of type <span class="idlMemberType"><a>unsigned long</a></span>, nullable</dt><dd>
+              By default a <a>media service</a> <em title="may" class="rfc2119">may</em> return as many media objects as the user selects. If <code>limit</code>
+              is specified, the <a>media service</a> <em title="must not" class="rfc2119">must not</em> return more than <code>limit</code> media objects. The
+              <a>media service</a> <em title="should" class="rfc2119">should</em> enforce this limitation in the user interface that it exposes.
+            </dd><dt id="widl-MediaIntentExtras-search"><code>search</code> of type <span class="idlMemberType"><a>DOMString</a></span>, nullable</dt><dd>
+              A string which provides a hint to the <a>media service</a> to search media objects.
+              The exact manner in which this hint is exploited is entirely up to the <a>media service</a>.
+            </dd></dl></div>
+        </div>
+      </div>
+    </div>
+    <div class="section" id="data-format">
+      <!--OddPage--><h2><span class="secno">5. </span>Data Format</h2>
+      <p>
+        Upon successful invocation, the <a>media service</a> <em title="must" class="rfc2119">must</em> return an array of <a class="idlType" href="#idl-def-Media"><code>Media</code></a> dictionaries.
+      </p>
+      <div class="section" id="the-media-dictionary">
+        <h3><span class="secno">5.1 </span>The <a class="idlType" href="#idl-def-Media"><code>Media</code></a> dictionary</h3>
+        <p>
+          The <a class="idlType" href="#idl-def-Media"><code>Media</code></a> dictionary captures the properties of a media object. The properties defined in this dictionary present the content (URI by default and Blob as option) of the media data and the related metadata. The properties of the dictionary are defined based on the previous work of metadata survey in Media Ontology WG, the <a href="http://www.w3.org/TR/2012/REC-mediaont-10-20120209/#core-property-lists">core set</a>, [<cite><a href="#bib-MEDIA-ANNOT-REQS" class="bibref">MEDIA-ANNOT-REQS</a></cite>] as well as the common attributes of open APIs provided by typical web-based media services, thereby allowing the data format to be supported across implementations supporting these various media metadata representations.
+        </p>
+        <p>
+          Additional attributes <em title="may" class="rfc2119">may</em> be included according to the provisions detailed in 
+          <a href="#extended-media-properties-and-parameters">Extended Media Properties and Parameters</a>.
+        </p>
+        <pre class="idl"><span class="idlDictionary" id="idl-def-Media">dictionary <span class="idlDictionaryID">Media</span> {
+<span class="idlMember">    <span class="idlMemberType"><a class="idlType" href="#idl-def-MediaContent"><code>MediaContent</code></a></span>   <span class="idlMemberName"><a href="#widl-Media-content">content</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a></span>      <span class="idlMemberName"><a href="#widl-Media-description">description</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a>?</span>     <span class="idlMemberName"><a href="#widl-Media-id">id</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a></span>      <span class="idlMemberName"><a href="#widl-Media-title">title</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a></span>      <span class="idlMemberName"><a href="#widl-Media-type">type</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a>?</span>     <span class="idlMemberName"><a href="#widl-Media-author">author</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a>?</span>     <span class="idlMemberName"><a href="#widl-Media-category">category</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a>?</span>     <span class="idlMemberName"><a href="#widl-Media-copyright">copyright</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a>?</span>     <span class="idlMemberName"><a href="#widl-Media-fileName">fileName</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>unsigned long</a>?</span> <span class="idlMemberName"><a href="#widl-Media-fileSize">fileSize</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>Position</a>?</span>      <span class="idlMemberName"><a href="#widl-Media-location">location</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a>[]?</span>   <span class="idlMemberName"><a href="#widl-Media-tags">tags</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a class="idlType" href="#idl-def-MediaContent"><code>MediaContent</code></a>?</span>  <span class="idlMemberName"><a href="#widl-Media-thumbnail">thumbnail</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>Date</a>?</span>          <span class="idlMemberName"><a href="#widl-Media-createdDate">createdDate</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>Date</a>?</span>          <span class="idlMemberName"><a href="#widl-Media-updatedDate">updatedDate</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a>?</span>     <span class="idlMemberName"><a href="#widl-Media-collection">collection</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>unsigned long</a>?</span> <span class="idlMemberName"><a href="#widl-Media-duration">duration</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>unsigned long</a>?</span> <span class="idlMemberName"><a href="#widl-Media-frameRate">frameRate</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a>?</span>     <span class="idlMemberName"><a href="#widl-Media-language">language</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>unsigned long</a>?</span> <span class="idlMemberName"><a href="#widl-Media-likeCount">likeCount</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>float</a>?</span>         <span class="idlMemberName"><a href="#widl-Media-rating">rating</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>unsigned long</a>?</span> <span class="idlMemberName"><a href="#widl-Media-ratingCount">ratingCount</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a>?</span>     <span class="idlMemberName"><a href="#widl-Media-resolution">resolution</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>unsigned long</a>?</span> <span class="idlMemberName"><a href="#widl-Media-samplingRate">samplingRate</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>Date</a>?</span>          <span class="idlMemberName"><a href="#widl-Media-publishedDate">publishedDate</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a>?</span>     <span class="idlMemberName"><a href="#widl-Media-publisher">publisher</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>unsigned long</a>?</span> <span class="idlMemberName"><a href="#widl-Media-viewCount">viewCount</a></span>;</span>
+};</span></pre><div class="section" id="dictionary-media-members"><h4><span class="secno">5.1.1 </span>Dictionary <a href="#idl-def-Media" class="idlType"><code>Media</code></a> Members</h4><dl class="dictionary-members"><dt id="widl-Media-author"><code>author</code> of type <span class="idlMemberType"><a>DOMString</a></span>, nullable</dt><dd>
+            The author of the media resource in string.
+          </dd><dt id="widl-Media-category"><code>category</code> of type <span class="idlMemberType"><a>DOMString</a></span>, nullable</dt><dd>
+            The category (genre) of the content of the media resource.
+          </dd><dt id="widl-Media-collection"><code>collection</code> of type <span class="idlMemberType"><a>DOMString</a></span>, nullable</dt><dd>
+            <p>
+              The name of the collection or album that the media resource belongs to.
+            </p>
+          </dd><dt id="widl-Media-content"><code>content</code> of type <span class="idlMemberType"><a class="idlType" href="#idl-def-MediaContent"><code>MediaContent</code></a></span></dt><dd>
+            A dictionary containing a URI to the content of the media resource. It optionally contains a Blob of the content.
+          </dd><dt id="widl-Media-copyright"><code>copyright</code> of type <span class="idlMemberType"><a>DOMString</a></span>, nullable</dt><dd>
+            The copyright statement associated with the media resource.
+          </dd><dt id="widl-Media-createdDate"><code>createdDate</code> of type <span class="idlMemberType"><a>Date</a></span>, nullable</dt><dd>
+            <p>
+              The creation date of the media resource in Date type.
+            </p>
+          </dd><dt id="widl-Media-description"><code>description</code> of type <span class="idlMemberType"><a>DOMString</a></span></dt><dd>
+            The text description of the content of the media resource.
+          </dd><dt id="widl-Media-duration"><code>duration</code> of type <span class="idlMemberType"><a>unsigned long</a></span>, nullable</dt><dd>
+            <p>
+              The actual duration of the resource. The units are defined to be seconds.
+            </p>
+          </dd><dt id="widl-Media-fileName"><code>fileName</code> of type <span class="idlMemberType"><a>DOMString</a></span>, nullable</dt><dd>
+            This field's value is not a url, but is the filename (probably not fully qualified, but simply the name of the leaf file) of the resource being passed as assigned by the user. (See <a href="http://www.w3.org/wiki/WebIntents/MIME_Types">WebIntents/MIME Types</a>)
+          </dd><dt id="widl-Media-fileSize"><code>fileSize</code> of type <span class="idlMemberType"><a>unsigned long</a></span>, nullable</dt><dd>
+            The size of the content of the media resource.
+          </dd><dt id="widl-Media-frameRate"><code>frameRate</code> of type <span class="idlMemberType"><a>unsigned long</a></span>, nullable</dt><dd>
+            <p>
+              The video frame rate. The units are defined to be frames per second.
+            </p>
+          </dd><dt id="widl-Media-id"><code>id</code> of type <span class="idlMemberType"><a>DOMString</a></span>, nullable</dt><dd>
+            <p>
+            A URI identifying a media resource.
+            </p>
+            <div class="note"><div class="note-title"><span>Note</span></div><p class="">
+              The property, identifier, defined in the core set of [<a href="http://www.w3.org/TR/2012/REC-mediaont-10-20120209/#core-property-lists">Ontology for Media Resources 1.0</a>] can be considered as a representation format.
+            </p></div>
+          </dd><dt id="widl-Media-language"><code>language</code> of type <span class="idlMemberType"><a>DOMString</a></span>, nullable</dt><dd>
+            <p>
+              The language used in the media resource.
+            </p>
+          </dd><dt id="widl-Media-likeCount"><code>likeCount</code> of type <span class="idlMemberType"><a>unsigned long</a></span>, nullable</dt><dd>
+            <p>
+              The count of the vote in favour of the media resource.
+            </p>
+          </dd><dt id="widl-Media-location"><code>location</code> of type <span class="idlMemberType"><a>Position</a></span>, nullable</dt><dd>
+            The location information related to the content of the media resource. [<cite><a href="#bib-GEOLOCATION-API" class="bibref">GEOLOCATION-API</a></cite>] 
+          </dd><dt id="widl-Media-publishedDate"><code>publishedDate</code> of type <span class="idlMemberType"><a>Date</a></span>, nullable</dt><dd>
+            <p>
+              The publishing date of the media resource in Date type.
+            </p>
+          </dd><dt id="widl-Media-publisher"><code>publisher</code> of type <span class="idlMemberType"><a>DOMString</a></span>, nullable</dt><dd>
+            <p>
+              The publisher of the media resource.
+            </p>
+          </dd><dt id="widl-Media-rating"><code>rating</code> of type <span class="idlMemberType"><a>float</a></span>, nullable</dt><dd>
+            <p>
+              The rating value (e.g., customer rating, review, audience appreciation) of the media resource.
+            </p>
+          </dd><dt id="widl-Media-ratingCount"><code>ratingCount</code> of type <span class="idlMemberType"><a>unsigned long</a></span>, nullable</dt><dd>
+            <p>
+              The number of ratings made on the media resource.
+            </p>
+          </dd><dt id="widl-Media-resolution"><code>resolution</code> of type <span class="idlMemberType"><a>DOMString</a></span>, nullable</dt><dd>
+            <p>
+              The frame size of the resource (e.g., width and height of 720 and 480 in px is represented as 720*480+px).
+            </p>
+            <div class="note"><div class="note-title"><span>Note</span></div><p class="">
+              If the usage of this property is frequent, a separate dictionary can be defined referring to frameSize property defined in [<a href="http://www.w3.org/TR/2012/REC-mediaont-10-20120209/#core-property-lists">Ontology for Media Resources 1.0</a>]
+            </p></div>
+          </dd><dt id="widl-Media-samplingRate"><code>samplingRate</code> of type <span class="idlMemberType"><a>unsigned long</a></span>, nullable</dt><dd>
+            <p>
+              The audio sampling rate. The units are defined to be samples per second.
+            </p>
+          </dd><dt id="widl-Media-tags"><code>tags</code> of type array of <span class="idlMemberType"><a>DOMString</a></span>, nullable</dt><dd>
+            <p>
+              The array of strings representing series of tag string.
+            </p>
+          </dd><dt id="widl-Media-thumbnail"><code>thumbnail</code> of type <span class="idlMemberType"><a class="idlType" href="#idl-def-MediaContent"><code>MediaContent</code></a></span>, nullable</dt><dd>
+            A dictionary containing a URI to the thumbnail of the content of the media resource. It optionally contains a Blob of the thumbnail of the content.
+          </dd><dt id="widl-Media-title"><code>title</code> of type <span class="idlMemberType"><a>DOMString</a></span></dt><dd>
+            The title or name given to the media resource.
+          </dd><dt id="widl-Media-type"><code>type</code> of type <span class="idlMemberType"><a>DOMString</a></span></dt><dd>
+            The MIME type of the media resource (e.g., image/png, video/*) [<cite><a href="#bib-RFC2046" class="bibref">RFC2046</a></cite>].
+          </dd><dt id="widl-Media-updatedDate"><code>updatedDate</code> of type <span class="idlMemberType"><a>Date</a></span>, nullable</dt><dd>
+            <p>
+              The last updated date of the media resource in Date type.
+            </p>
+          </dd><dt id="widl-Media-viewCount"><code>viewCount</code> of type <span class="idlMemberType"><a>unsigned long</a></span>, nullable</dt><dd>
+            <p>
+              The access count made on the media resource.
+            </p>
+          </dd></dl></div>
+      </div>
+
+      <div class="section" id="the-mediacontent-dictionary">
+        <h3><span class="secno">5.2 </span>The <a class="idlType" href="#idl-def-MediaContent"><code>MediaContent</code></a> dictionary</h3>
+        <p>
+          The <a class="idlType" href="#idl-def-MediaContent"><code>MediaContent</code></a> dictionary describes a media content reference in detail.
+        </p>
+        <pre class="idl"><span class="idlDictionary" id="idl-def-MediaContent">dictionary <span class="idlDictionaryID">MediaContent</span> {
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a></span> <span class="idlMemberName"><a href="#widl-MediaContent-uri">uri</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>Blob</a>?</span>     <span class="idlMemberName"><a href="#widl-MediaContent-blob">blob</a></span>;</span>
+};</span></pre><div class="section" id="dictionary-mediacontent-members"><h4><span class="secno">5.2.1 </span>Dictionary <a href="#idl-def-MediaContent" class="idlType"><code>MediaContent</code></a> Members</h4><dl class="dictionary-members"><dt id="widl-MediaContent-blob"><code>blob</code> of type <span class="idlMemberType"><a>Blob</a></span>, nullable</dt><dd>
+            The optional property to contain the media content in Blob format.
+          </dd><dt id="widl-MediaContent-uri"><code>uri</code> of type <span class="idlMemberType"><a>DOMString</a></span></dt><dd>
+            The URI to the content of the media resource. This attribute is a mandatory property.
+          </dd></dl></div>
+      </div>
+
+      <div class="section" id="the-mediaerror-dictionary">
+        <h3><span class="secno">5.3 </span>The <a class="idlType" href="#idl-def-MediaError"><code>MediaError</code></a> dictionary</h3>
+        <p>
+          If the <a>media service</a> encounters an error then it <em title="must" class="rfc2119">must</em> return an error 
+          (through <code>postFailure()</code>) using the <a class="idlType" href="#idl-def-MediaError"><code>MediaError</code></a> dictionary.
+        </p>
+        <pre class="idl"><span class="idlDictionary" id="idl-def-MediaError">dictionary <span class="idlDictionaryID">MediaError</span> {
+<span class="idlMember">    <span class="idlMemberType"><a>DOMString</a></span> <span class="idlMemberName"><a href="#widl-MediaError-message">message</a></span>;</span>
+};</span></pre><div class="section" id="dictionary-mediaerror-members"><h4><span class="secno">5.3.1 </span>Dictionary <a href="#idl-def-MediaError" class="idlType"><code>MediaError</code></a> Members</h4><dl class="dictionary-members"><dt id="widl-MediaError-message"><code>message</code> of type <span class="idlMemberType"><a>DOMString</a></span></dt><dd>A message describing the error.</dd></dl></div>
+      </div>
+      <div class="section" id="extended-media-properties-and-parameters">
+        <h3><span class="secno">5.4 </span>Extended Media Properties and Parameters</h3>
+        <p>
+          A <a>media service</a> <em title="may" class="rfc2119">may</em> extend the dictionaries described in in the Data Formats section with
+          additional fields. If providing an extended field, a <a>media service</a> <em title="must" class="rfc2119">must</em> prefix its name
+          with <code>X</code> (U+0058 LATIN CAPITAL LETTER X) or use a vendor-specific prefix.
+        </p>
+      </div>
+    </div>
+    <div id="media-service-example" class="informative appendix section">
+      <!--OddPage--><h2><span class="secno">A. </span>Media Service Example</h2><p><em>This section is non-normative.</em></p>
+
+      <p>
+      This section describes an example usage of the Pick Media Intent in media service. It shows the use of the values delivered through <a class="idlType" href="#idl-def-MediaIntentExtras"><code>MediaIntentExtras</code></a> dictionary, and the way to return the result array of media objects through <a class="idlType" href="#idl-def-Media"><code>Media</code></a> dictionary.
+      </p>
+
+      <div class="section" id="accessing-mediaintentextras-values---example-1">
+        <h3><span class="secno">A.1 </span>Accessing <a class="idlType" href="#idl-def-MediaIntentExtras"><code>MediaIntentExtras</code></a> Values  - Example #1</h3><p><em>This section is non-normative.</em></p>
+
+        <p>
+        Media service implementers can retrieve the values delivered in extra field of the intent request. The extra field contains the MediaIntentExtras dictionary:
+        </p>
+        <div class="example">
+          <pre class="highlight prettyprint"><span class="pln">  </span><span class="tag">&lt;script</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"text/javascript"</span><span class="tag">&gt;</span><span class="pln">
+  </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">window</span><span class="pun">.</span><span class="pln">intent</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+      </span><span class="kwd">var</span><span class="pln"> keyword </span><span class="pun">=</span><span class="pln"> window</span><span class="pun">.</span><span class="pln">intent</span><span class="pun">.</span><span class="pln">extra</span><span class="pun">.</span><span class="pln">search</span><span class="pun">;</span><span class="pln">  </span><span class="com">// a string based hint to search</span><span class="pln">
+      </span><span class="kwd">var</span><span class="pln"> filters </span><span class="pun">=</span><span class="pln"> window</span><span class="pun">.</span><span class="pln">intent</span><span class="pun">.</span><span class="pln">extra</span><span class="pun">.</span><span class="pln">filters</span><span class="pun">;</span><span class="pln"> </span><span class="com">// DOMString[] based hint to fields to match</span><span class="pln">
+      </span><span class="kwd">var</span><span class="pln"> limit </span><span class="pun">=</span><span class="pln"> window</span><span class="pun">.</span><span class="pln">intent</span><span class="pun">.</span><span class="pln">extra</span><span class="pun">.</span><span class="pln">limit</span><span class="pun">;</span><span class="pln">     </span><span class="com">// maximum number of objects to return</span><span class="pln">
+
+      </span><span class="com">// do search relevant media objects based on the extras</span><span class="pln">
+      </span><span class="kwd">var</span><span class="pln"> mediaObjectArray </span><span class="pun">=</span><span class="pln"> searchMediaObjects</span><span class="pun">(</span><span class="pln">keyword</span><span class="pun">,</span><span class="pln"> filters</span><span class="pun">,</span><span class="pln"> limit</span><span class="pun">);</span><span class="pln">
+      
+      </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">mediaObjectArray</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+          window</span><span class="pun">.</span><span class="pln">intent</span><span class="pun">.</span><span class="pln">postResult</span><span class="pun">(</span><span class="pln">mediaObjectArray</span><span class="pun">);</span><span class="pln">
+      </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+          window</span><span class="pun">.</span><span class="pln">intent</span><span class="pun">.</span><span class="pln">postFailure</span><span class="pun">(</span><span class="pln">errorMessage</span><span class="pun">);</span><span class="pln">
+      </span><span class="pun">}</span><span class="pln">
+  </span><span class="pun">}</span><span class="pln">  
+  </span><span class="tag">&lt;/script&gt;</span><span class="pln">
+          </span></pre>
+        </div>
+
+        <p>
+        The use of the properties in MediaIntentExtras dictionary is optional. Service implementers can decide whether these properties are to be used as hints for search.
+        </p>
+      </div>
+
+      <div class="section" id="creating-media-object---example-2">
+        <h3><span class="secno">A.2 </span>Creating Media Object - Example #2</h3>
+
+        <p>
+        Media service implementers can create media objects in the format of the Media dictionary and make an array of media objects to send to client. (using <code>postResult()</code>):
+        </p>
+
+        <div class="example">
+          <pre class="highlight prettyprint"><span class="pln">  </span><span class="tag">&lt;script</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"text/javascript"</span><span class="tag">&gt;</span><span class="pln">
+  </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">window</span><span class="pun">.</span><span class="pln">intent</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+      </span><span class="kwd">var</span><span class="pln"> content </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{};</span><span class="pln">
+      content</span><span class="pun">.</span><span class="pln">uri </span><span class="pun">=</span><span class="pln"> </span><span class="str">"http://example.com/gallery/image00001.png"</span><span class="pun">;</span><span class="pln">
+       
+      </span><span class="kwd">var</span><span class="pln"> mediaObject </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Object</span><span class="pun">();</span><span class="pln">
+      mediaObject</span><span class="pun">.</span><span class="pln">content </span><span class="pun">=</span><span class="pln"> content</span><span class="pun">;</span><span class="pln">
+      mediaObject</span><span class="pun">.</span><span class="pln">description </span><span class="pun">=</span><span class="pln"> </span><span class="str">"The city view of Seoul"</span><span class="pun">;</span><span class="pln">
+      mediaObject</span><span class="pun">.</span><span class="pln">id </span><span class="pun">=</span><span class="pln"> </span><span class="str">""</span><span class="pun">;</span><span class="pln"> 
+      mediaObject</span><span class="pun">.</span><span class="pln">title </span><span class="pun">=</span><span class="pln"> </span><span class="str">"City of Seoul"</span><span class="pun">;</span><span class="pln">
+      mediaObject</span><span class="pun">.</span><span class="pln">type </span><span class="pun">=</span><span class="pln"> </span><span class="str">"image/png"</span><span class="pun">;</span><span class="pln">  </span><span class="com">// MIME type of the media content</span><span class="pln">
+      mediaObject</span><span class="pun">.</span><span class="pln">author </span><span class="pun">=</span><span class="pln"> </span><span class="str">"J."</span><span class="pun">;</span><span class="pln">
+
+      </span><span class="kwd">var</span><span class="pln"> mediaObjectArray </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">Array</span><span class="pun">();</span><span class="pln">
+      
+      mediaObjectArray</span><span class="pun">[</span><span class="lit">0</span><span class="pun">]</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> mediaObject</span><span class="pun">;</span><span class="pln">
+      
+      </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">mediaObjectArray</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+          window</span><span class="pun">.</span><span class="pln">intent</span><span class="pun">.</span><span class="pln">postResult</span><span class="pun">(</span><span class="pln">mediaObjectArray</span><span class="pun">);</span><span class="pln">
+      </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
+          window</span><span class="pun">.</span><span class="pln">intent</span><span class="pun">.</span><span class="pln">postFailure</span><span class="pun">(</span><span class="pln">errorMessage</span><span class="pun">);</span><span class="pln">
+      </span><span class="pun">}</span><span class="pln">
+  </span><span class="pun">}</span><span class="pln">  
+  </span><span class="tag">&lt;/script&gt;</span><span class="pln">
+          </span></pre>
+        </div>
+      </div>
+    </div>
+  
+
+<div class="appendix section" id="references"><!--OddPage--><h2><span class="secno">B. </span>References</h2><div class="section" id="normative-references"><h3><span class="secno">B.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-RFC2119">[RFC2119]</dt><dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in RFCs to Indicate Requirement Levels.</cite></a> March 1997. Internet RFC 2119.  URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a> 
+</dd><dt id="bib-WEBIDL">[WEBIDL]</dt><dd>Cameron McCormack. <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/"><cite>Web IDL.</cite></a> 27 September 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/">http://www.w3.org/TR/2011/WD-WebIDL-20110927/</a> 
+</dd><dt id="bib-WEBINTENTS">[WEBINTENTS]</dt><dd>Greg Billock; James Hawkins; Paul Kinlan. <a href="http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html"><cite>Web Intents.</cite></a> Editors' Draft. (Work in progress.) URL: <a href="http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html">http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html</a> 
+</dd></dl></div><div class="section" id="informative-references"><h3><span class="secno">B.2 </span>Informative references</h3><dl class="bibliography"><dt id="bib-GEOLOCATION-API">[GEOLOCATION-API]</dt><dd>Andrei Popescu. <a href="http://www.w3.org/TR/2008/WD-geolocation-API-20081222/"><cite>Geolocation API Specification.</cite></a> 22 December 2008. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2008/WD-geolocation-API-20081222/">http://www.w3.org/TR/2008/WD-geolocation-API-20081222/</a> 
+</dd><dt id="bib-MEDIA-ANNOT-REQS">[MEDIA-ANNOT-REQS]</dt><dd>WonSuk Lee; Felix Sasaki; Tobias Bürger; Véronique Malaisé. <a href="http://www.w3.org/TR/2010/WD-media-annot-reqs-20100121/"><cite>Use Cases and Requirements for Ontology and API for Media Object 1.0.</cite></a>W3C Working Draft 21 January 2010. URL: <a href="http://www.w3.org/TR/2010/WD-media-annot-reqs-20100121/">http://www.w3.org/TR/2010/WD-media-annot-reqs-20100121/</a> 
+</dd><dt id="bib-RFC2046">[RFC2046]</dt><dd>N. Freed; N. Borenstein. <a href="http://www.ietf.org/rfc/rfc2046.txt"><cite>Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types.</cite></a> November 1996. Internet RFC 2046. URL: <a href="http://www.ietf.org/rfc/rfc2046.txt">http://www.ietf.org/rfc/rfc2046.txt</a> 
+</dd></dl></div></div></body></html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gallery/Overview.html	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,1164 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Pick Media Intent</title>
+    <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
+    <style>
+    	table {
+        border-collapse: collapse;
+        border-spacing: 0px;
+        margin-top: +1em;
+        margin-bottom: +1em;
+        border-color: black;
+        font-family: "Courier New", Inconsolata, "Bitstream Charter";
+        font-size: 90%;
+      }
+      th {
+        background-color:DimGray;
+        color:white;
+        font-weight: normal;
+      }
+      .sub-th {
+  	    background-color: Linen;
+  	    font-style: italic;
+      }
+      .centered {
+  	    text-align: center;
+      }
+      .first-column {
+  	    background-color: Beige;
+  	    font-weight: bold;
+      }
+      .excluded-first-column {
+  	    background-color: DarkGray;
+  	    text-decoration: line-through;
+      }
+    </style>
+    <script type="text/javascript" src='https://www.w3.org/Tools/respec/respec-w3c-common' class='remove' async></script>
+    <script type="text/javascript" class='remove'>
+        var respecConfig = {
+              specStatus: "ED",
+              shortName: "gallery",
+              editors: [{
+                        name: "송정기(Jungkee Song)", 
+                        url: "mailto:jungkee.song@samsung.com", 
+                        company: "Samsung Electronics Co., Ltd.", 
+                        companyURL: "http://www.samsung.com/sec/"},
+                        {name: "이원석(Wonsuk Lee)",
+                        url: "http://wonsuk73.com/", 
+                        company: "Samsung Electronics Co., Ltd.", 
+                        companyURL: "http://www.samsung.com/sec/"}
+                      ],
+              // previousPublishDate:  "2012-05-02",
+              // edEnd:  "",
+              // previousMaturity: "ED",
+              edDraftURI: "http://w3c-test.org/dap/gallery/",
+              wg:           "Device APIs Working Group",
+              wgURI:        "http://www.w3.org/2009/dap/",
+              wgPublicList: "public-device-apis",
+              wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/43696/status"
+          };
+    </script>
+  </head>
+  <body>
+    <section id='abstract'>
+      <p>
+        The Pick Media Intent defines a Web Intent [[!WEBINTENTS]] that enables
+         access to a user's media gallery from inside a Web application. It 
+         defines both an Intent action/type pair that selects this operation, 
+         and the format of the media data that is returned by services implementing this specification.
+      </p>
+    </section>
+
+    <section id='sotd'>
+      <p>
+        This document recasts the previous pure JavaScript APIs version as an API built using Web Intents, while refining the metadata format based on related media data definitions and practical web-based media services.
+      </p>
+    </section>
+
+    <section class="informative">
+      <h2>Introduction</h2>
+      <p>
+        On account of a number of media applications and services accessed from various devices, users tend to maintain their media data in multiple sources including local storage of devices and web-based media galleries. For instance, users upload subset of their photos to several different social media galleries with different metadata. For another example, users collect their favourite audio and video resources in several different media galleries which provide inconsistent metadata attributes one another.
+      </p>
+      <p class="note">
+              A terminology, <b>media object</b>, is used hereunder to denote <b>media data</b> that contain a media content and its related metadata. (See <a>Media</a> dictionary)
+      </p>
+      <p>
+        This specification enables a Web application to have access to a selected subset of user's media objects, obtained from arbitrary services not known to the Web application. The interactions, brokered using Web Intents [[WEBINTENTS]] are designed in order to maximise the user's security and privacy. Media objects may be sourced from a plurality of sources — both online and local to the user's device — so long as those sources are registered as Intent services with the user agent. It defines a common media object format which services use to provide data to Web applications in a consistent and interoperable manner.
+      </p>
+      <p>
+        For a Pick Media Intent request, user permission can be naturally asked by a necessary user authentication process that a service implementer MAY provide. Also, users can determine the result media objects to bring to the client with the searching and selecting functionalities that a service implementer MAY provide.
+      </p>
+      <p>
+        A set of <a href="#security-and-privacy-considerations">Security and Privacy Considerations</a> are
+        presented for the discretion of both implementers of Pick Media Intent services and recipients of media
+        data (i.e. Web applications).
+      </p>
+      <p>
+        The following code illustrates how to obtain media object from a user's media gallery:
+      </p>
+      <pre class="example highlight">
+        var intent = new Intent({ action:   "http://webintents.org/pick",
+                                  type:     "http://w3.org/type/media",
+                                  extras:   { search: "Olympic",
+                                              filters: ["title", "description", "author", "tags"],
+                                              limit: 100 }});
+        navigator.startActivity(intent, mediaOK, mediaFail);
+
+        function mediaOK (mediaObjectArray) {
+            // iterate over the array of media objects to do something useful with them
+        }
+        function mediaFail (err) {
+            // display an error to the user
+        }
+      </pre>
+      <p>
+        When the above code is run, the user would typically be prompted by her user agent to select
+        a service able to pick media objects (there may be several such services, if she has multiple media galleries). Upon selecting a service, she will be presented with an interface enabling her
+        to choose what media objects are returned to the Web application. Upon completing her
+        choice, an array of the media objects would be returned to the Web application in the <code>mediaOK</code>
+        callback.
+      </p>
+    </section>
+
+    <section id='conformance'>
+      <p>
+        There is only one single conformance requirement placed upon the <dfn>user agent</dfn>
+        product: a <a>user agent</a> MUST support Web Intents [[!WEBINTENTS]].
+      </p>
+      <p>
+        The conformance criteria in this specification apply to a single product: the
+        <dfn>Media service</dfn> which exposes a Web Intent service that
+        handles Pick Media Intents as defined in this specification.
+      </p>
+      <p>
+        The data returned by the <a>Media service</a> is described in this specification using [[!WEBIDL]].
+        When this data is provided using JavaScript, then the <a>Media service</a> MUST do so in a manner
+        consistent with the ECMAScript Bindings defined in the Web IDL specification.
+      </p>
+    </section>
+
+    <section class="informative">
+      <h2>Security and Privacy Considerations</h2>
+      <p>
+        The Intent defined in this specification can be used to find media objects from user's media galleries. The media objects, in the form of photos, videos, voice recordings with related metadata, may contain user's private information. The distribution of this information could
+        potentially compromise the user's privacy. A conforming implementation
+        of this specification should provide a mechanism that protects the user's privacy and this mechanism should ensure that no such information is retrievable without the user's express permission.
+      </p>
+      <section>
+        <h2>Privacy considerations for implementers of the Pick Media Intent</h2>
+        <p>
+          A <a>media service</a> should not provide media objects to Web sites without the express
+          permission of the user. Obtaining the user's express permission to access a set of media objects does 
+          not imply that the user has granted permission for the same Web site to access more media objects.
+          A <a>media service</a> should take great care to ensure that the user can clearly see which information
+          is about to be shared, and must not share more information than has been requested by the Web application.
+        </p>
+        <p>
+          A <a>user agent</a> may have prearranged trust relationships with a specific <a>media service</a> 
+          that do not require such user interaction.
+        </p>
+      </section>
+      <section>
+        <h2>Privacy considerations for recipients of media objects</h2>
+        <p>
+          Web sites operators that retrieve media objects using this Intent are denoted as recipients
+          below.
+        </p>
+        <p>
+          Recipients should only request media objects when necessary, and only use the media objects for the task for which it was provided to them.
+        </p>
+        <p>
+          Recipients should dispose of media objects once that task is completed, unless expressly
+          permitted to retain it by the user. Recipients should also take measures to protect this information
+          against unauthorised access. If media objects are stored, users should be allowed to update and
+          delete this information.
+        </p>
+        <p>
+          The recipient of media objects should not retransmit the media objects without the
+          user's express permission. Care should be taken when retransmitting and use of encryption is
+          encouraged.
+        </p>
+        <p>
+          Recipients should clearly and conspicuously disclose the fact that they are collecting media objects,
+          the purpose of the collection, how long the data is retained, how the data is secured, how the data is
+          shared if it is shared, how users can access, update and delete the data, and any other choices that
+          users have with respect to the data. This disclosure should include an explanation of any exceptions to
+          the guidelines listed above.
+        </p>
+        <p>
+          Note that even if a user gives permission to share their media objects this can have serious
+          privacy implications for those parties whose media objects are shared, as they may not wish such sharing to
+          occur. This should be considered by Web applications when requesting and using such information.
+        </p>
+      </section>
+      <section>
+        <h2>Additional implementation considerations</h2>
+        <p>
+          Further to the requirements listed in the previous section, implementers of a <a>user agents</a> are
+          also advised to consider the following aspects that can negatively affect the privacy of their users:
+          in certain cases, users can inadvertently grant permission to disclose their media objects
+          to Web sites. In other cases, the content hosted at a certain URL changes in such a way that the
+          previously granted permissions no longer apply as far as the user is concerned. Or the users
+          might simply change their minds.
+        </p>
+        <p>
+          Predicting or preventing these situations is inherently difficult. Mitigation and in-depth defensive
+          measures are a <a>user agent</a>'s responsibility and not prescribed by this specification. However, in
+          designing these measures, implementers are advised to enable user awareness of information sharing, and to
+          provide easy access to user interfaces that enable revocation of permissions that Web applications have to
+          access this Intent.
+        </p>
+      </section>
+    </section>
+
+    <section>
+      <h2>Intent Description</h2>
+      <p>
+        The action for this Intent is <code>http://webintents.org/pick</code>.
+      </p>
+      <p>
+        The type for this Intent is <code>http://w3.org/type/media</code>.
+      </p>
+      <p>
+        When a <a>media service</a> is matched for delivery using these action and type, it
+        MUST respond in one of two ways:
+      </p>
+      <ul>
+        <li>
+          If media objects have been successfully selected for delivery, then a successful payload is returned
+          to the client (using <code>postResult()</code>) matching the data format defined below.
+        </li>
+        <li>
+          If an error of any kind takes place in the service, then an error payload is returned (using
+          <code>postFailure()</code>) matching the error data format defined below. The <a>media service</a>
+          MUST NOT treat the user selecting zero media object or cancelling the service as error conditions.
+        </li>
+      </ul>
+      <section>
+        <h2>Intent Extras</h2>
+        <p>
+          The Pick Media Intent can be instantiated with an <code>extras</code> field that adheres to the 
+          following dictionary.
+        </p>
+        <section>
+          <h2>The <a>MediaIntentExtras</a> dictionary</h2>
+          <p>
+            The <a>MediaIntentExtras</a> dictionary describes the options that the invoker can inform to the service as hints in searching the media objects. None of the fields are mandatory.
+          </p>
+          <dl title='dictionary MediaIntentExtras' class='idl'>
+            <dt>DOMString? search</dt>
+            <dd>
+              A string which provides a hint to the <a>media service</a> to search media objects.
+              The exact manner in which this hint is exploited is entirely up to the <a>media service</a>.
+            </dd>
+            <dt>DOMString[]? filters</dt>
+            <dd>
+              An array of string which contain hints to the <a>media service</a> to the DOMString and DOMString[] fields in the <a>Media</a> dictionary that
+              the Web application prefers to use as search criteria. The <a>media service</a> MAY
+              use the values of the <a>filters</a> to search media objects in the media gallery. If a filter name is provided that the <a>media service</a> does not recognise as a field
+              of the <a>Media</a> dictionary, then it MUST ignore it.
+            </dd>
+            <dt>unsigned long? limit</dt>
+            <dd>
+              By default a <a>media service</a> MAY return as many media objects as the user selects. If <code>limit</code>
+              is specified, the <a>media service</a> MUST NOT return more than <code>limit</code> media objects. The
+              <a>media service</a> SHOULD enforce this limitation in the user interface that it exposes.
+            </dd>
+          </dl>
+        </section>
+      </section>
+    </section>
+    <section>
+      <h2>Data Format</h2>
+      <p>
+        Upon successful invocation, the <a>media service</a> MUST return an array of <a>Media</a> dictionaries.
+      </p>
+      <section>
+        <h2>The <a>Media</a> dictionary</h2>
+        <p>
+          The <a>Media</a> dictionary captures the properties of a media object. The properties defined in this dictionary present the content (URI by default and Blob as option) of the media data and the related metadata. The properties of the dictionary are defined based on the previous work of metadata survey in Media Ontology WG, the <a href="http://www.w3.org/TR/2012/REC-mediaont-10-20120209/#core-property-lists">core set</a>, [[MEDIA-ANNOT-REQS]] as well as the common attributes of open APIs provided by typical web-based media services, thereby allowing the data format to be supported across implementations supporting these various media metadata representations.
+        </p>
+        <p>
+          Additional attributes MAY be included according to the provisions detailed in 
+          <a href="#extended-media-properties-and-parameters">Extended Media Properties and Parameters</a>.
+        </p>
+        <dl title='dictionary Media' class='idl'>
+          <dt>MediaContent content</dt>
+          <dd>
+            The dictionary contains the URI to the content of the media resource. It optionally contains a Blob of the content.
+          </dd>
+          <dt>DOMString title</dt>
+          <dd>
+            The attribute speficies the title or name given to the media resource.
+          </dd>
+          <dt>DOMString description</dt>
+          <dd>
+            The attribute contains a free-form text description of the content of the media resource.
+          </dd>
+          <dt>DOMString type</dt>
+          <dd>
+            The attribute specifies the MIME type of the media resource (e.g., image/png, video/*) [[RFC2046]].
+          </dd>
+          <dt>DOMString? author</dt>
+          <dd>
+            The attribute specifies the creator of the media resource.
+            <p class="note">
+              The name of the attribute represents various contributors, e.g. creator, artist, actoress, etc., in the given media resouce. Hence, the name of the attribute can be changed based on the discussion.
+            </p>
+          </dd>
+          <dt>DOMString? publisher</dt>
+          <dd>
+            The attribute specifies the publisher of the media resource. The attribute can represent various contributors including media uploader, album artist, producer, etc.
+          </dd>
+          <dt>DOMString? composer</dt>
+          <dd>
+            The attribute specifies the composer of the media resource.
+            <p class="note">
+              The usage of the attribute in deployed web services is low (see <a href="#metadata-properties">Metadata properties table</a>.) However, the use case exists in audio applications. The retention of the attribue will be discussed in the group.
+            </p>
+          </dd>
+          <dt>DOMString? collection</dt>
+          <dd>
+            The attribute specifies the name of the collection that the media resource belongs to.
+            <p class="note">
+              The name of the attribute represents various sets of media resources, e.g. music album, photo album, video collection, etc. Hence, the name of the attribute can be changed based on the discussion.
+            </p>
+          </dd>
+          <dt>DOMString? genre</dt>
+          <dd>
+            The attribute specifies the genre (category) of the content of the media resource.
+          </dd>
+          <dt>DOMString? copyright</dt>
+          <dd>
+            The attribute specifies the copyright statement associated with the media resource.
+          </dd>
+          <dt>DOMString? path</dt>
+          <dd>
+            The attribute specifies file path of the media resource in user's local storage. The value of the attribute can be an absolute file path or a name of the leaf file considering the use cases.
+            <p class="note">
+              Although, the original purpose of the attribute is to denote the file path of user's local storage, any additional URL information can be delivered in this attribute.
+            </p>
+          </dd>
+          <dt>float? size</dt>
+          <dd>
+            The attribute specifies the size of the content of the media resource.
+          </dd>
+          <dt>Position? location</dt>
+          <dd>
+            The attribute contains the location information related to the content of the media resource. [[GEOLOCATION-API]]
+          </dd>
+          <dt>DOMString[]? tags</dt>
+          <dd>
+              The attribute contains the array of strings representing series of tag string.
+          </dd>
+          <dt>MediaContent? thumbnail</dt>
+          <dd>
+            The dictionary contains the URI to the thumbnail of the content of the media resource. It optionally contains a Blob of the thumbnail of the content.
+          </dd>
+          <dt>Date? date</dt>
+          <dd>
+              The date Date object represents either the creation date or the last updated date of the media resource.
+          </dd>
+          <dt>Date? publishDate</dt>
+          <dd>
+              The publishDate Date object represents the publishing date of the media resource.
+          </dd>
+          <dt>unsigned long? duration</dt>
+          <dd>
+              The attribute specifies the actual duration of the resource in seconds. (e.g., a running time for a film, a length of a song, etc.)
+          </dd>
+          <dt>Resolution? resolution</dt>
+          <dd>
+            The dictionary specifies the width and height of the media resource in pixels. (e.g., the resolution of Full HD, 1080p, can be represented as: width = 1920 and height = 1080.)
+          </dd>
+          <dt>unsigned long? trackNumber</dt>
+          <dd>
+            The attribute specifies the track number of the media resource.
+            <p class="note">
+              The usage of the attribute is confined to audio type. (see <a href="#metadata-properties">Metadata properties table</a>.) However, the use case exists in audio applications. The retention of the attribue will be discussed in the group.
+            </p>
+          </dd>
+          <dt>DOMString? subtitle</dt>
+          <dd>
+            The attribute contains the subtitle used in the media resource.
+            <p class="note">
+              The usage of the attribute in deployed web services is low (see <a href="#metadata-properties">Metadata properties table</a>.) However, the use case exists in audio and video applications. The retention of the attribue will be discussed in the group.
+            </p>
+          </dd>
+          <dt>unsigned long? likeCount</dt>
+          <dd>
+              The attribute specifies the count of the votes in favor of the media resource.
+          </dd>
+          <dt>unsigned long? viewCount</dt>
+          <dd>
+              The attribute specifies the access count made on the media resource.
+          </dd>
+          <dt>float? rating</dt>
+          <dd>
+              The attribute specifies the rating value (e.g., customer rating, review, audience appreciation) of the media resource.
+          </dd>
+        </dl>
+      </section>
+
+      <section>
+        <h2>The <a>MediaContent</a> dictionary</h2>
+        <p>
+          The <a>MediaContent</a> dictionary describes a media content reference in detail.
+        </p>
+        <dl title='dictionary MediaContent' class='idl'>
+          <dt>DOMString uri</dt>
+          <dd>
+            The URI to the content of the media resource. This attribute is a mandatory property.
+          </dd>
+          <dt>Blob? blob</dt>
+          <dd>
+            The optional property to contain the media content in Blob format.
+          </dd>
+        </dl>
+      </section>
+      
+      <section>
+        <h2>The <a>Resolution</a> dictionary</h2>
+        <p>
+          The <a>Resolution</a> dictionary describes a display resolution of 
+          the given media object. It is usually denoted as "width × height", with 
+          the units in pixels. For example, the HD resolution can be specified as "1280 × 720" meaning the width is 
+          1280 pixels and the height is 720 pixels.
+        </p>
+        <dl title='dictionary Resolution' class='idl'>
+          <dt>unsigned long width</dt>
+          <dd>
+            The width of the media object in pixels.
+          </dd>
+          <dt>unsigned long height</dt>
+          <dd>
+            The height of the media object in pixels.
+          </dd>
+        </dl>
+      </section>
+
+      <section>
+        <h2>The <a>MediaError</a> dictionary</h2>
+        <p>
+          If the <a>media service</a> encounters an error then it MUST return an error 
+          (through <code>postFailure()</code>) using the <a>MediaError</a> dictionary.
+        </p>
+        <dl title='dictionary MediaError' class='idl'>
+          <dt>DOMString message</dt>
+          <dd>A message describing the error.</dd>
+        </dl>
+      </section>
+      <section>
+        <h2>Extended Media Properties and Parameters</h2>
+        <p>
+          A <a>media service</a> MAY extend the dictionaries described in in the Data Formats section with
+          additional fields. If providing an extended field, a <a>media service</a> MUST prefix its name
+          with <code>X</code> (U+0058 LATIN CAPITAL LETTER X) or use a vendor-specific prefix.
+        </p>
+      </section>
+    </section>
+    <section class="informative appendix">
+      <h2>Media Service Example</h2>
+
+      <p>
+      This section describes an example usage of the Pick Media Intent in media service. It shows the use of the values delivered through <a>MediaIntentExtras</a> dictionary, and the way to return the result array of media objects through <a>Media</a> dictionary.
+      </p>
+
+      <section>
+        <h3>Accessing <a>MediaIntentExtras</a> Values  - Example #1</h3>
+
+        <p>
+        Media service implementers can retrieve the values delivered in extra field of the intent request. The extra field contains the MediaIntentExtras dictionary:
+        </p>
+        <div class='example'>
+          <pre class="sh_javascript">
+  &lt;script type="text/javascript"&gt;
+  if (window.intent) {
+      var keyword = window.intent.extra.search;  // a string based hint to search
+      var filters = window.intent.extra.filters; // DOMString[] based hint to fields to match
+      var limit = window.intent.extra.limit;     // maximum number of objects to return
+
+      // do search relevant media objects based on the extras
+      var mediaObjectArray = searchMediaObjects(keyword, filters, limit);
+      
+      if (mediaObjectArray) {
+          window.intent.postResult(mediaObjectArray);
+      } else {
+          window.intent.postFailure(errorMessage);
+      }
+  }  
+  &lt;/script&gt;
+          </pre>
+        </div>
+
+        <p>
+        The use of the properties in MediaIntentExtras dictionary is optional. Service implementers can decide whether these properties are to be used as hints for search.
+        </p>
+      </section>
+
+      <section>
+        <h3>Creating Media Object - Example #2</h3>
+
+        <p>
+        Media service implementers can create media objects in the format of the Media dictionary and make an array of media objects to send to client. (using <code>postResult()</code>):
+        </p>
+
+        <div class='example'>
+          <pre class="sh_javascript">
+  &lt;script type="text/javascript"&gt;
+  if (window.intent) {
+      var content = {};
+      content.uri = "http://example.com/gallery/image00001.png";
+       
+      var mediaObject = new Object();
+      mediaObject.content = content;
+      mediaObject.description = "The city view of Seoul";
+      mediaObject.title = "City of Seoul";
+      mediaObject.type = "image/png";  // MIME type of the media content
+      mediaObject.author = "J.";
+
+      var mediaObjectArray = new Array();
+      
+      mediaObjectArray[0] = mediaObject;
+      
+      if (mediaObjectArray) {
+          window.intent.postResult(mediaObjectArray);
+      } else {
+          window.intent.postFailure(errorMessage);
+      }
+  }  
+  &lt;/script&gt;
+          </pre>
+        </div>
+      </section>
+    </section>
+    <section class="informative appendix">
+      <h2>Metadata Properties</h2>
+      <p>
+      This section describes the critera of the metadata selection and shows 
+      the selected properties and excluded properties under ongoing discussion. 
+      The following table shows the usage of the metadata properties 
+      (see the <a>Media</a> dictionary) in several 
+      platforms and web services.
+      </p>
+      <table border="1" cellpadding="2">
+			  <tbody>
+			    <tr>
+			      <th>Property</th>
+			      <th>Media</th>
+			      <th>Windows</th>
+			      <th>iOS</th>
+			      <th>Ubuntu</th>
+			      <th>Tizen</th>
+			      <th>Android</th>
+			      <th>SoundCloud</th>
+			      <th>Billboard</th>
+			      <th>YouTube</th>
+			      <th>DailyMotion</th>
+			      <th>flickr</th>
+			      <th>google+</th>
+			      <th>Facebook</th>
+			    </tr>
+			    <tr>
+			      <td class="sub-th" colspan="14">Selected Property</td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-content">content</a></td>
+			      <td class="centered">AVI</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-title">title</a></td>
+			      <td class="centered">AVI</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-description">description</a></td>
+			      <td class="centered">AVI</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-type">type</a></td>
+			      <td class="centered">AVI</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-author">author</a></td>
+			      <td class="centered">AVI</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-publisher">publisher</a></td>
+			      <td class="centered">AVI</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-composer">composer</a></td>
+			      <td class="centered">A</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-collection">collection</a></td>
+			      <td class="centered">AI</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-genre">genre</a></td>
+			      <td class="centered">AV</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-copyright">copyright</a></td>
+			      <td class="centered">AVI</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-path">path</a></td>
+			      <td class="centered">AVI</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-size">size</a></td>
+			      <td class="centered">AVI</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-location">location</a></td>
+			      <td class="centered">VI</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-tags">tags</a></td>
+			      <td class="centered">AVI</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-thumbnail">thumbnail</a></td>
+			      <td class="centered">VI</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-date">date</a></td>
+			      <td class="centered">AVI</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-publishDate">publishDate</a></td>
+			      <td class="centered">AVI</td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-duration">duartion</a></td>
+			      <td class="centered">AV</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-resolution">resolution</a></td>
+			      <td class="centered">VI</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-trackNumber">trackNumber</a></td>
+			      <td class="centered">A</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-subtitle">subtitle</a></td>
+			      <td class="centered">AV</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-likeCount">likeCount</a></td>
+			      <td class="centered">AVI</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-viewCount">viewCount</a></td>
+			      <td class="centered">AVI</td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="first-column"><a href="#widl-Media-rating">rating</a></td>
+			      <td class="centered">AVI</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="sub-th" colspan="14">Excluded Property</td>
+			    </tr>
+			    <tr>
+			      <td class="excluded-first-column">id</td>
+			      <td class="centered">AVI</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="excluded-first-column">bitRate</td>
+			      <td class="centered">AV</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="excluded-first-column">audioCodec</td>
+			      <td class="centered">AV</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="excluded-first-column">videoCodec</td>
+			      <td class="centered">V</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="excluded-first-column">frameRate</td>
+			      <td class="centered">V</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="excluded-first-column">language</td>
+			      <td class="centered">AV</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="excluded-first-column">ratingCount</td>
+			      <td class="centered">AVI</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="excluded-first-column">samplingRate</td>
+			      <td class="centered">A</td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="excluded-first-column">bitPerMinute</td>
+			      <td class="centered">A</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			    <tr>
+			      <td class="excluded-first-column">dislikeCount</td>
+			      <td class="centered">AVI</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered">o</td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			      <td class="centered"></td>
+			    </tr>
+			  </tbody>
+			</table>
+			<p>* A: Audio, V: Video, I: Image</p>
+			<section>
+        <h3>Property Selection Criteria</h3>
+        <ul>
+        	<li><b>Simplicity and Practicability</b>: the metadata dictionary should define the minimal 
+        		set of properties that are practically used in deployed plaforms and 
+        		services. Thanks to the prevailing cloud based media services, user 
+        		created media contents tend to be packed with related metadata more 
+        		than ever. Tags and location information are representative such properties. 
+        		While maintaining minimal set of attributes, the <a>Media</a> dictionary covers 
+        		wide use cases from as simple as media information display to virtual image gallery, 
+        		media player apps, and so on. 
+          </li><br>
+          <li>
+          	<b>Commonality</b>: as a great deal of metadata formats are defined and used across various communities, 
+          	it has to be considered that the attributes of the <a>Media</a> dictionary cover generic use cases.
+          	Hence, for the sake of property selection, the previous metadata survey work, quoted as the <a href="http://www.w3.org/TR/2012/REC-mediaont-10-20120209/#core-property-lists">core set</a>, 
+          	of Media Ontology WG has been refered to. The <a href="http://www.w3.org/TR/2012/REC-mediaont-10-20120209/#core-property-lists">core set</a> already considered quite a few metadata formats 
+          	including CableLabs 1.1, DIG35, Dublin Core, EBUCore, EXIF 2.2, ID3, IPTC, LOM 2.1, Media RSS, MPEG-7, 
+          	OGG, QuickTime, DMS-1, TTML, TV-Anytime, TXFeed, XMP and YouTube. The <a>Media</a> dictionary defintion 
+          	naturally falls in the subset of the <a href="http://www.w3.org/TR/2012/REC-mediaont-10-20120209/#core-property-lists">core set</a> with a few additional attributes (tags, likeCount and viewCount) 
+          	to support web services.
+          </li>
+        </ul>
+      </section>
+      <section>
+        <h3>Excluded Properties</h3>
+        <p>
+          The following properties are excluded from the <a>Media</a> dictionary 
+          definition due to the lack of necessity in most of the applications 
+          and services. However, the retention of the properties can be considered 
+          upon any strong use cases under ongoing discussion in the group.
+        </p>
+        <ul>
+          <li>id</li>
+          <li>bitRate</li>
+          <li>audioCodec</li>
+          <li>videoCodec</li>
+          <li>frameRate</li>
+          <li>language</li>
+          <li>ratingCount</li>
+          <li>samplingRate</li>
+          <li>bitPerMinute</li>
+          <li>dislikeCount</li>
+        </ul>
+      </section>
+    </section>
+  </body>
+</html>
\ No newline at end of file
--- a/gallery/index.html	Fri Aug 24 23:36:10 2012 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,715 +0,0 @@
-<!DOCTYPE html>
-<!-- saved from url=(0035)http://dev.w3.org/2009/dap/gallery/ -->
-<html lang="en" dir="ltr">
-	<head>
-		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-  	<title>The Gallery API</title>  
-  	
-<style type="text/css">
-/*****************************************************************
- * ReSpec CSS
- * Robin Berjon (robin at berjon dot com)
- * v0.05 - 2009-07-31
- *****************************************************************/
-
-
-/* --- INLINES --- */
-em.rfc2119 { 
-    text-transform:     lowercase;
-    font-variant:       small-caps;
-    font-style:         normal;
-    color:              #900;
-}
-
-h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
-h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
-    border: none;
-}
-
-dfn {
-    font-weight:    bold;
-}
-
-a.internalDFN {
-    color:  inherit;
-    border-bottom:  1px solid #99c;
-    text-decoration:    none;
-}
-
-a.externalDFN {
-    color:  inherit;
-    border-bottom:  1px dotted #ccc;
-    text-decoration:    none;
-}
-
-a.bibref {
-    text-decoration:    none;
-}
-
-code {
-    color:  #ff4500;
-}
-
-
-/* --- WEB IDL --- */
-pre.idl {
-    border-top: 1px solid #90b8de;
-    border-bottom: 1px solid #90b8de;
-    padding:    1em;
-    line-height:    120%;
-}
-
-pre.idl::before {
-    content:    "WebIDL";
-    display:    block;
-    width:      150px;
-    background: #90b8de;
-    color:  #fff;
-    font-family:    initial;
-    padding:    3px;
-    font-weight:    bold;
-    margin: -1em 0 1em -1em;
-}
-
-.idlType {
-    color:  #ff4500;
-    font-weight:    bold;
-    text-decoration:    none;
-}
-
-/*.idlModule*/
-/*.idlModuleID*/
-/*.idlInterface*/
-.idlInterfaceID, .idlDictionaryID {
-    font-weight:    bold;
-    color:  #005a9c;
-}
-
-.idlSuperclass {
-    font-style: italic;
-    color:  #005a9c;
-}
-
-/*.idlAttribute*/
-.idlAttrType, .idlFieldType, .idlMemberType {
-    color:  #005a9c;
-}
-.idlAttrName, .idlFieldName, .idlMemberName {
-    color:  #ff4500;
-}
-.idlAttrName a, .idlFieldName a, .idlMemberName a {
-    color:  #ff4500;
-    border-bottom:  1px dotted #ff4500;
-    text-decoration: none;
-}
-
-/*.idlMethod*/
-.idlMethType {
-    color:  #005a9c;
-}
-.idlMethName {
-    color:  #ff4500;
-}
-.idlMethName a {
-    color:  #ff4500;
-    border-bottom:  1px dotted #ff4500;
-    text-decoration: none;
-}
-
-/*.idlParam*/
-.idlParamType {
-    color:  #005a9c;
-}
-.idlParamName {
-    font-style: italic;
-}
-
-.extAttr {
-    color:  #666;
-}
-
-/*.idlConst*/
-.idlConstType {
-    color:  #005a9c;
-}
-.idlConstName {
-    color:  #ff4500;
-}
-.idlConstName a {
-    color:  #ff4500;
-    border-bottom:  1px dotted #ff4500;
-    text-decoration: none;
-}
-
-/*.idlException*/
-.idlExceptionID {
-    font-weight:    bold;
-    color:  #c00;
-}
-
-.idlTypedefID, .idlTypedefType {
-    color:  #005a9c;
-}
-
-.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
-    color:  #c00;
-    font-weight:    normal;
-}
-
-.excName a {
-    font-family:    monospace;
-}
-
-.idlRaises a.idlType, .excName a.idlType {
-    border-bottom:  1px dotted #c00;
-}
-
-.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
-    width:  45px;
-    text-align: center;
-}
-.excGetSetTrue, .prmNullTrue, .prmOptTrue { color:  #0c0; }
-.excGetSetFalse, .prmNullFalse, .prmOptFalse { color:  #c00; }
-
-.idlImplements a {
-    font-weight:    bold;
-}
-
-dl.attributes, dl.methods, dl.constants, dl.fields, dl.dictionary-members {
-    margin-left:    2em;
-}
-
-.attributes dt, .methods dt, .constants dt, .fields dt, .dictionary-members dt {
-    font-weight:    normal;
-}
-
-.attributes dt code, .methods dt code, .constants dt code, .fields dt code, .dictionary-members dt code {
-    font-weight:    bold;
-    color:  #000;
-    font-family:    monospace;
-}
-
-.attributes dt code, .fields dt code, .dictionary-members dt code {
-    background:  #ffffd2;
-}
-
-.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code {
-    color:  #005a9c;
-    background:  transparent;
-    font-family:    inherit;
-    font-weight:    normal;
-    font-style: italic;
-}
-
-.methods dt code {
-    background:  #d9e6f8;
-}
-
-.constants dt code {
-    background:  #ddffd2;
-}
-
-.attributes dd, .methods dd, .constants dd, .fields dd, .dictionary-members dd {
-    margin-bottom:  1em;
-}
-
-table.parameters, table.exceptions {
-    border-spacing: 0;
-    border-collapse:    collapse;
-    margin: 0.5em 0;
-    width:  100%;
-}
-table.parameters { border-bottom:  1px solid #90b8de; }
-table.exceptions { border-bottom:  1px solid #deb890; }
-
-.parameters th, .exceptions th {
-    color:  #fff;
-    padding:    3px 5px;
-    text-align: left;
-    font-family:    initial;
-    font-weight:    normal;
-    text-shadow:    #666 1px 1px 0;
-}
-.parameters th { background: #90b8de; }
-.exceptions th { background: #deb890; }
-
-.parameters td, .exceptions td {
-    padding:    3px 10px;
-    border-top: 1px solid #ddd;
-    vertical-align: top;
-}
-
-.parameters tr:first-child td, .exceptions tr:first-child td {
-    border-top: none;
-}
-
-.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
-    width:  100px;
-}
-
-.parameters td.prmType {
-    width:  120px;
-}
-
-table.exceptions table {
-    border-spacing: 0;
-    border-collapse:    collapse;
-    width:  100%;
-}
-
-/* --- TOC --- */
-.toc a {
-    text-decoration:    none;
-}
-
-a .secno {
-    color:  #000;
-}
-
-/* --- TABLE --- */
-table.simple {
-    border-spacing: 0;
-    border-collapse:    collapse;
-    border-bottom:  3px solid #005a9c;
-}
-
-.simple th {
-    background: #005a9c;
-    color:  #fff;
-    padding:    3px 5px;
-    text-align: left;
-}
-
-.simple th[scope="row"] {
-    background: inherit;
-    color:  inherit;
-    border-top: 1px solid #ddd;
-}
-
-.simple td {
-    padding:    3px 10px;
-    border-top: 1px solid #ddd;
-}
-
-.simple tr:nth-child(even) {
-    background: #f0f6ff;
-}
-
-/* --- DL --- */
-.section dd > p:first-child {
-    margin-top: 0;
-}
-
-.section dd > p:last-child {
-    margin-bottom: 0;
-}
-
-.section dd {
-    margin-bottom:  1em;
-}
-
-.section dl.attrs dd, .section dl.eldef dd {
-    margin-bottom:  0;
-}
-
-/* --- EXAMPLES --- */
-pre.example {
-    border-top: 1px solid #ff4500;
-    border-bottom: 1px solid #ff4500;
-    padding:    1em;
-    margin-top: 1em;
-}
-
-pre.example::before {
-    content:    "Example";
-    display:    block;
-    width:      150px;
-    background: #ff4500;
-    color:  #fff;
-    font-family:    initial;
-    padding:    3px;
-    font-weight:    bold;
-    margin: -1em 0 1em -1em;
-}
-
-/* --- EDITORIAL NOTES --- */
-.issue {
-    padding:    1em;
-    margin: 1em 0em 0em;
-    border: 1px solid #f00;
-    background: #ffc;
-}
-
-.issue::before {
-    content:    "Issue";
-    display:    block;
-    width:  150px;
-    margin: -1.5em 0 0.5em 0;
-    font-weight:    bold;
-    border: 1px solid #f00;
-    background: #fff;
-    padding:    3px 1em;
-}
-
-.note {
-    margin: 1em 0em 0em;
-    padding:    1em;
-    border: 2px solid #cff6d9;
-    background: #e2fff0;
-}
-
-.note::before {
-    content:    "Note";
-    display:    block;
-    width:  150px;
-    margin: -1.5em 0 0.5em 0;
-    font-weight:    bold;
-    border: 1px solid #cff6d9;
-    background: #fff;
-    padding:    3px 1em;
-}
-
-/* --- Best Practices --- */
-div.practice {
-    border: solid #bebebe 1px;
-    margin: 2em 1em 1em 2em;
-}
-
-span.practicelab {
-    margin: 1.5em 0.5em 1em 1em;
-    font-weight: bold;
-    font-style: italic;
-}
-
-span.practicelab   { background: #dfffff; }
-
-span.practicelab {
-    position: relative;
-    padding: 0 0.5em;
-    top: -1.5em;
-}
-
-p.practicedesc {
-    margin: 1.5em 0.5em 1em 1em;
-}
-
-@media screen {
-    p.practicedesc {
-        position: relative;
-        top: -2em;
-        padding: 0;
-        margin: 1.5em 0.5em -1em 1em;
-    }
-}
-
-/* --- SYNTAX HIGHLIGHTING --- */
-pre.sh_sourceCode {
-  background-color: white;
-  color: black;
-  font-style: normal;
-  font-weight: normal;
-}
-
-pre.sh_sourceCode .sh_keyword { color: #005a9c; font-weight: bold; }           /* language keywords */
-pre.sh_sourceCode .sh_type { color: #666; }                            /* basic types */
-pre.sh_sourceCode .sh_usertype { color: teal; }                             /* user defined types */
-pre.sh_sourceCode .sh_string { color: red; font-family: monospace; }        /* strings and chars */
-pre.sh_sourceCode .sh_regexp { color: orange; font-family: monospace; }     /* regular expressions */
-pre.sh_sourceCode .sh_specialchar { color: 	#ffc0cb; font-family: monospace; }  /* e.g., \n, \t, \\ */
-pre.sh_sourceCode .sh_comment { color: #A52A2A; font-style: italic; }         /* comments */
-pre.sh_sourceCode .sh_number { color: purple; }                             /* literal numbers */
-pre.sh_sourceCode .sh_preproc { color: #00008B; font-weight: bold; }       /* e.g., #include, import */
-pre.sh_sourceCode .sh_symbol { color: blue; }                            /* e.g., *, + */
-pre.sh_sourceCode .sh_function { color: black; font-weight: bold; }         /* function calls and declarations */
-pre.sh_sourceCode .sh_cbracket { color: red; }                              /* block brackets (e.g., {, }) */
-pre.sh_sourceCode .sh_todo { font-weight: bold; background-color: #00FFFF; }   /* TODO and FIXME */
-
-/* Predefined variables and functions (for instance glsl) */
-pre.sh_sourceCode .sh_predef_var { color: #00008B; }
-pre.sh_sourceCode .sh_predef_func { color: #00008B; font-weight: bold; }
-
-/* for OOP */
-pre.sh_sourceCode .sh_classname { color: teal; }
-
-/* line numbers (not yet implemented) */
-pre.sh_sourceCode .sh_linenum { display: none; }
-
-/* Internet related */
-pre.sh_sourceCode .sh_url { color: blue; text-decoration: underline; font-family: monospace; }
-
-/* for ChangeLog and Log files */
-pre.sh_sourceCode .sh_date { color: blue; font-weight: bold; }
-pre.sh_sourceCode .sh_time, pre.sh_sourceCode .sh_file { color: #00008B; font-weight: bold; }
-pre.sh_sourceCode .sh_ip, pre.sh_sourceCode .sh_name { color: #006400; }
-
-/* for Prolog, Perl... */
-pre.sh_sourceCode .sh_variable { color: #006400; }
-
-/* for LaTeX */
-pre.sh_sourceCode .sh_italics { color: #006400; font-style: italic; }
-pre.sh_sourceCode .sh_bold { color: #006400; font-weight: bold; }
-pre.sh_sourceCode .sh_underline { color: #006400; text-decoration: underline; }
-pre.sh_sourceCode .sh_fixed { color: green; font-family: monospace; }
-pre.sh_sourceCode .sh_argument { color: #006400; }
-pre.sh_sourceCode .sh_optionalargument { color: purple; }
-pre.sh_sourceCode .sh_math { color: orange; }
-pre.sh_sourceCode .sh_bibtex { color: blue; }
-
-/* for diffs */
-pre.sh_sourceCode .sh_oldfile { color: orange; }
-pre.sh_sourceCode .sh_newfile { color: #006400; }
-pre.sh_sourceCode .sh_difflines { color: blue; }
-
-/* for css */
-pre.sh_sourceCode .sh_selector { color: purple; }
-pre.sh_sourceCode .sh_property { color: blue; }
-pre.sh_sourceCode .sh_value { color: #006400; font-style: italic; }
-
-/* other */
-pre.sh_sourceCode .sh_section { color: black; font-weight: bold; }
-pre.sh_sourceCode .sh_paren { color: red; }
-pre.sh_sourceCode .sh_attribute { color: #006400; }
-
-</style><link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel="stylesheet" type="text/css" charset="utf-8"></head>
-
-<body style="display: inherit; "><div class="head"><p><a href="http://www.w3.org/"><img width="72" height="48" src="http://www.w3.org/Icons/w3c_home" alt="W3C"></a></p><h1 class="title" id="title">The Gallery <acronym title="Application Programming Interface">API</acronym></h1><h2 id="w3c-editor-s-draft-02-may-2012"><acronym title="World Wide Web Consortium">W3C</acronym> Editor's Draft 02 May 2012</h2><dl><dt>This version:</dt><dd><a href="http://dev.w3.org/2009/dap/gallery/">http://dev.w3.org/2009/dap/gallery/</a></dd><dt>Latest published version:</dt><dd><a href="http://www.w3.org/TR/gallery/">http://www.w3.org/TR/gallery/</a></dd><dt>Latest editor's draft:</dt><dd><a href="http://dev.w3.org/2009/dap/gallery/">http://dev.w3.org/2009/dap/gallery/</a></dd><dt>Previous version:</dt><dd>none</dd><dt>Editors:</dt>
-<dd><span>송정기(Jungkee Song)</span>, <a href="http://www.samsung.com/sec/">Samsung Electronics Co., Ltd.</a></dd>
-<dd><span>이원석(Wonsuk Lee)</span>, <a href="http://www.samsung.com/sec/">Samsung Electronics Co., Ltd.</a></dd>
-</dl><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2012 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. <acronym title="World Wide Web Consortium">W3C</acronym> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p><hr></div>
-
-<div id="abstract" class="introductory section"><h2>Abstract</h2><p>This specification defines a mechanism to pick and search media (image, video, audio) contents along with related metadata from media galleries.<br><br>
-	This specification uses Web Intents to find and locate the registered galleries.
-</p></div><div id="sotd" class="introductory section"><h2>Status of This Document</h2><p><em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current <acronym title="World Wide Web Consortium">W3C</acronym> publications and the latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/"><acronym title="World Wide Web Consortium">W3C</acronym> technical reports index</a> at http://www.w3.org/TR/.</em></p><p>This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs Working Group</a> as an Editor's Draft. If you wish to make comments regarding this document, please send them to <a href="mailto:public-device-apis@w3.org">public-device-apis@w3.org</a> (<a href="mailto:public-device-apis-request@w3.org?subject=subscribe">subscribe</a>, <a href="http://lists.w3.org/Archives/Public/public-device-apis/">archives</a>). All feedback is welcome.</p><p>Publication as an Editor's Draft does not imply endorsement by the <acronym title="World Wide Web Consortium">W3C</acronym> Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.</p><p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>. <acronym title="World Wide Web Consortium">W3C</acronym> maintains a <a href="http://www.w3.org/2004/01/pp-impl/43696/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>.</p></div>
-	<div id="toc" class="section"><h2 class="introductory">Table of Contents</h2><ul class="toc">
-		<li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#conformance" class="tocxref"><span class="secno">1. </span>Conformance</a></li>
-		<li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#introduction" class="tocxref"><span class="secno">2. </span>Introduction</a><ul class="toc">
-			<li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#usage-examples" class="tocxref"><span class="secno">2.1 </span>Usage Examples</a></li></ul></li>
-		<li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#api-description" class="tocxref"><span class="secno">3. </span><acronym title="Application Programming Interface">API</acronym> Description</a><ul class="toc">
-			<li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#media-object" class="tocxref"><span class="secno">3.1 </span><code>MediaObject</code> dictionary</a><ul class="toc">
-				<li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#attributes" class="tocxref"><span class="secno">3.1.1 </span>Dictionary <code>MediaObject</code> Members</a></li>
-				</ul></li></ul></li>
-		<li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#use-cases-and-requirements" class="tocxref"><span class="secno">4. </span>Use Cases and Requirements</a><ul class="toc">
-			<li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#use-cases" class="tocxref"><span class="secno">4.1 </span>Use Cases</a></li>
-			<li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#requirements" class="tocxref"><span class="secno">4.2 </span>Requirements</a></li></ul></li>
-		<li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#related-documents" class="tocxref"><span class="secno">A. </span>Related documents</a></li>
-		<li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#features-for-future-consideration" class="tocxref"><span class="secno">B. </span>Features for Future Consideration</a></li>
-		<li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#acknowledgements" class="tocxref"><span class="secno">C. </span>Acknowledgements</a></li>
-		<li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#references" class="tocxref"><span class="secno">D. </span>References</a><ul class="toc">
-			<li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#normative-references" class="tocxref"><span class="secno">D.1 </span>Normative references</a></li>
-			<li class="tocline"><a href="http://dev.w3.org/2009/dap/gallery/#informative-references" class="tocxref"><span class="secno">D.2 </span>Informative references</a></li></ul></li></ul>
-	</div>
-
-<div id="conformance" class="section"><!--OddPage--><h2><span class="secno">1. </span>Conformance</h2><p>As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.</p>
-<p>The key words <em class="rfc2119" title="must">must</em>, <em class="rfc2119" title="must not">must not</em>, <em class="rfc2119" title="required">required</em>, <em class="rfc2119" title="should">should</em>, <em class="rfc2119" title="should not">should not</em>, <em class="rfc2119" title="recommended">recommended</em>, <em class="rfc2119" title="may">may</em>, and <em class="rfc2119" title="optional">optional</em> in this specification are to be interpreted as described in [<cite><a class="bibref" rel="biblioentry" href="http://dev.w3.org/2009/dap/gallery/#bib-RFC2119">RFC2119</a></cite>].</p>
-
-</div>
-
-<div class="informative section" id="introduction">
-
-	<!--OddPage--><h2><span class="secno">2. </span>Introduction</h2><p><em>This section is non-normative.</em></p>
-	<p>The Gallery <acronym title="Application Programming Interface">API</acronym> defines a high-level interface for accessing media gallery located on the device. A media gallery is a collection of media objects such as video, audio and image. </p>
-	<p class="note">To achieve the simplicity in the browser level context, this specification defines only the read-only functionalities.</p>
-	<div id="usage-examples" class="section">
-		<h3><span class="secno">2.1 </span>Usage Examples</h3>
-		<p>The following code shows how to work with the gallery <acronym title="Application Programming Interface">API</acronym>.</p>
-		<p>Example of a image gallery service. The code registers a pick action for image pick service:</p>
-		<div>
-			<pre class="example">&lt;html&gt;
-&lt;head&gt;
-&lt;meta charset='utf-8' /&gt;
-&lt;title&gt;Image Gallery Service&lt;/title&gt;
-&lt;intent action=”http://webintents.org/pick” 
-	type=”image/*” 
-	href=”http://example.org/ImageService/” 
-	title=”Example Image Service” /&gt;
-&lt;/head&gt;
-			</pre>
-		</div>
-		<p>A web application start a Web Intent request to pick images from registered galleries.</p>
-		<div>
-			<pre class="example sh_javascript_dom sh_sourceCode"><span class="sh_comment">// Client-ends request media service using Web Intents <b>pick</b> action</span>
-<span class="sh_comment">// The request of <b>image</b> pick service</span>
-
-<span class="sh_keyword">var</span> intent <span class="sh_symbol">=</span> <span class="sh_keyword">new</span> <span class="sh_predef_func">Intent</span><span class="sh_symbol">({</span>
-                        action<span class="sh_symbol">:</span> <span class="sh_string">"http://webintents.org/pick"</span><span class="sh_symbol">,</span>
-                        type<span class="sh_symbol">:</span> <span class="sh_string">"image/*"</span><span class="sh_symbol">,</span>
-                        extras<span class="sh_symbol">:</span> <span class="sh_symbol">{</span> filter<span class="sh_symbol">:</span> <span class="sh_symbol">{</span> name<span class="sh_symbol">:</span> <span class="sh_string">"Seoul"</span> <span class="sh_symbol">},</span> multiple<span class="sh_symbol">:</span> <span class="sh_predef_var">true</span> <span class="sh_symbol">}</span>
-                        <span class="sh_symbol">});</span>
-                        
-navigator<span class="sh_symbol">.</span><span class="sh_predef_func">startActivity</span><span class="sh_symbol">(</span>intent<span class="sh_symbol">,</span> galleryResponse<span class="sh_symbol">);</span>
-
-<span class="sh_keyword">function</span> <span class="sh_predef_func">galleryResponse</span><span class="sh_symbol">(</span>data<span class="sh_symbol">)</span> <span class="sh_symbol">{</span>
-    <span class="sh_comment">// Parse data encoded in an array of objects</span>
-<span class="sh_symbol">}</span></pre>
-		</div>
-		<p>Example of a video gallery service. The code registers a pick action for video pick service:</p>
-		<div>
-			<pre class="example">&lt;html&gt;
-&lt;head&gt;
-&lt;meta charset='utf-8' /&gt;
-&lt;title&gt;Video Gallery Service&lt;/title&gt;
-&lt;intent action=”http://webintents.org/pick” 
-	type=”video/*” 
-	href=”http://example.org/VideoService/” 
-	title=”Example Video Service” /&gt;
-&lt;/head&gt;
-			</pre>
-		</div>
-		<p>A web application start a Web Intent request to pick videos from registered galleries.</p>
-		<div>
-			<pre class="example sh_javascript_dom sh_sourceCode"><span class="sh_comment">// Client-ends request media service using Web Intents <b>pick</b> action</span>
-<span class="sh_comment">// The request of <b>video</b> pick service</span>
-
-<span class="sh_keyword">var</span> intent <span class="sh_symbol">=</span> <span class="sh_keyword">new</span> <span class="sh_predef_func">Intent</span><span class="sh_symbol">({</span>
-                        action<span class="sh_symbol">:</span> <span class="sh_string">"http://webintents.org/pick"</span><span class="sh_symbol">,</span>
-                        type<span class="sh_symbol">:</span> <span class="sh_string">"video/*"</span><span class="sh_symbol">,</span>
-                        extras<span class="sh_symbol">:</span> <span class="sh_symbol">{</span> filter<span class="sh_symbol">:</span> <span class="sh_symbol">{</span> name<span class="sh_symbol">:</span> <span class="sh_string">"Family"</span> <span class="sh_symbol">},</span> multiple<span class="sh_symbol">:</span> <span class="sh_predef_var">true</span> <span class="sh_symbol">}</span>
-                        <span class="sh_symbol">});</span>
-                        
-navigator<span class="sh_symbol">.</span><span class="sh_predef_func">startActivity</span><span class="sh_symbol">(</span>intent<span class="sh_symbol">,</span> galleryResponse<span class="sh_symbol">);</span>
-
-<span class="sh_keyword">function</span> <span class="sh_predef_func">galleryResponse</span><span class="sh_symbol">(</span>data<span class="sh_symbol">)</span> <span class="sh_symbol">{</span>
-    <span class="sh_comment">// Parse data encoded in an array of objects</span>
-<span class="sh_symbol">}</span></pre>
-		</div>
-		<p>Example of a audio gallery service. The code registers a pick action for audio pick service:</p>
-		<div>
-			<pre class="example">&lt;html&gt;
-&lt;head&gt;
-&lt;meta charset='utf-8' /&gt;
-&lt;title&gt;Audio Gallery Service&lt;/title&gt;
-&lt;intent action=”http://webintents.org/pick” 
-	type=”audio/*” 
-	href=”http://example.org/AudioService/” 
-	title=”Example Audio Service” /&gt;
-&lt;/head&gt;
-			</pre>
-		</div>
-		<p>A web application start a Web Intent request to pick audios from registered galleries.</p>
-		<div>
-			<pre class="example sh_javascript_dom sh_sourceCode"><span class="sh_comment">// Client-ends request media service using Web Intents <b>pick</b> action</span>
-<span class="sh_comment">// The request of <b>audio</b> pick service</span>
-
-<span class="sh_keyword">var</span> intent <span class="sh_symbol">=</span> <span class="sh_keyword">new</span> <span class="sh_predef_func">Intent</span><span class="sh_symbol">({</span>
-                        action<span class="sh_symbol">:</span> <span class="sh_string">"http://webintents.org/pick"</span><span class="sh_symbol">,</span>
-                        type<span class="sh_symbol">:</span> <span class="sh_string">"audio/*"</span><span class="sh_symbol">,</span>
-                        extras<span class="sh_symbol">:</span> <span class="sh_symbol">{</span> filter<span class="sh_symbol">:</span> <span class="sh_symbol">{</span> name<span class="sh_symbol">:</span> <span class="sh_string">"Love"</span> <span class="sh_symbol">},</span> multiple<span class="sh_symbol">:</span> <span class="sh_predef_var">true</span> <span class="sh_symbol">}</span>
-                        <span class="sh_symbol">});</span>
-                        
-navigator<span class="sh_symbol">.</span><span class="sh_predef_func">startActivity</span><span class="sh_symbol">(</span>intent<span class="sh_symbol">,</span> galleryResponse<span class="sh_symbol">);</span>
-
-<span class="sh_keyword">function</span> <span class="sh_predef_func">galleryResponse</span><span class="sh_symbol">(</span>data<span class="sh_symbol">)</span> <span class="sh_symbol">{</span>
-    <span class="sh_comment">// Parse data encoded in an array of objects</span>
-<span class="sh_symbol">}</span></pre>
-		</div>
-		<p class="note">Mediaobject (ImageObject, VideoObject and AudioObject) in schema.org might be used as type in case Web Intents specification adopts it.</p>
-		<p class="note">Callback gets an array of objects, data, describing the content. Objects in data, in addition to other metadata fields, have either a url or a content field that would contain a Blob (i.e. the media content.)</p>
-	</div>
-</div>
-
-<div id="api-description" class="section">
-	<!--OddPage--><h2><span class="secno">3. </span><acronym title="Application Programming Interface">API</acronym> Description</h2>
-	<!--section>
-		<h2><code>Galleries</code> interface</h2>
-		<p class="note"> More functions could be taked into account. e.g. How about finding function to the all galleries on the device? </p>
-		<p><code>Galleries</code> interface offer access to the list of Media Galleries on the device. The number of galleries is dependent on the implementation. 
-			As an example, in a window mobile implementation it might retrieve the gallery located in the directory "\My Documents" and another on located on the memory card.</p>
-		
-
-		<dl title="[NoInterfaceObject] interface Galleries" class="idl">
-		  <dt>MediaGalleries getGalleries() </dt>
-		    <dd>Retrieve all galleries located on the device. </dd>
-		</dl>		
-	</section-->	
-	<div id="media-object" class="section">
-		<h3><span class="secno">3.1 </span><code>MediaObject</code> dictionary</h3>
-		<p>The <code>MediaObject</code> dictionary exposes an object to deliver media contents and related metadata from web galleries and local galleries.</p>
-		<p class="note">The metadata of the media contens and the search filters are to be defined.</p>
-		<pre class="idl"><span class="idlDictionary" id="idl-def-MediaObject">dictionary</span> <span class="idlDictionaryID">MediaObject</span> {
-<span class="idlMember">    <span class="idlMemberType"><a>readonly attribute any</a></span>    <span class="idlMemberName"><a href="#widl-MediaObject-content">content</a></span>;</span>
-<span class="idl">};</span>
-</pre><div id="attributes" class="section"><h4><span class="secno">3.1.1 </span>Dictionary <a class="idlType" href="#idl-def-MediaObject"><code>MediaObject</code></a> Members</h4><dl class="attributes"><dt id="widl-Gallery-length"><code>content</code> of type <span class="idlAttrType"><a>any</a></span>, readonly</dt><dd>the content of the media object.</dd></dl></div>
-	  <h3><span class="secno">3.2 </span>Discussion</h3>
-		<p class="note">This section is only for dicussion and will be deleted.</p>
-		<p>
-				</p><h4>Content delivery method:</h4>
-				Which is a better way, using a url or a blob?<br>
-<ul><li> a URL (Blob URI is used for local contents: http://www.w3.org/TR/FileAPI/#creating-revoking)
-	<br>
-  Advantage: Web application developers do not have to take complex part of blob reception.
-  <br>
-  Disadvantage: for remote contents, developers cannot manipulate the contents in script (other than assigning them to image/video/audio element) unless the remote service has enabled CORS.
-</li>
-<li> a Blob
-	<br>
-	Advantage: no matter whether the galleries are remote or local, developers can manipulate the received contents in the same way.
-	<br>
-  Disadvantage: When retrieving huge amount of data from the galleries, a naïve implementation might think it needs to download entire contents before exposing blobs. In fact, blob reading can be done, through FileReader, on demand. (FileReader even provides Progress Events, but it does require an implementation of Blob that supports this sort of usage.)
-</li></ul>
-				
-			<p></p>
-			<p>
-				</p><h4><em>extra</em> attribute in Web Intents request</h4>
-				When extra attribute is not given, the request is regarded a search for everything and pick just one; when extra is given, the request is regarded as a specific content search.
-			<p></p>
-			<p>
-				</p><h4><em>multiple</em> attribute in <em>extra</em> parameter:</h4>
-				When set to true, <em>mutiple</em> attribute in <em>extra</em> paramenter means a client wants to retrieve contents from multiple media sources. Search filter should filter what the user sees in the picker, and the user still decides what is returned (which can be everything of course).
-			<p></p>
-			<br>
-
-<div id="use-cases-and-requirements" class="section">
-	<!--OddPage--><h2><span class="secno">4. </span>Use Cases and Requirements</h2>
-		<div id="use-cases" class="section">
-			<h3><span class="secno">4.1 </span>Use Cases</h3>
-			<p>
-				</p><h4 id="uc1">Picking image:</h4>
-				A user picks an image or a set of images either from web galleries (e.g. Flickr, Piscasa, etc.) or from local gallery.				
-			<p></p>
-			<p>
-				</p><h4 id="uc2">Picking video:</h4>
-				A user picks a video or a set of videos either from web galleries (e.g. YouTube, DailyMotion, etc.) or from local gallery.
-			<p></p>
-			<p>
-				</p><h4 id="uc3">Picking audio:</h4>
-				A user picks an audio or a set of audio either from web galleries (e.g. SoundCloud, Last.fm, etc.) or from local gallery.
-			<p></p>
-			<br>
-			<p class="note">Advantage: it makes integrating with popular services like Flickr, Youtube, SoundCloud a lot easier.</p>
-		</div>
-		<div id="requirements" class="section">
-			<h3><span class="secno">4.2 </span>Requirements</h3>
-			<p>The Gallery <acronym title="Application Programming Interface">API</acronym>: </p>
-			<ul>
-			  <li><em class="rfc2119" title="must">must</em> provide the ability to list the galleries from available sources (e.g. local storage, memory card and web services such as Flickr, YouTube, SoundCloud, etc.) – by Web Intents</li>
-			  <li><em class="rfc2119" title="must">must</em> provide the ability to enumerate the media objects in the designated gallery.</li>
-			  <li><em class="rfc2119" title="must">must</em> provide the ability to filter the media objects in the designated gallery. i.e. finding content inside a gallery (e.g. date, title, geolocation, etc.)</li>
-			  <li><em class="rfc2119" title="must">must</em> provide the ability to retrieve the metadata of the media objects in the gallery (the metadata format is to be defined later through e.g. the MediaObjects in schema.org or the model in JS, etc.)</li>
-			</ul>
-		</div>		
-</div>
-
-<div class="appendix section" id="related-documents">
-	<!--OddPage--><h2><span class="secno">A. </span>Related documents</h2>
-	<p>The <acronym title="Application Programming Interface">API</acronym> described in this document took inspiration from the following	documents:</p>
-	<ul>
-	  <li><a href="http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html" name="WebIntents" id="WebIntents">Web Intents</acronym></a> </li>
-	</ul>
-</div>
-<div id="features-for-future-consideration" class="section">
-  <!--OddPage--><h2><span class="secno">B. </span>Features for Future Consideration</h2>
-  <p>This is a list of features that have been discussed with respect to this version of the <acronym title="Application Programming Interface">API</acronym> but for which it has been decided that if they are
-  included it will be in a future revision. </p>
-  <ul>
-    <li>...</li>
-  </ul>
-</div>
-<div class="appendix section" id="acknowledgements">
-	<!--OddPage--><h2><span class="secno">C. </span>Acknowledgements</h2>
-	<p>Many thanks to Robin Berjon for making our lives so much easier with his cool tool.</p>
-</div>
-
-
-<div id="references" class="appendix section"><!--OddPage--><h2><span class="secno">D. </span>References</h2><div id="normative-references" class="section"><h3><span class="secno">D.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-CORE-DEVICE">[A Blob URI]</dt><dd>Arun Ranganathan; Jonas Sicking. <a href="http://www.w3.org/TR/FileAPI/#creating-revoking"><cite>A Blob URI.</cite></a> 20 October 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/FileAPI/#creating-revoking">http://www.w3.org/TR/FileAPI/#creating-revoking</a> 
-</dd><dt id="bib-RFC2119">[Web Intents]</dt><dd>Greg Billock; James Hawkins; Paul Kinlan. <a href="http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html"><cite>Web Intents.</cite></a> 27 April 2012. W3C Editor's Draft. (Work in progress.)  URL: <a href="http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html">http://dvcs.w3.org/hg/web-intents/raw-file/tip/spec/Overview.html</a> 
-</dd></dl></div><div id="informative-references" class="section"><h3><span class="secno">D.2 </span>Informative references</h3><p>No informative references.</p></div></div></body></html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/humidity/Overview.html	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,196 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Ambient Humidity Events</title>
+    <meta charset="utf-8"/>
+    <script src='http://www.w3.org/Tools/respec/respec-w3c-common' class='remove'></script>
+    <!--script src='http://dev.w3.org/2009/dap/ReSpec.js/js/respec.js' class='remove'></script-->
+    <script class="remove">
+      var respecConfig = {
+          specStatus:           "unofficial",
+          shortName:            "humidity",
+          //publishDate:          "yyyy-mm-dd",
+          //previousPublishDate:  "yyyy-mm-dd",
+          previousMaturity:     "ED",
+          edDraftURI:           "http://dvcs.w3.org/hg/dap/raw-file/tip/humidity/Overview.html",
+          //lcEnd:                "yyyy-mm-dd",
+          editors:  [
+			  { name: "Marcos Cáceres", company: "W3C Invited Expert", companyURL: "http://datadriven.com.au" },
+			  { name: "Balaji N.V", company: "Samsung Electronics", companyURL: "http://samsung.com" }
+          ],
+          inlineCSS:    true,
+          noIDLIn:      true,
+          //extraCSS:     ["../ReSpec.js/css/respec.css"],
+          extraCSS:     ["http://dev.w3.org/2009/dap/ReSpec.js/css/respec.css"],
+          wg:           "Device APIs Working Group",
+          wgURI:        "http://www.w3.org/2009/dap/",
+          wgPublicList: "public-device-apis",
+          wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/43696/status",
+      };
+    </script>
+  </head>
+<body>
+    <section id="abstract">
+      This specification defines a means to receive events that correspond to changes in 
+      ambient humidity.
+    </section>
+    
+    <section id="sotd">
+     
+    </section>
+    
+    <section class="informative">
+      <h2>Introduction</h2>
+      <p>
+        The <a>AmbientHumidityEvent</a> interface provides web developers
+        information about the ambient humidity levels near the hosting device.
+      </p>
+      <p>
+        This is achieved by interrogating a humidistat or similar detectors
+        of a device.
+      </p>
+      
+      <section>
+      <h3>Use Cases</h3>
+      <p>TBW</p>
+      </section>
+      
+    </section>
+    
+    <section id="conformance">
+      <p>
+        This specification defines conformance criteria that apply to a single
+        product: the <dfn>user agent</dfn> that implements the
+        interfaces that it contains.
+      </p>
+    </section>
+    
+    <section>
+      <h2>Terminology</h2>
+      <p>
+        The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#eventhandler">
+        EventHandler</a></code> interface represents a <a href="http://www.w3.org/TR/WebIDL/#idl-callback-functions">callback function</a> used for <a href="http://dev.w3.org/html5/spec/webappapis.html#event-handlers">event
+      handlers</a> as defined in [[!HTML5]]. </p>
+      <p>
+        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]].
+      </p>
+      <p>
+        The terms <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#event-handlers">
+        event handlers</a></dfn> and
+        <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 <dfn>
+      <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#constructing-events">
+      create an event</a></dfn> and <dfn>
+      <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#firing-events">
+      fire an event</a></dfn> are defined in [[!DOM4]].
+      <p>
+        The <dfn>current humidity</dfn> is a value that represents the ralative humidity expressed as a value between 0 and 1 (e.g., 0.533, which equates to 53.3% humidity).
+      </p>
+    </section>
+    
+    <section>
+      <h2>Security and privacy considerations</h2>
+      <p>
+      </p>
+    </section>
+    
+    <section>
+      <h2>Humidity</h2>
+      <p>
+        The HTML5 specification [[!HTML5]] defines a <a>Window</a> interface,
+        which this specification extends:
+      </p>
+      <dl title="partial interface Window" class="idl">
+        <dt>attribute EventHandler onhumidity</dt>
+        <dd>
+        </dd>
+      </dl>
+      <p>
+        The <code>onhumidity</code> event handler and its corresponding
+        event handler event type <code>ambienthumidity</code> MUST be supported
+        as an IDL attribute by all objects implementing the <a>Window</a>
+        interface.
+      </p>
+      <section>
+        <h2><a>AmbientHumidityEvent</a> Interface</h2>
+        <dl title="[Constructor (DOMString type, optional AmbientHumidityEventInit eventInitDict)]
+                   interface AmbientHumidityEvent : Event"
+            class="idl" data-merge='AmbientHumidityEventInit'>
+          <dt>readonly attribute double value</dt>
+          <dd>
+            The <a>current ambient humidity</a>.
+          </dd>
+        </dl>
+        <dl title="dictionary AmbientHumidityEventInit : EventInit" class='idl'>
+          <dt>
+            double value
+          </dt>
+          <dd></dd>
+        </dl>
+        <p>
+          When a <dfn>user agent</dfn> is required to <dfn>fire an ambient humidity event</dfn>, the <dfn>user agent</dfn> MUST run the
+          following steps:
+        </p>
+        <ol class="rule">
+          <li>
+            <a>Create an event</a> that uses the <a>AmbientHumidityEvent</a>
+            interface, with the name <code>ambienthumidity</code>, which
+            bubbles, is not cancelable, and has no default action, that also
+            meets the following conditions:
+            <ol>
+              <li>
+                If the implementation is unable to report the <a>current
+                ambient humidity</a>, initialize the <code>value</code>
+                attribute to positive Infinity, otherwise initialize the
+                attribute to the <a>current ambient humidity</a>.
+              </li>
+            </ol>
+          </li>
+          <li>
+            <a>Queue a task</a> to dispatch the newly created event at the
+            <a>Window</a> object.
+          </li>
+        </ol>
+        <p>
+          When the <a>current humidity</a> changes, the <a>user
+          agent</a> MUST <a>fire a ambient humidity event</a>.
+        </p>
+        <div class="note">
+          The definition of granularity i.e. how often the event is fired is
+          left to the implementation. Implementations may fire the event if
+          they have reason to believe that the page does not have sufficiently
+          fresh data.
+        </div>
+        <section>
+          <h2>Event handlers</h2>
+          <p>
+            The following are the <a>event handlers</a> (and their corresponding
+            <a>event handler event types</a>) that MUST be supported as
+            attributes by the <code>Window</code> object:
+          </p>
+          <table class="simple">
+            <thead>
+              <tr>
+                <th>event handler</th>
+                <th>event handler event type</th>
+              </tr>
+            </thead>
+            <tbody>
+              <tr>
+                <td><strong><code>onhumidity</code></strong></td>
+                <td><code>ambienthumidity</code></td>
+              </tr>
+            </tbody>
+          </table>
+        </section>
+      </section>
+    </section>
+      
+    <section class="appendix"></section>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/light/FPWD.html	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,654 @@
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+<head>
+    <title>Ambient Light Events</title>
+    <meta charset="utf-8">
+    
+    
+  <style>/*****************************************************************
+ * ReSpec 3 CSS
+ * Robin Berjon - http://berjon.com/
+ *****************************************************************/
+
+/* --- INLINES --- */
+em.rfc2119 { 
+    text-transform:     lowercase;
+    font-variant:       small-caps;
+    font-style:         normal;
+    color:              #900;
+}
+
+h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
+h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
+    border: none;
+}
+
+dfn {
+    font-weight:    bold;
+}
+
+a.internalDFN {
+    color:  inherit;
+    border-bottom:  1px solid #99c;
+    text-decoration:    none;
+}
+
+a.externalDFN {
+    color:  inherit;
+    border-bottom:  1px dotted #ccc;
+    text-decoration:    none;
+}
+
+a.bibref {
+    text-decoration:    none;
+}
+
+cite .bibref {
+    font-style: normal;
+}
+
+code {
+    color:  #ff4500;
+}
+
+
+/* --- --- */
+ol.algorithm { counter-reset:numsection; list-style-type: none; }
+ol.algorithm li { margin: 0.5em 0; }
+ol.algorithm li:before { font-weight: bold; counter-increment: numsection; content: counters(numsection, ".") ") "; }
+
+/* --- TOC --- */
+.toc a, .tof a {
+    text-decoration:    none;
+}
+
+a .secno, a .figno {
+    color:  #000;
+}
+
+ul.tof, ol.tof {
+    list-style: none outside none;
+}
+
+.caption {
+    margin-top: 0.5em;
+    font-style:   italic;
+}
+
+/* --- TABLE --- */
+table.simple {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    border-bottom:  3px solid #005a9c;
+}
+
+.simple th {
+    background: #005a9c;
+    color:  #fff;
+    padding:    3px 5px;
+    text-align: left;
+}
+
+.simple th[scope="row"] {
+    background: inherit;
+    color:  inherit;
+    border-top: 1px solid #ddd;
+}
+
+.simple td {
+    padding:    3px 10px;
+    border-top: 1px solid #ddd;
+}
+
+.simple tr:nth-child(even) {
+    background: #f0f6ff;
+}
+
+/* --- DL --- */
+.section dd > p:first-child {
+    margin-top: 0;
+}
+
+.section dd > p:last-child {
+    margin-bottom: 0;
+}
+
+.section dd {
+    margin-bottom:  1em;
+}
+
+.section dl.attrs dd, .section dl.eldef dd {
+    margin-bottom:  0;
+}
+</style><style>/* --- ISSUES/NOTES --- */
+div.issue-title, div.note-title {
+    padding-right:  1em;
+    min-width: 7.5em;
+    color: #b9ab2d;
+}
+div.issue-title { color: #e05252; }
+div.note-title { color: #52e052; }
+div.issue-title span, div.note-title span {
+    text-transform: uppercase;
+}
+div.note, div.issue {
+    margin-top: 1em;
+    margin-bottom: 1em;
+}
+.note > p:first-child, .issue > p:first-child { margin-top: 0 }
+.issue, .note {
+    padding: .5em;
+    border-left-width: .5em;
+    border-left-style: solid;
+}
+div.issue, div.note {
+    padding: 0.5em;
+    margin: 1em 0;
+    position: relative;
+    clear: both;
+}
+span.note, span.issue { padding: .1em .5em .15em; }
+
+.issue {
+    border-color: #e05252;
+    background: #fbe9e9;
+}
+.note {
+    border-color: #52e052;
+    background: #e9fbe9;
+}
+
+
+</style><style>/* --- WEB IDL --- */
+pre.idl {
+    border-top: 1px solid #90b8de;
+    border-bottom: 1px solid #90b8de;
+    padding:    1em;
+    line-height:    120%;
+}
+
+pre.idl::before {
+    content:    "WebIDL";
+    display:    block;
+    width:      150px;
+    background: #90b8de;
+    color:  #fff;
+    font-family:    initial;
+    padding:    3px;
+    font-weight:    bold;
+    margin: -1em 0 1em -1em;
+}
+
+.idlType {
+    color:  #ff4500;
+    font-weight:    bold;
+    text-decoration:    none;
+}
+
+/*.idlModule*/
+/*.idlModuleID*/
+/*.idlInterface*/
+.idlInterfaceID, .idlDictionaryID, .idlCallbackID, .idlEnumID {
+    font-weight:    bold;
+    color:  #005a9c;
+}
+
+.idlSuperclass {
+    font-style: italic;
+    color:  #005a9c;
+}
+
+/*.idlAttribute*/
+.idlAttrType, .idlFieldType, .idlMemberType {
+    color:  #005a9c;
+}
+.idlAttrName, .idlFieldName, .idlMemberName {
+    color:  #ff4500;
+}
+.idlAttrName a, .idlFieldName a, .idlMemberName a {
+    color:  #ff4500;
+    border-bottom:  1px dotted #ff4500;
+    text-decoration: none;
+}
+
+/*.idlMethod*/
+.idlMethType, .idlCallbackType {
+    color:  #005a9c;
+}
+.idlMethName {
+    color:  #ff4500;
+}
+.idlMethName a {
+    color:  #ff4500;
+    border-bottom:  1px dotted #ff4500;
+    text-decoration: none;
+}
+
+/*.idlParam*/
+.idlParamType {
+    color:  #005a9c;
+}
+.idlParamName {
+    font-style: italic;
+}
+
+.extAttr {
+    color:  #666;
+}
+
+/*.idlConst*/
+.idlConstType {
+    color:  #005a9c;
+}
+.idlConstName {
+    color:  #ff4500;
+}
+.idlConstName a {
+    color:  #ff4500;
+    border-bottom:  1px dotted #ff4500;
+    text-decoration: none;
+}
+
+/*.idlException*/
+.idlExceptionID {
+    font-weight:    bold;
+    color:  #c00;
+}
+
+.idlTypedefID, .idlTypedefType {
+    color:  #005a9c;
+}
+
+.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
+    color:  #c00;
+    font-weight:    normal;
+}
+
+.excName a {
+    font-family:    monospace;
+}
+
+.idlRaises a.idlType, .excName a.idlType {
+    border-bottom:  1px dotted #c00;
+}
+
+.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
+    width:  45px;
+    text-align: center;
+}
+.excGetSetTrue, .prmNullTrue, .prmOptTrue { color:  #0c0; }
+.excGetSetFalse, .prmNullFalse, .prmOptFalse { color:  #c00; }
+
+.idlImplements a {
+    font-weight:    bold;
+}
+
+dl.attributes, dl.methods, dl.constants, dl.fields, dl.dictionary-members {
+    margin-left:    2em;
+}
+
+.attributes dt, .methods dt, .constants dt, .fields dt, .dictionary-members dt {
+    font-weight:    normal;
+}
+
+.attributes dt code, .methods dt code, .constants dt code, .fields dt code, .dictionary-members dt code {
+    font-weight:    bold;
+    color:  #000;
+    font-family:    monospace;
+}
+
+.attributes dt code, .fields dt code, .dictionary-members dt code {
+    background:  #ffffd2;
+}
+
+.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code {
+    color:  #005a9c;
+    background:  transparent;
+    font-family:    inherit;
+    font-weight:    normal;
+    font-style: italic;
+}
+
+.methods dt code {
+    background:  #d9e6f8;
+}
+
+.constants dt code {
+    background:  #ddffd2;
+}
+
+.attributes dd, .methods dd, .constants dd, .fields dd, .dictionary-members dd {
+    margin-bottom:  1em;
+}
+
+table.parameters, table.exceptions {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    margin: 0.5em 0;
+    width:  100%;
+}
+table.parameters { border-bottom:  1px solid #90b8de; }
+table.exceptions { border-bottom:  1px solid #deb890; }
+
+.parameters th, .exceptions th {
+    color:  #fff;
+    padding:    3px 5px;
+    text-align: left;
+    font-family:    initial;
+    font-weight:    normal;
+    text-shadow:    #666 1px 1px 0;
+}
+.parameters th { background: #90b8de; }
+.exceptions th { background: #deb890; }
+
+.parameters td, .exceptions td {
+    padding:    3px 10px;
+    border-top: 1px solid #ddd;
+    vertical-align: top;
+}
+
+.parameters tr:first-child td, .exceptions tr:first-child td {
+    border-top: none;
+}
+
+.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
+    width:  100px;
+}
+
+.parameters td.prmType {
+    width:  120px;
+}
+
+table.exceptions table {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    width:  100%;
+}
+</style><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet"><!--[if lt IE 9]><script src='undefined://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head>
+  <body><div class="head">
+  <p>
+    
+      <a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72"></a>
+    
+  </p>
+  <h1 class="title" id="title">Ambient Light Events</h1>
+  
+  <h2 id="w3c-working-draft-02-august-2012"><abbr title="World Wide Web Consortium">W3C</abbr> Working Draft 02 August 2012</h2>
+  <dl>
+    
+      <dt>This version:</dt>
+      <dd><a href="http://www.w3.org/TR/2012/WD-ambient-light-20120802/">http://www.w3.org/TR/2012/WD-ambient-light-20120802/</a></dd>
+      <dt>Latest published version:</dt>
+      <dd><a href="http://www.w3.org/TR/ambient-light/">http://www.w3.org/TR/ambient-light/</a></dd>
+    
+    
+      <dt>Latest editor's draft:</dt>
+      <dd><a href="http://dvcs.w3.org/hg/dap/raw-file/tip/light/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/tip/light/Overview.html</a></dd>
+    
+    
+    
+    
+    
+    
+    <dt>Editor:</dt>
+    <dd><span>Doug Turner</span>, <a href="http://mozilla.com/">Mozilla Corporation</a></dd>
+
+    
+  </dl>
+  
+  
+  
+  
+    
+      <p class="copyright">
+        <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 
+        2012
+        
+        <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> 
+        (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
+        <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
+        <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
+        <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+        <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
+        <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+      </p>
+    
+  
+  <hr>
+</div>
+    <section class="introductory" id="abstract"><h2>Abstract</h2><p>
+      This specification defines a means to receive events that correspond to
+      a light sensor detecting the presence of a light.
+    </p></section><section id="sotd" class="introductory"><h2>Status of This Document</h2>
+  
+    
+      
+        <p>
+          <em>This section describes the status of this document at the time of its publication. Other
+          documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision
+          of this technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports
+          index</a> at http://www.w3.org/TR/.</em>
+        </p>
+        
+      <p>
+        The functionality described in this specification was initially
+        specified as part of the
+        <a href="http://dvcs.w3.org/hg/dap/raw-file/tip/sensor-api/Overview.html">
+        Sensor API</a> but has been extracted in order to be more
+        straightforward to implement, and in order to produce a specification
+        that could be implemented on its own merits without interference with
+        other features.
+      </p>
+    
+        <p>
+          This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs Working Group</a> as a First Public Working Draft.
+          
+            This document is intended to become a <abbr title="World Wide Web Consortium">W3C</abbr> Recommendation.
+          
+          If you wish to make comments regarding this document, please send them to 
+          <a href="mailto:public-device-apis@w3.org">public-device-apis@w3.org</a> 
+          (<a href="mailto:public-device-apis-request@w3.org?subject=subscribe">subscribe</a>,
+          <a href="http://lists.w3.org/Archives/Public/public-device-apis/">archives</a>).
+          
+          
+          All feedback is welcome.
+        </p>
+        
+          <p>
+            Publication as a Working Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr> Membership.
+            This is a draft document and may be updated, replaced or obsoleted by other documents at 
+            any time. It is inappropriate to cite this document as other than work in progress.
+          </p>
+        
+        
+        <p>
+          
+            This document was produced by a group operating under the 
+            <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
+          
+          
+          
+            
+              <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/43696/status" rel="disclosure">public list of any patent disclosures</a> 
+            
+            made in connection with the deliverables of the group; that page also includes instructions for 
+            disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains
+            <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the
+            information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
+            6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
+          
+          
+        </p>
+        
+      
+    
+  
+</section><section id="toc"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a class="tocxref" href="#introduction"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a class="tocxref" href="#conformance"><span class="secno">2. </span>Conformance</a></li><li class="tocline"><a class="tocxref" href="#terminology"><span class="secno">3. </span>Terminology</a></li><li class="tocline"><a class="tocxref" href="#security-and-privacy-considerations"><span class="secno">4. </span>Security and privacy considerations</a></li><li class="tocline"><a class="tocxref" href="#device-light"><span class="secno">5. </span>Device light</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes"><span class="secno">5.1 </span>Attributes</a></li><li class="tocline"><a class="tocxref" href="#devicelightevent-interface"><span class="secno">5.2 </span><span class="formerLink"><code>DeviceLightEvent</code></span> Interface</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes-1"><span class="secno">5.2.1 </span>Attributes</a></li><li class="tocline"><a class="tocxref" href="#dictionary-devicelighteventinit-members"><span class="secno">5.2.2 </span>Dictionary <span class="formerLink"><code>DeviceLightEventInit</code></span> Members</a></li><li class="tocline"><a class="tocxref" href="#event-handlers"><span class="secno">5.2.3 </span>Event handlers</a></li></ul></li></ul></li><li class="tocline"><a class="tocxref" href="#acknowledgements"><span class="secno">A. </span>Acknowledgements</a></li><li class="tocline"><a class="tocxref" href="#references"><span class="secno">B. </span>References</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#normative-references"><span class="secno">B.1 </span>Normative references</a></li><li class="tocline"><a class="tocxref" href="#informative-references"><span class="secno">B.2 </span>Informative references</a></li></ul></li></ul></section>
+    
+    
+    
+    <section id="introduction" class="informative">
+      <!--OddPage--><h2><span class="secno">1. </span>Introduction</h2><p><em>This section is non-normative.</em></p>
+      <p>
+        The <a class="idlType" href="#idl-def-DeviceLightEvent"><code>DeviceLightEvent</code></a> interface provides web developers
+        information about the ambient light levels near the hosting.
+      </p>
+      <p>
+        This is achieved by interrogating a photosensors or similar detectors
+        of a device.
+      </p>
+    </section>
+    
+    <section id="conformance"><!--OddPage--><h2><span class="secno">2. </span>Conformance</h2>
+<p>
+  As well as sections marked as non-normative, all authoring guidelines, diagrams, examples,
+  and notes in this specification are non-normative. Everything else in this specification is
+  normative.
+</p>
+<p>
+  The key words <em title="must" class="rfc2119">must</em>, <em title="must not" class="rfc2119">must not</em>, <em title="required" class="rfc2119">required</em>, <em title="should" class="rfc2119">should</em>, <em title="should not" class="rfc2119">should not</em>, <em title="recommended" class="rfc2119">recommended</em>, <em title="may" class="rfc2119">may</em>,
+  and <em title="optional" class="rfc2119">optional</em> in this specification are to be interpreted as described in [<cite><a href="#bib-RFC2119" class="bibref">RFC2119</a></cite>].
+</p>
+
+      <p>
+        This specification defines conformance criteria that apply to a single
+        product: the <dfn id="dfn-user-agent">user agent</dfn> that implements the
+        interfaces that it contains.
+      </p>
+    </section>
+    
+    <section id="terminology">
+      <!--OddPage--><h2><span class="secno">3. </span>Terminology</h2>
+      <p>
+        The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#eventhandler">
+        EventHandler</a></code> interface represents a <a href="http://www.w3.org/TR/WebIDL/#idl-callback-functions">callback function</a> used for <a href="http://dev.w3.org/html5/spec/webappapis.html#event-handlers">event
+      handlers</a> as defined in [<cite><a href="#bib-HTML5" class="bibref">HTML5</a></cite>]. </p>
+      <p>
+        The concepts <dfn id="dfn-queue-a-task"><a href="http://dev.w3.org/html5/spec/webappapis.html#queue-a-task">
+        queue a task</a></dfn> and
+        <dfn id="dfn-fires-a-simple-event"><a href="http://dev.w3.org/html5/spec/webappapis.html#fire-a-simple-event">
+        fires a simple event</a></dfn> are defined in [<cite><a href="#bib-HTML5" class="bibref">HTML5</a></cite>].
+      </p>
+      <p>
+        The terms <dfn id="dfn-event-handlers"><a href="http://dev.w3.org/html5/spec/webappapis.html#event-handlers">
+        event handlers</a></dfn> and
+        <dfn id="dfn-event-handler-event-types"><a href="http://dev.w3.org/html5/spec/webappapis.html#event-handler-event-type">
+        event handler event types</a></dfn> are defined in [<cite><a href="#bib-HTML5" class="bibref">HTML5</a></cite>].
+      </p>
+      <p>The concepts <dfn id="dfn-create-an-event">
+      <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#constructing-events">
+      create an event</a></dfn> and <dfn id="dfn-fire-an-event">
+      <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#firing-events">
+      fire an event</a></dfn> are defined in [<cite><a href="#bib-DOM4" class="bibref">DOM4</a></cite>].
+      </p><p>
+        The <dfn id="dfn-value-device-light">value device light</dfn> is a value that represents the
+        ambient light levels around the hosting device in lux units.
+      </p>
+    </section>
+    
+    <section id="security-and-privacy-considerations">
+      <!--OddPage--><h2><span class="secno">4. </span>Security and privacy considerations</h2>
+      <p>
+      </p>
+    </section>
+    
+    <section id="device-light">
+      <!--OddPage--><h2><span class="secno">5. </span>Device light</h2>
+      <p>
+        The HTML5 specification [<cite><a href="#bib-HTML5" class="bibref">HTML5</a></cite>] defines a <a class="idlType" href="#idl-def-Window"><code>Window</code></a> interface,
+        which this specification extends:
+      </p>
+      <pre class="idl"><span class="idlInterface" id="idl-def-Window">partial interface <span class="idlInterfaceID">Window</span> {
+<span class="idlAttribute">             attribute <span class="idlAttrType"><a>EventHandler</a></span> <span class="idlAttrName"><a href="#widl-Window-ondevicelight">ondevicelight</a></span>;</span>
+};</span></pre><section id="attributes"><h3><span class="secno">5.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-Window-ondevicelight"><code>ondevicelight</code> of type <span class="idlAttrType"><a>EventHandler</a></span></dt><dd>
+        </dd></dl></section>
+      <p>
+        The <code>ondevicelight</code> event handler and its corresponding
+        event handler event type <code>devicelight</code> <em title="must" class="rfc2119">must</em> be supported
+        as an IDL attribute by all objects implementing the <a class="idlType" href="#idl-def-Window"><code>Window</code></a>
+        interface.
+      </p>
+      <section id="devicelightevent-interface">
+        <h3><span class="secno">5.2 </span><a class="idlType" href="#idl-def-DeviceLightEvent"><code>DeviceLightEvent</code></a> Interface</h3>
+        <pre class="idl"><span class="idlInterface" id="idl-def-DeviceLightEvent">[<span class="extAttr">Constructor (DOMString type, optional DeviceLightEventInit eventInitDict)</span>]
+interface <span class="idlInterfaceID">DeviceLightEvent</span> : <span class="idlSuperclass"><a>Event</a></span> {
+<span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>double</a></span> <span class="idlAttrName"><a href="#widl-DeviceLightEvent-value">value</a></span>;</span>
+};<br><span class="idlDictionary" id="idl-def-DeviceLightEventInit">dictionary <span class="idlDictionaryID">DeviceLightEventInit</span> : <span class="idlSuperclass"><a>EventInit</a></span> {
+<span class="idlMember">    <span class="idlMemberType"><a>double</a></span> <span class="idlMemberName"><a href="#widl-DeviceLightEventInit-value">value</a></span>;</span>
+};</span></span></pre><section id="attributes-1"><h4><span class="secno">5.2.1 </span>Attributes</h4><dl class="attributes"><dt id="widl-DeviceLightEvent-value"><code>value</code> of type <span class="idlAttrType"><a>double</a></span>, readonly</dt><dd>
+            The <a>ambient light level in lux</a>.
+          </dd></dl></section>
+        <section id="dictionary-devicelighteventinit-members"><h4><span class="secno">5.2.2 </span>Dictionary <a href="#idl-def-DeviceLightEventInit" class="idlType"><code>DeviceLightEventInit</code></a> Members</h4><dl class="dictionary-members"><dt id="widl-DeviceLightEventInit-value"><code>value</code> of type <span class="idlMemberType"><a>double</a></span></dt><dd></dd></dl></section>
+        <p>
+          When a <dfn id="dfn-user-agent-1">user agent</dfn> is required to <dfn id="dfn-fire-a-device-light-event">fire a device
+          light event</dfn>, the <dfn id="dfn-user-agent-2">user agent</dfn> <em title="must" class="rfc2119">must</em> run the
+          following steps:
+        </p>
+        <ol class="rule">
+          <li>
+            <a>Create an event</a> that uses the <a class="idlType" href="#idl-def-DeviceLightEvent"><code>DeviceLightEvent</code></a>
+            interface, with the name <code>devicelight</code>, which
+            bubbles, is not cancelable, and has no default action, that also
+            meets the following conditions:
+            <ol>
+              <li>
+                If the implementation is unable to report the <a>current
+                device light</a>, initialize the <code>value</code>
+                attribute to positive Infinity, otherwise initialize the
+                attribute to the <a>current device light</a>.
+              </li>
+            </ol>
+          </li>
+          <li>
+            <a>Queue a task</a> to dispatch the newly created event at the
+            <a class="idlType" href="#idl-def-Window"><code>Window</code></a> object.
+          </li>
+        </ol>
+        <p>
+          When <a>the current light</a> changes, the <a class="internalDFN" href="#dfn-user-agent-2">user
+          agent</a> <em title="must" class="rfc2119">must</em> <a class="internalDFN" href="#dfn-fire-a-device-light-event">fire a device light event</a>.
+        </p>
+        <div class="note"><div class="note-title"><span>Note</span></div><div class="">
+          The definition of granularity i.e. how often the event is fired is
+          left to the implementation. Implementations may fire the event if
+          they have reason to believe that the page does not have sufficiently
+          fresh data.
+        </div></div>
+        <section id="event-handlers">
+          <h4><span class="secno">5.2.3 </span>Event handlers</h4>
+          <p>
+            The following are the <a class="internalDFN" href="#dfn-event-handlers">event handlers</a> (and their corresponding
+            <a class="internalDFN" href="#dfn-event-handler-event-types">event handler event types</a>) that <em title="must" class="rfc2119">must</em> be supported as
+            attributes by the <code>Window</code> object:
+          </p>
+          <table class="simple">
+            <thead>
+              <tr>
+                <th>event handler</th>
+                <th>event handler event type</th>
+              </tr>
+            </thead>
+            <tbody>
+              <tr>
+                <td><strong><code>ondevicelight</code></strong></td>
+                <td><code>devicelight</code></td>
+              </tr>
+            </tbody>
+          </table>
+        </section>
+      </section>
+    </section>
+      
+    <section id="acknowledgements" class="appendix">
+      <!--OddPage--><h2><span class="secno">A. </span>Acknowledgements</h2>
+      <p>
+        Doug Turner for the <a href="http://dougturner.wordpress.com/2012/03/26/device-light-sensor/">initial prototype</a> and
+        Marcos Caceres for the test suite.
+      </p>
+    </section>
+  
+
+<section class="appendix" id="references"><!--OddPage--><h2><span class="secno">B. </span>References</h2><section id="normative-references"><h3><span class="secno">B.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-DOM4">[DOM4]</dt><dd>Anne van Kesteren; Aryeh Gregor; Ms2ger. <a href="http://www.w3.org/TR/dom/"><cite>DOM4.</cite></a> 5 April 2012. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/dom/">http://www.w3.org/TR/dom/</a> 
+</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Ian Hickson; David Hyatt. <a href="http://www.w3.org/TR/html5"><cite>HTML5.</cite></a> 25 May 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/html5">http://www.w3.org/TR/html5</a> 
+</dd><dt id="bib-RFC2119">[RFC2119]</dt><dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in RFCs to Indicate Requirement Levels.</cite></a> March 1997. Internet RFC 2119.  URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a> 
+</dd></dl></section><section id="informative-references"><h3><span class="secno">B.2 </span>Informative references</h3><p>No informative references.</p></section></section></body></html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/light/Overview.html	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,202 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Ambient Light Events</title>
+    <meta charset="utf-8"/>
+    <script src='http://www.w3.org/Tools/respec/respec-w3c-common' class='remove' async></script>
+    <script class="remove">
+      var respecConfig = {
+          specStatus:           "ED",
+          shortName:            "ambient-light",
+          //publishDate:          "yyyy-mm-dd",
+          //previousPublishDate:  "yyyy-mm-dd",
+          // previousMaturity:     "ED",
+          edDraftURI:           "http://dvcs.w3.org/hg/dap/raw-file/tip/light/Overview.html",
+          //lcEnd:                "yyyy-mm-dd",
+          editors:  [
+              { name: "Doug Turner", company: "Mozilla Corporation", companyURL: "http://mozilla.com/" }
+          ],
+          // inlineCSS:    true,
+          noIDLIn:      true,
+          wg:           "Device APIs Working Group",
+          wgURI:        "http://www.w3.org/2009/dap/",
+          wgPublicList: "public-device-apis",
+          wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/43696/status",
+      };
+    </script>
+  </head>
+  <body>
+    <section id="abstract">
+      This specification defines a means to receive events that correspond to
+      a light sensor detecting the presence of a light.
+    </section>
+    
+    <section id="sotd">
+      <p>
+        The functionality described in this specification was initially
+        specified as part of the
+        <a href="http://dvcs.w3.org/hg/dap/raw-file/tip/sensor-api/Overview.html">
+        Sensor API</a> but has been extracted in order to be more
+        straightforward to implement, and in order to produce a specification
+        that could be implemented on its own merits without interference with
+        other features.
+      </p>
+    </section>
+    
+    <section class="informative">
+      <h2>Introduction</h2>
+      <p>
+        The <a>DeviceLightEvent</a> interface provides web developers
+        information about the ambient light levels near the hosting.
+      </p>
+      <p>
+        This is achieved by interrogating a photosensors or similar detectors
+        of a device.
+      </p>
+    </section>
+    
+    <section id="conformance">
+      <p>
+        This specification defines conformance criteria that apply to a single
+        product: the <dfn>user agent</dfn> that implements the
+        interfaces that it contains.
+      </p>
+    </section>
+    
+    <section>
+      <h2>Terminology</h2>
+      <p>
+        The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#eventhandler">
+        EventHandler</a></code> interface represents a <a href="http://www.w3.org/TR/WebIDL/#idl-callback-functions">callback function</a> used for <a href="http://dev.w3.org/html5/spec/webappapis.html#event-handlers">event
+      handlers</a> as defined in [[!HTML5]]. </p>
+      <p>
+        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]].
+      </p>
+      <p>
+        The terms <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#event-handlers">
+        event handlers</a></dfn> and
+        <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 <dfn>
+      <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#constructing-events">
+      create an event</a></dfn> and <dfn>
+      <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#firing-events">
+      fire an event</a></dfn> are defined in [[!DOM4]].
+      <p>
+        The <dfn>value device light</dfn> is a value that represents the
+        ambient light levels around the hosting device in lux units.
+      </p>
+    </section>
+    
+    <section>
+      <h2>Security and privacy considerations</h2>
+      <p>
+      </p>
+    </section>
+    
+    <section>
+      <h2>Device light</h2>
+      <p>
+        The HTML5 specification [[!HTML5]] defines a <a>Window</a> interface,
+        which this specification extends:
+      </p>
+      <dl title="partial interface Window" class="idl">
+        <dt>attribute EventHandler ondevicelight</dt>
+        <dd>
+        </dd>
+      </dl>
+      <p>
+        The <code>ondevicelight</code> event handler and its corresponding
+        event handler event type <code>devicelight</code> MUST be supported
+        as an IDL attribute by all objects implementing the <a>Window</a>
+        interface.
+      </p>
+      <section>
+        <h2><a>DeviceLightEvent</a> Interface</h2>
+        <dl title="[Constructor (DOMString type, optional DeviceLightEventInit eventInitDict)]
+                   interface DeviceLightEvent : Event"
+            class="idl" data-merge='DeviceLightEventInit'>
+          <dt>readonly attribute double value</dt>
+          <dd>
+            The <a>ambient light level in lux</a>.
+          </dd>
+        </dl>
+        <dl title="dictionary DeviceLightEventInit : EventInit" class='idl'>
+          <dt>
+            double value
+          </dt>
+          <dd></dd>
+        </dl>
+        <p>
+          When a <dfn>user agent</dfn> is required to <dfn>fire a device
+          light event</dfn>, the <dfn>user agent</dfn> MUST run the
+          following steps:
+        </p>
+        <ol class="rule">
+          <li>
+            <a>Create an event</a> that uses the <a>DeviceLightEvent</a>
+            interface, with the name <code>devicelight</code>, which
+            bubbles, is not cancelable, and has no default action, that also
+            meets the following conditions:
+            <ol>
+              <li>
+                If the implementation is unable to report the <a>current
+                device light</a>, initialize the <code>value</code>
+                attribute to positive Infinity, otherwise initialize the
+                attribute to the <a>current device light</a>.
+              </li>
+            </ol>
+          </li>
+          <li>
+            <a>Queue a task</a> to dispatch the newly created event at the
+            <a>Window</a> object.
+          </li>
+        </ol>
+        <p>
+          When <a>the current light</a> changes, the <a>user
+          agent</a> MUST <a>fire a device light event</a>.
+        </p>
+        <div class="note">
+          The definition of granularity i.e. how often the event is fired is
+          left to the implementation. Implementations may fire the event if
+          they have reason to believe that the page does not have sufficiently
+          fresh data.
+        </div>
+        <section>
+          <h2>Event handlers</h2>
+          <p>
+            The following are the <a>event handlers</a> (and their corresponding
+            <a>event handler event types</a>) that MUST be supported as
+            attributes by the <code>Window</code> object:
+          </p>
+          <table class="simple">
+            <thead>
+              <tr>
+                <th>event handler</th>
+                <th>event handler event type</th>
+              </tr>
+            </thead>
+            <tbody>
+              <tr>
+                <td><strong><code>ondevicelight</code></strong></td>
+                <td><code>devicelight</code></td>
+              </tr>
+            </tbody>
+          </table>
+        </section>
+      </section>
+    </section>
+      
+    <section class="appendix">
+      <h2>Acknowledgements</h2>
+      <p>
+        Doug Turner for the <a href="http://dougturner.wordpress.com/2012/03/26/device-light-sensor/">initial prototype</a> and
+        Marcos Caceres for the test suite.
+      </p>
+    </section>
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/light/tests/submissions/marcosc/DeviceLight_tests.js	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,337 @@
+/**
+ * W3C 3-clause BSD License
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * o Redistributions of works must retain the original copyright notice,
+ *     this list of conditions and the following disclaimer.
+ *
+ * o Redistributions in binary form must reproduce the original copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * o Neither the name of the W3C nor the names of its contributors may be
+ *     used to endorse or promote products derived from this work without
+ *     specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ **/
+
+ (function() {
+  //inheritance tests
+  test(function() {
+    var event = new DeviceLightEvent('');
+    assert_true(event instanceof window.DeviceLightEvent);
+  }, 'the event is an instance of DeviceLightEvent');
+
+  test(function() {
+    var event = new DeviceLightEvent('');
+    assert_true(event instanceof window.Event);
+  }, 'the event inherits from Event');
+
+  //Type attribute tests
+  test(function() {
+    assert_throws(null, function() {
+      new DeviceLightEvent();
+    }, 'First argument is required, so was expecting a TypeError.');
+  }, 'Missing type argument');
+
+  test(function() {
+    var event = new DeviceLightEvent(undefined);
+    assert_equals(event.type, 'undefined');
+  }, 'Event type set to undefined');
+
+  test(function() {
+    var event = new DeviceLightEvent(null);
+    assert_equals(event.type, 'null');
+  }, 'type argument is null');
+
+  test(function() {
+    var event = new DeviceLightEvent(123);
+    assert_equals(event.type, '123');
+  }, 'type argument is number');
+
+  test(function() {
+    var event = new DeviceLightEvent(new Number(123));
+    assert_equals(event.type, '123');
+  }, 'type argument is Number');
+
+  test(function() {
+    var event = new DeviceLightEvent([]);
+    assert_equals(event.type, '');
+  }, 'type argument is array');
+
+  test(function() {
+    var event = new DeviceLightEvent(new Array());
+    assert_equals(event.type, '');
+  }, 'type argument is instance of Array');
+
+  test(function() {
+    var event = new DeviceLightEvent(['t', ['e', ['s', ['t']]]]);
+    assert_equals(event.type, 't,e,s,t');
+  }, 'type argument is nested array');
+
+  test(function() {
+    var event = new DeviceLightEvent(Math);
+    assert_equals(event.type, '[object Math]');
+  }, 'type argument is host object');
+
+  test(function() {
+    var event = new DeviceLightEvent(true);
+    assert_equals(event.type, 'true');
+  }, 'type argument is boolean (true)');
+
+  test(function() {
+    var event = new DeviceLightEvent(new Boolean(true));
+    assert_equals(event.type, 'true');
+  }, 'type argument is instance of boolean');
+
+  test(function() {
+    var event = new DeviceLightEvent(false);
+    assert_equals(event.type, 'false');
+  }, 'type argument is boolean (false)');
+
+  test(function() {
+    var event = new DeviceLightEvent(new Boolean(false));
+    assert_equals(event.type, 'false');
+  }, '');
+
+  test(function() {
+    var event = new DeviceLightEvent('test');
+    assert_equals(event.type, 'test');
+  }, 'type argument is instance of boolean (false)');
+
+  test(function() {
+    var event = new DeviceLightEvent(new String('test'));
+    assert_equals(event.type, 'test');
+  }, 'type argument is string');
+
+  test(function() {
+    var event = new DeviceLightEvent(function test() {});
+    assert_regexp_match(event.type, /function test.+{\s?}/);
+  }, 'type argument is function');
+
+  test(function() {
+    var event = new DeviceLightEvent({
+      toString: function() {
+        return '123';
+      }
+    });
+    assert_equals(event.type, '123');
+  }, 'type argument is complext object, with toString method');
+
+  test(function() {
+    assert_throws(null, function() {
+      new DeviceLightEvent({
+        toString: function() {
+          return function() {}
+        }
+      });
+    });
+  }, 'toString is of type function');
+
+  //test readonly attribute double value;
+  test(function() {
+    var event = new DeviceLightEvent('test');
+    assert_readonly(event, 'value', 'readonly attribute value');
+  }, 'value is readonly');
+
+  test(function() {
+    var event = new DeviceLightEvent('test', {
+      value: false
+    });
+    assert_equals(event.value, 0, 'value set to false, converts to 0.');
+  }, 'value set to false');
+
+  test(function() {
+    var event = new DeviceLightEvent('test', {
+      value: true
+    });
+    assert_equals(event.value, 1, 'value set to true, converts to 1.');
+  }, 'value set to true');
+
+
+  test(function() {
+    var prop = {
+      value: undefined
+    };
+    assert_throws(null, function() {
+      new DeviceLightEvent('test', prop);
+    }, 'value of undefined resolves to NaN, expected type error.');
+  }, 'value of undefined resolves to NaN, expected type error.');
+
+  test(function() {
+    var event = new DeviceLightEvent('test', {
+      value: null
+    });
+    assert_equals(event.value, 0, 'value resolves to 0');
+  }, 'value resolves to 0');
+
+
+  test(function() {
+    var event = new DeviceLightEvent('test', {
+      value: ''
+    });
+    assert_equals(event.value, 0, 'value must resolve to 0');
+  }, 'value must resolve to 0');
+
+  test(function() {
+    var event = new DeviceLightEvent('test', {
+      value: '\u0020'
+    });
+    assert_equals(event.value, 0, 'value must resolve to 0');
+  }, 'value must resolve to 0');
+
+  test(function() {
+    var event = new DeviceLightEvent('test', {
+      value: '\u0020\u0020\u0020\u0020\u0020\u0020'
+    });
+    assert_equals(event.value, 0, 'value must resolve to 0');
+  }, 'value must resolve to 0');
+
+  test(function() {
+    var event = new DeviceLightEvent('test', {
+      value: '\u0020\u0020\u00201234\u0020\u0020\u0020'
+    });
+    assert_equals(event.value, 1234, 'converts to 1234');
+  }, 'converts to 1234');
+
+  test(function() {
+    var event = new DeviceLightEvent('test', {
+      value: []
+    });
+    assert_equals(event.value, 0, 'converts to 0');
+  }, 'converts to 0');
+
+
+  test(function() {
+    var prop = {
+      value: {}
+    };
+    assert_throws(null, function() {
+      new DeviceLightEvent('test', prop);
+    }, 'value of {} resolves to NaN');
+  }, 'value of {} resolves to NaN, expected type error');
+
+  test(function() {
+    var prop = {
+      get value() {
+        return NaN;
+      }
+    };
+    assert_throws(null, function() {
+      new DeviceLightEvent('test', prop);
+    }, 'value resolves to NaN');
+  }, 'value resolves to NaN, expected type error');
+
+  test(function() {
+    var prop = {
+      get value() {
+        return '123';
+      }
+    };
+    var event = new DeviceLightEvent('test', prop);
+    assert_equals(event.value, 123, 'converts to 123');
+  }, 'value resolves 123');
+
+  test(function() {
+    var desc = 'Expected to find ondevicelight attribute on window object';
+    assert_idl_attribute(window, 'ondevicelight', desc);
+  }, 'ondevicelight event hander attr must be on window object.');
+
+  test(function() {
+    var desc = 'window.ondevicelight must be null';
+    assert_equals(window.ondevicelight, null, desc);
+  }, 'ondevicelight is null');
+
+  test(function() {
+    var desc = 'window.ondevicelight did not accept callable object',
+      func = function() {},
+      desc = 'Expected to find ondevicelight attribute on window object';
+    assert_idl_attribute(window, 'ondevicelight', desc);
+    window.ondevicelight = func;
+    assert_equals(window.ondevicelight, func, desc);
+  }, 'expected ondevicelight on window and to be set to function');
+
+  test(function() {
+    var desc = 'window.ondevicelight did not treat noncallable as null';
+    window.ondevicelight = function() {};
+    window.ondevicelight = {};
+    assert_equals(window.ondevicelight, null, desc);
+  }, 'treat object as null');
+
+  test(function() {
+    var desc = 'window.ondevicelight did not treat noncallable as null';
+    window.ondevicelight = function() {};
+    window.ondevicelight = {
+      call: 'test'
+    };
+    assert_equals(window.ondevicelight, null, desc);
+  }, 'treat object with non-callable call property as null');
+
+  test(function() {
+    var desc = 'window.ondevicelight did not treat noncallable (string) as null';
+    window.ondevicelight = function() {};
+    window.ondevicelight = 'string';
+    assert_equals(window.ondevicelight, null, desc);
+  }, 'treat string as null');
+
+  test(function() {
+    var desc = 'window.ondevicelight did not treat noncallable (number) as null';
+    window.ondevicelight = function() {};
+    window.ondevicelight = 123;
+    assert_equals(window.ondevicelight, null, desc);
+  }, 'treat number as null');
+
+  test(function() {
+    var desc = 'window.ondevicelight did not treat noncallable (undefined) as null';
+    window.ondevicelight = function() {};
+    window.ondevicelight = undefined;
+    assert_equals(window.ondevicelight, null, desc);
+  }, 'treat undefined as null');
+
+  test(function() {
+    var desc = 'window.ondevicelight did not treat noncallable (array) as null';
+    window.ondevicelight = function() {};
+    window.ondevicelight = [];
+    assert_equals(window.ondevicelight, null, desc);
+  }, 'treat array as null');
+
+  test(function() {
+    var desc = 'window.ondevicelight did not treat noncallable host object as null';
+    window.ondevicelight = function() {};
+    window.ondevicelight = window.Node;
+    assert_equals(window.ondevicelight, null, desc);
+  }, 'treat non-callable host object as null');
+
+  //Async tests
+  var t = async_test('test if DeviceLightEvent recieved');
+  window.addEventListener('devicelight', function(e) {
+    t.step(function() {
+      var msg = 'expected instance of DeviceLightEvent: ';
+      assert_true(e instanceof window.DeviceLightEvent, msg);
+      assert_idl_attribute(e, 'value', 'event has value property');
+    });
+    t.done();
+  });
+
+  var t2 = async_test('test if DeviceLightEvent recieved');
+  window.ondevicelight = function(e) {
+    t2.step(function() {
+      var msg = 'expected instance of DeviceLightEvent: ';
+      assert_true(e instanceof window.DeviceLightEvent, msg);
+      assert_idl_attribute(e, 'value', 'event has value property');
+    });
+    t2.done();
+  };
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/light/tests/submissions/marcosc/index.html	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,11 @@
+<!doctype html>
+<meta charset=utf8>
+<meta content="width=device-width, initial-scale=1" name=viewport>
+<meta>
+<title>Light Events Test Suite</title> 
+<h1>Test Suite for Light Events</h1>
+<div id="log"></div>
+<hr>
+<p><small>Distributed under both the <a href="http://www.w3.org/Consortium/Legal/2008/04-testsuite-license">W3C Test Suite License</a> and the <a href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license">W3C 3-clause BSD License</a>. To contribute to a W3C Test Suite, see the <a href="http://www.w3.org/2004/10/27-testcases">policies and contribution forms</a>.</small></p>
+<script src="http://www.w3c-test.org/resources/testharness.js"></script>
+<script src="DeviceLight_tests.js"></script>
\ No newline at end of file
--- a/media-stream-capture/scenarios.html	Fri Aug 24 23:36:10 2012 +0300
+++ b/media-stream-capture/scenarios.html	Sat Aug 25 00:52:13 2012 +0300
@@ -3,11 +3,10 @@
   <head>
     <title>MediaStream Capture Scenarios</title>
     <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
-    <script type="text/javascript" src='http://dev.w3.org/2009/dap/ReSpec.js/js/respec.js' class='remove'></script>
-    <script type="text/javascript" src='http://dev.w3.org/2009/dap/ReSpec.js/js/sh_main.min.js' class='remove'></script>
+    <script type="text/javascript" src='http://darobin.github.com/respec/builds/respec-w3c-common.js' class='remove'></script>
     <script type="text/javascript" class='remove'>
             var respecConfig = {
-                  specStatus: "FPWD",
+                  specStatus: "ED",
                   editors: [{
                             name: "Travis Leithead", 
                             company: "Microsoft Corp.",
@@ -15,7 +14,8 @@
                             companyURL: "http://www.microsoft.com"}],
                   publishDate:  "2012-08-24",
                   edDraftURI:   "http://dvcs.w3.org/hg/dap/raw-file/tip/media-stream-capture/scenarios.html",
-                  previousPublishDate:  null,
+                  previousPublishDate: null,
+                  prevED: "http://dvcs.w3.org/hg/dap/raw-file/a8e255b904df/media-stream-capture/scenarios.html",
                   noIDLIn:  true,
                   inlineCSS:  true,
                   noRecTrack:  true,
--- a/network-api/Overview.html	Fri Aug 24 23:36:10 2012 +0300
+++ b/network-api/Overview.html	Sat Aug 25 00:52:13 2012 +0300
@@ -3,11 +3,7 @@
   <head>
     <title>The Network Information API</title>
     <meta http-equiv='Content-Type' content='text/html;charset=utf-8' />
-
-<!--
-    <script src='../ReSpec.js/js/respec.js' class='remove'></script>
--->
-    <script src='http://respec.specifiction.com/js/profiles/w3c-common.js' class='remove'></script>
+    <script src='http://www.w3.org/Tools/respec/respec-w3c-common' class='remove'></script>
     <script class='remove'>
       var respecConfig = {
           specStatus:           "ED",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/proximity/FPWD.html	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,801 @@
+<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
+<html lang="en" dir="ltr">
+<head>
+    <title>Proximity Events</title>
+    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+    
+    <!--script src='http://dev.w3.org/2009/dap/ReSpec.js/js/respec.js' class='remove'></script-->
+    
+  <style type="text/css">/*****************************************************************
+ * ReSpec 3 CSS
+ * Robin Berjon - http://berjon.com/
+ *****************************************************************/
+
+/* --- INLINES --- */
+em.rfc2119 { 
+    text-transform:     lowercase;
+    font-variant:       small-caps;
+    font-style:         normal;
+    color:              #900;
+}
+
+h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
+h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
+    border: none;
+}
+
+dfn {
+    font-weight:    bold;
+}
+
+a.internalDFN {
+    color:  inherit;
+    border-bottom:  1px solid #99c;
+    text-decoration:    none;
+}
+
+a.externalDFN {
+    color:  inherit;
+    border-bottom:  1px dotted #ccc;
+    text-decoration:    none;
+}
+
+a.bibref {
+    text-decoration:    none;
+}
+
+cite .bibref {
+    font-style: normal;
+}
+
+code {
+    color:  #ff4500;
+}
+
+
+/* --- --- */
+ol.algorithm { counter-reset:numsection; list-style-type: none; }
+ol.algorithm li { margin: 0.5em 0; }
+ol.algorithm li:before { font-weight: bold; counter-increment: numsection; content: counters(numsection, ".") ") "; }
+
+/* --- TOC --- */
+.toc a, .tof a {
+    text-decoration:    none;
+}
+
+a .secno, a .figno {
+    color:  #000;
+}
+
+ul.tof, ol.tof {
+    list-style: none outside none;
+}
+
+.caption {
+    margin-top: 0.5em;
+    font-style:   italic;
+}
+
+/* --- TABLE --- */
+table.simple {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    border-bottom:  3px solid #005a9c;
+}
+
+.simple th {
+    background: #005a9c;
+    color:  #fff;
+    padding:    3px 5px;
+    text-align: left;
+}
+
+.simple th[scope="row"] {
+    background: inherit;
+    color:  inherit;
+    border-top: 1px solid #ddd;
+}
+
+.simple td {
+    padding:    3px 10px;
+    border-top: 1px solid #ddd;
+}
+
+.simple tr:nth-child(even) {
+    background: #f0f6ff;
+}
+
+/* --- DL --- */
+.section dd > p:first-child {
+    margin-top: 0;
+}
+
+.section dd > p:last-child {
+    margin-bottom: 0;
+}
+
+.section dd {
+    margin-bottom:  1em;
+}
+
+.section dl.attrs dd, .section dl.eldef dd {
+    margin-bottom:  0;
+}
+</style><style type="text/css">/* --- ISSUES/NOTES --- */
+div.issue-title, div.note-title {
+    padding-right:  1em;
+    min-width: 7.5em;
+    color: #b9ab2d;
+}
+div.issue-title { color: #e05252; }
+div.note-title { color: #52e052; }
+div.issue-title span, div.note-title span {
+    text-transform: uppercase;
+}
+div.note, div.issue {
+    margin-top: 1em;
+    margin-bottom: 1em;
+}
+.note > p:first-child, .issue > p:first-child { margin-top: 0 }
+.issue, .note {
+    padding: .5em;
+    border-left-width: .5em;
+    border-left-style: solid;
+}
+div.issue, div.note {
+    padding: 0.5em;
+    margin: 1em 0;
+    position: relative;
+    clear: both;
+}
+span.note, span.issue { padding: .1em .5em .15em; }
+
+.issue {
+    border-color: #e05252;
+    background: #fbe9e9;
+}
+.note {
+    border-color: #52e052;
+    background: #e9fbe9;
+}
+
+
+</style><style type="text/css">/* --- WEB IDL --- */
+pre.idl {
+    border-top: 1px solid #90b8de;
+    border-bottom: 1px solid #90b8de;
+    padding:    1em;
+    line-height:    120%;
+}
+
+pre.idl::before {
+    content:    "WebIDL";
+    display:    block;
+    width:      150px;
+    background: #90b8de;
+    color:  #fff;
+    font-family:    initial;
+    padding:    3px;
+    font-weight:    bold;
+    margin: -1em 0 1em -1em;
+}
+
+.idlType {
+    color:  #ff4500;
+    font-weight:    bold;
+    text-decoration:    none;
+}
+
+/*.idlModule*/
+/*.idlModuleID*/
+/*.idlInterface*/
+.idlInterfaceID, .idlDictionaryID, .idlCallbackID, .idlEnumID {
+    font-weight:    bold;
+    color:  #005a9c;
+}
+
+.idlSuperclass {
+    font-style: italic;
+    color:  #005a9c;
+}
+
+/*.idlAttribute*/
+.idlAttrType, .idlFieldType, .idlMemberType {
+    color:  #005a9c;
+}
+.idlAttrName, .idlFieldName, .idlMemberName {
+    color:  #ff4500;
+}
+.idlAttrName a, .idlFieldName a, .idlMemberName a {
+    color:  #ff4500;
+    border-bottom:  1px dotted #ff4500;
+    text-decoration: none;
+}
+
+/*.idlMethod*/
+.idlMethType, .idlCallbackType {
+    color:  #005a9c;
+}
+.idlMethName {
+    color:  #ff4500;
+}
+.idlMethName a {
+    color:  #ff4500;
+    border-bottom:  1px dotted #ff4500;
+    text-decoration: none;
+}
+
+/*.idlParam*/
+.idlParamType {
+    color:  #005a9c;
+}
+.idlParamName {
+    font-style: italic;
+}
+
+.extAttr {
+    color:  #666;
+}
+
+/*.idlConst*/
+.idlConstType {
+    color:  #005a9c;
+}
+.idlConstName {
+    color:  #ff4500;
+}
+.idlConstName a {
+    color:  #ff4500;
+    border-bottom:  1px dotted #ff4500;
+    text-decoration: none;
+}
+
+/*.idlException*/
+.idlExceptionID {
+    font-weight:    bold;
+    color:  #c00;
+}
+
+.idlTypedefID, .idlTypedefType {
+    color:  #005a9c;
+}
+
+.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
+    color:  #c00;
+    font-weight:    normal;
+}
+
+.excName a {
+    font-family:    monospace;
+}
+
+.idlRaises a.idlType, .excName a.idlType {
+    border-bottom:  1px dotted #c00;
+}
+
+.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
+    width:  45px;
+    text-align: center;
+}
+.excGetSetTrue, .prmNullTrue, .prmOptTrue { color:  #0c0; }
+.excGetSetFalse, .prmNullFalse, .prmOptFalse { color:  #c00; }
+
+.idlImplements a {
+    font-weight:    bold;
+}
+
+dl.attributes, dl.methods, dl.constants, dl.fields, dl.dictionary-members {
+    margin-left:    2em;
+}
+
+.attributes dt, .methods dt, .constants dt, .fields dt, .dictionary-members dt {
+    font-weight:    normal;
+}
+
+.attributes dt code, .methods dt code, .constants dt code, .fields dt code, .dictionary-members dt code {
+    font-weight:    bold;
+    color:  #000;
+    font-family:    monospace;
+}
+
+.attributes dt code, .fields dt code, .dictionary-members dt code {
+    background:  #ffffd2;
+}
+
+.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code {
+    color:  #005a9c;
+    background:  transparent;
+    font-family:    inherit;
+    font-weight:    normal;
+    font-style: italic;
+}
+
+.methods dt code {
+    background:  #d9e6f8;
+}
+
+.constants dt code {
+    background:  #ddffd2;
+}
+
+.attributes dd, .methods dd, .constants dd, .fields dd, .dictionary-members dd {
+    margin-bottom:  1em;
+}
+
+table.parameters, table.exceptions {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    margin: 0.5em 0;
+    width:  100%;
+}
+table.parameters { border-bottom:  1px solid #90b8de; }
+table.exceptions { border-bottom:  1px solid #deb890; }
+
+.parameters th, .exceptions th {
+    color:  #fff;
+    padding:    3px 5px;
+    text-align: left;
+    font-family:    initial;
+    font-weight:    normal;
+    text-shadow:    #666 1px 1px 0;
+}
+.parameters th { background: #90b8de; }
+.exceptions th { background: #deb890; }
+
+.parameters td, .exceptions td {
+    padding:    3px 10px;
+    border-top: 1px solid #ddd;
+    vertical-align: top;
+}
+
+.parameters tr:first-child td, .exceptions tr:first-child td {
+    border-top: none;
+}
+
+.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
+    width:  100px;
+}
+
+.parameters td.prmType {
+    width:  120px;
+}
+
+table.exceptions table {
+    border-spacing: 0;
+    border-collapse:    collapse;
+    width:  100%;
+}
+</style><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet"></head>
+  <body><div class="head">
+  <p>
+    
+      <a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72"></a>
+    
+  </p>
+  <h1 class="title" id="title">Proximity Events</h1>
+  
+  <h2 id="w3c-working-draft-12-july-2012"><abbr title="World Wide Web Consortium">W3C</abbr> Working Draft 12 July 2012</h2>
+  <dl>
+    
+      <dt>This version:</dt>
+      <dd><a href="http://www.w3.org/TR/2012/WD-proximity-20120712/">http://www.w3.org/TR/2012/WD-proximity-20120712/</a></dd>
+      <dt>Latest published version:</dt>
+      <dd><a href="http://www.w3.org/TR/proximity/">http://www.w3.org/TR/proximity/</a></dd>
+    
+    
+      <dt>Latest editor's draft:</dt>
+      <dd><a href="http://dvcs.w3.org/hg/dap/raw-file/tip/proximity/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/tip/proximity/Overview.html</a></dd>
+    
+    
+    
+    
+    
+    
+    <dt>Editors:</dt>
+    <dd><span>Anssi Kostiainen</span>, <a href="http://nokia.com/">Nokia</a></dd>
+<dd><span>Dzung D Tran</span>, <a href="http://intel.com/">Intel</a></dd>
+
+    
+  </dl>
+  
+  
+  
+  
+    
+      <p class="copyright">
+        <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 
+        2012
+        
+        <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> 
+        (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
+        <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
+        <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
+        <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
+        <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
+        <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
+      </p>
+    
+  
+  <hr>
+</div>
+    <div class="introductory section" id="abstract"><h2>Abstract</h2><p>
+      This specification defines a means to receive events that correspond to
+      a proximity sensor detecting the presence of a physical object.
+    </p></div><div id="sotd" class="introductory section"><h2>Status of This Document</h2>
+  
+    
+      
+        <p>
+          <em>This section describes the status of this document at the time of its publication. Other
+          documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision
+          of this technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports
+          index</a> at http://www.w3.org/TR/.</em>
+        </p>
+        
+      <p>
+        The functionality described in this specification was initially
+        specified as part of the
+        <a href="http://dvcs.w3.org/hg/dap/raw-file/tip/sensor-api/Overview.html">
+        Sensor API</a> but has been extracted in order to be more
+        straightforward to implement, and in order to produce a specification
+        that could be implemented on its own merits without interference with
+        other features.
+      </p>
+    
+        <p>
+          This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs Working Group</a> as a First Public Working Draft.
+          
+            This document is intended to become a <abbr title="World Wide Web Consortium">W3C</abbr> Recommendation.
+          
+          If you wish to make comments regarding this document, please send them to 
+          <a href="mailto:public-device-apis@w3.org">public-device-apis@w3.org</a> 
+          (<a href="mailto:public-device-apis-request@w3.org?subject=subscribe">subscribe</a>,
+          <a href="http://lists.w3.org/Archives/Public/public-device-apis/">archives</a>).
+          
+          
+          All feedback is welcome.
+        </p>
+        
+          <p>
+            Publication as a Working Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr> Membership.
+            This is a draft document and may be updated, replaced or obsoleted by other documents at 
+            any time. It is inappropriate to cite this document as other than work in progress.
+          </p>
+        
+        
+        <p>
+          
+            This document was produced by a group operating under the 
+            <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
+          
+          
+          
+            
+              <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/43696/status" rel="disclosure">public list of any patent disclosures</a> 
+            
+            made in connection with the deliverables of the group; that page also includes instructions for 
+            disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains
+            <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the
+            information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
+            6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
+          
+          
+        </p>
+        
+      
+    
+  
+</div><div class="section" id="toc"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a class="tocxref" href="#introduction"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a class="tocxref" href="#conformance"><span class="secno">2. </span>Conformance</a></li><li class="tocline"><a class="tocxref" href="#terminology"><span class="secno">3. </span>Terminology</a></li><li class="tocline"><a class="tocxref" href="#security-and-privacy-considerations"><span class="secno">4. </span>Security and privacy considerations</a></li><li class="tocline"><a class="tocxref" href="#device-proximity"><span class="secno">5. </span>Device proximity</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes"><span class="secno">5.1 </span>Attributes</a></li><li class="tocline"><a class="tocxref" href="#deviceproximityevent-interface"><span class="secno">5.2 </span><code>DeviceProximityEvent</code> Interface</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes-1"><span class="secno">5.2.1 </span>Attributes</a></li><li class="tocline"><a class="tocxref" href="#dictionary-deviceproximityeventinit-members"><span class="secno">5.2.2 </span>Dictionary <code>DeviceProximityEventInit</code> Members</a></li><li class="tocline"><a class="tocxref" href="#event-handlers"><span class="secno">5.2.3 </span>Event handlers</a></li></ul></li></ul></li><li class="tocline"><a class="tocxref" href="#user-proximity"><span class="secno">6. </span>User proximity</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes-2"><span class="secno">6.1 </span>Attributes</a></li><li class="tocline"><a class="tocxref" href="#userproximityevent-interface"><span class="secno">6.2 </span><code>UserProximityEvent</code> Interface</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes-3"><span class="secno">6.2.1 </span>Attributes</a></li><li class="tocline"><a class="tocxref" href="#dictionary-userproximityeventinit-members"><span class="secno">6.2.2 </span>Dictionary <code>UserProximityEventInit</code> Members</a></li><li class="tocline"><a class="tocxref" href="#event-handlers-1"><span class="secno">6.2.3 </span>Event handlers</a></li></ul></li></ul></li><li class="tocline"><a class="tocxref" href="#acknowledgements"><span class="secno">A. </span>Acknowledgements</a></li><li class="tocline"><a class="tocxref" href="#references"><span class="secno">B. </span>References</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#normative-references"><span class="secno">B.1 </span>Normative references</a></li><li class="tocline"><a class="tocxref" href="#informative-references"><span class="secno">B.2 </span>Informative references</a></li></ul></li></ul></div>
+    
+    
+    
+    <div id="introduction" class="informative section">
+      <!--OddPage--><h2><span class="secno">1. </span>Introduction</h2><p><em>This section is non-normative.</em></p>
+      <p>
+        The <a class="idlType" href="#idl-def-DeviceProximityEvent"><code>DeviceProximityEvent</code></a> interface provides web developers
+        information about the distance between the hosting device and a
+        nearby object.
+      </p>
+      <p>
+        The <a class="idlType" href="#idl-def-UserProximityEvent"><code>UserProximityEvent</code></a> interface provides web developers
+        a user-agent- and platform-specific approximation that the hosting
+        device has sensed a nearby object.
+      </p>
+      <p>
+        This is achieved by interrogating a proximity sensor of a device, which
+        is a sensor that can detect the presence of a physical object without
+        physical contact. Not all devices contain a proximity sensor, and when
+        there is no proximity sensor, this API is still exposed to the
+        scripting environment but it does nothing.
+      </p>
+      <p>
+        Because most proximity sensors detect electromagnetic radiation (e.g.,
+        an infrared light or a magnetic field), certain material properties can
+        interfere with the sensor's ability to sense the presence of a physical
+        object. Things that can interfere with a sensor include, but are not
+        limited to, the material's translucency, reflectiveness, color,
+        temperature, chemical composition, and even the angle at which the
+        object is reflecting the radiation back at the sensor. As such,
+        proximity sensors should not be relied on as a means to measure
+        distance: the only thing that can be deduced from a proximity sensor is
+        that an object is somewhere in the distance between the minimum sensing
+        distance and the maximum sensing distance with some degree of
+        certainty.
+      </p>
+    </div>
+    
+    <div class="section" id="conformance"><!--OddPage--><h2><span class="secno">2. </span>Conformance</h2>
+<p>
+  As well as sections marked as non-normative, all authoring guidelines, diagrams, examples,
+  and notes in this specification are non-normative. Everything else in this specification is
+  normative.
+</p>
+<p>
+  The key words <em title="must" class="rfc2119">must</em>, <em title="must not" class="rfc2119">must not</em>, <em title="required" class="rfc2119">required</em>, <em title="should" class="rfc2119">should</em>, <em title="should not" class="rfc2119">should not</em>, <em title="recommended" class="rfc2119">recommended</em>, <em title="may" class="rfc2119">may</em>,
+  and <em title="optional" class="rfc2119">optional</em> in this specification are to be interpreted as described in [<cite><a href="#bib-RFC2119" class="bibref">RFC2119</a></cite>].
+</p>
+
+      <p>
+        This specification defines conformance criteria that apply to a single
+        product: the <dfn id="dfn-user-agent">user agent</dfn> that implements the
+        interfaces that it contains.
+      </p>
+    </div>
+    
+    <div class="section" id="terminology">
+      <!--OddPage--><h2><span class="secno">3. </span>Terminology</h2>
+      <p>
+        The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#eventhandler">
+        EventHandler</a></code> interface represents a callback used for event
+        handlers as defined in [<cite><a href="#bib-HTML5" class="bibref">HTML5</a></cite>].
+      </p>
+      <p>
+        The concepts <dfn id="dfn-queue-a-task"><a href="http://dev.w3.org/html5/spec/webappapis.html#queue-a-task">
+        queue a task</a></dfn> and
+        <dfn id="dfn-fires-a-simple-event"><a href="http://dev.w3.org/html5/spec/webappapis.html#fire-a-simple-event">
+        fires a simple event</a></dfn> are defined in [<cite><a href="#bib-HTML5" class="bibref">HTML5</a></cite>].
+      </p>
+      <p>
+        The terms <dfn id="dfn-event-handlers"><a href="http://dev.w3.org/html5/spec/webappapis.html#event-handlers">
+        event handlers</a></dfn> and
+        <dfn id="dfn-event-handler-event-types"><a href="http://dev.w3.org/html5/spec/webappapis.html#event-handler-event-type">
+        event handler event types</a></dfn> are defined in [<cite><a href="#bib-HTML5" class="bibref">HTML5</a></cite>].
+      </p>
+      <p>The concepts <dfn id="dfn-create-an-event">
+      <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#constructing-events">
+      create an event</a></dfn> and <dfn id="dfn-fire-an-event">
+      <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#firing-events">
+      fire an event</a></dfn> are defined in [<cite><a href="#bib-DOM4" class="bibref">DOM4</a></cite>].
+      </p><p>
+        The <dfn id="dfn-current-device-proximity">current device proximity</dfn> is a value that represents the
+        proximity of the hosting device to a physical object (i.e., some value
+        between the <a class="internalDFN" href="#dfn-maximum-sensing-distance">maximum sensing distance</a> and the <a class="internalDFN" href="#dfn-minimum-sensing-distance">minimum sensing
+        distance</a>), in centimeters.
+      </p>
+      <p>
+        The <dfn id="dfn-minimum-sensing-distance">minimum sensing distance</dfn> at which the sensor can detect
+        a physical object. 
+      </p>
+      <p>
+        The <dfn id="dfn-maximum-sensing-distance">maximum sensing distance</dfn> at which the sensor can detect
+        a physical object.
+      </p>
+      <p>
+        The <dfn id="dfn-current-user-proximity-state">current user proximity state</dfn>, a boolean state, is a
+        user-agent- and platform-specific approximation of the closeness of a
+        physical object with the hosting device.
+      </p>
+    </div>
+    
+    <div class="section" id="security-and-privacy-considerations">
+      <!--OddPage--><h2><span class="secno">4. </span>Security and privacy considerations</h2>
+      <p>
+      </p>
+    </div>
+    
+    <div class="section" id="device-proximity">
+      <!--OddPage--><h2><span class="secno">5. </span>Device proximity</h2>
+      <p>
+        The HTML5 specification [<cite><a href="#bib-HTML5" class="bibref">HTML5</a></cite>] defines a <a class="idlType" href="#idl-def-Window"><code>Window</code></a> interface,
+        which this specification extends:
+      </p>
+      <pre class="idl"><span class="idlInterface" id="idl-def-Window">partial interface <span class="idlInterfaceID">Window</span> {
+<span class="idlAttribute">    attribute <span class="idlAttrType"><a>EventHandler</a></span> <span class="idlAttrName"><a href="#widl-Window-ondeviceproximity">ondeviceproximity</a></span>;</span>
+};</span></pre><div class="section" id="attributes"><h3><span class="secno">5.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-Window-ondeviceproximity"><code>ondeviceproximity</code> of type <span class="idlAttrType"><a>EventHandler</a></span></dt><dd>
+        </dd></dl></div>
+      <p>
+        The <code>ondeviceproximity</code> event handler and its corresponding
+        event handler event type <code>deviceproximity</code> <em title="must" class="rfc2119">must</em> be supported
+        as an IDL attribute by all objects implementing the <a class="idlType" href="#idl-def-Window"><code>Window</code></a>
+        interface.
+      </p>
+      <div class="section" id="deviceproximityevent-interface">
+        <h3><span class="secno">5.2 </span><a class="idlType" href="#idl-def-DeviceProximityEvent"><code>DeviceProximityEvent</code></a> Interface</h3>
+        <pre class="idl"><span class="idlInterface" id="idl-def-DeviceProximityEvent">[<span class="extAttr">Constructor (DOMString type, optional DeviceProximityEventInit eventInitDict)</span>]
+interface <span class="idlInterfaceID">DeviceProximityEvent</span> : <span class="idlSuperclass"><a>Event</a></span> {
+<span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>double</a></span> <span class="idlAttrName"><a href="#widl-DeviceProximityEvent-value">value</a></span>;</span>
+<span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>double</a></span> <span class="idlAttrName"><a href="#widl-DeviceProximityEvent-min">min</a></span>;</span>
+<span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>double</a></span> <span class="idlAttrName"><a href="#widl-DeviceProximityEvent-max">max</a></span>;</span>
+};<br><span class="idlDictionary" id="idl-def-DeviceProximityEventInit">dictionary <span class="idlDictionaryID">DeviceProximityEventInit</span> : <span class="idlSuperclass"><a>EventInit</a></span> {
+<span class="idlMember">    <span class="idlMemberType"><a>double</a></span> <span class="idlMemberName"><a href="#widl-DeviceProximityEventInit-value">value</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>double</a></span> <span class="idlMemberName"><a href="#widl-DeviceProximityEventInit-min">min</a></span>;</span>
+<span class="idlMember">    <span class="idlMemberType"><a>double</a></span> <span class="idlMemberName"><a href="#widl-DeviceProximityEventInit-max">max</a></span>;</span>
+};</span></span></pre><div class="section" id="attributes-1"><h4><span class="secno">5.2.1 </span>Attributes</h4><dl class="attributes"><dt id="widl-DeviceProximityEvent-max"><code>max</code> of type <span class="idlAttrType"><a>double</a></span>, readonly</dt><dd>
+            The <a class="internalDFN" href="#dfn-maximum-sensing-distance">maximum sensing distance<strong></strong></a>.
+          </dd><dt id="widl-DeviceProximityEvent-min"><code>min</code> of type <span class="idlAttrType"><a>double</a></span>, readonly</dt><dd>
+            The <a class="internalDFN" href="#dfn-minimum-sensing-distance"> minimum sensing distance</a>.
+          </dd><dt id="widl-DeviceProximityEvent-value"><code>value</code> of type <span class="idlAttrType"><a>double</a></span>, readonly</dt><dd>
+            The <a class="internalDFN" href="#dfn-current-device-proximity">current device proximity</a>.
+          </dd></dl></div>
+        <div class="section" id="dictionary-deviceproximityeventinit-members"><h4><span class="secno">5.2.2 </span>Dictionary <a href="#idl-def-DeviceProximityEventInit" class="idlType"><code>DeviceProximityEventInit</code></a> Members</h4><dl class="dictionary-members"><dt id="widl-DeviceProximityEventInit-max"><code>max</code> of type <span class="idlMemberType"><a>double</a></span></dt><dd></dd><dt id="widl-DeviceProximityEventInit-min"><code>min</code> of type <span class="idlMemberType"><a>double</a></span></dt><dd></dd><dt id="widl-DeviceProximityEventInit-value"><code>value</code> of type <span class="idlMemberType"><a>double</a></span></dt><dd></dd></dl></div>
+        <p>
+          When a <dfn id="dfn-user-agent-1">user agent</dfn> is required to <dfn id="dfn-fire-a-device-proximity-event">fire a device
+          proximity event</dfn>, the <dfn id="dfn-user-agent-2">user agent</dfn> <em title="must" class="rfc2119">must</em> run the
+          following steps:
+        </p>
+        <ol class="rule">
+          <li>
+            <a>Create an event</a> that uses the <a class="idlType" href="#idl-def-DeviceProximityEvent"><code>DeviceProximityEvent</code></a>
+            interface, with the name <code>deviceproximity</code>, which
+            bubbles, is not cancelable, and has no default action, that also
+            meets the following conditions:
+            <ol>
+              <li>
+                If the implementation is unable to report the <a class="internalDFN" href="#dfn-current-device-proximity">current
+                device proximity</a>, initialize the <code>value</code>
+                attribute to positive Infinity, otherwise initialize the
+                attribute to the <a class="internalDFN" href="#dfn-current-device-proximity">current device proximity</a>.
+              </li>
+              <li>
+                 If the implementation is unable to report the <a class="internalDFN" href="#dfn-minimum-sensing-distance">minimum
+                 sensing distance</a>, initialize the <code>min</code>
+                 attribute to negative Infinity, otherwise initialize the
+                 attribute to the <a class="internalDFN" href="#dfn-minimum-sensing-distance">minimum sensing distance</a>.
+              </li>
+              <li>
+                 If the implementation is unable to report the <a class="internalDFN" href="#dfn-maximum-sensing-distance">maximum
+                 sensing distance</a>, initialize the <code>max</code>
+                 attribute to positive Infinity, otherwise initialize the
+                 attribute to the <a class="internalDFN" href="#dfn-maximum-sensing-distance">maximum sensing distance</a>.
+              </li>
+            </ol>
+          </li>
+          <li>
+            <a>Queue a task</a> to dispatch the newly created event at the
+            <a class="idlType" href="#idl-def-Window"><code>Window</code></a> object.
+          </li>
+        </ol>
+        <p>
+          When <a>the current proximity</a> changes, the <dfn id="dfn-user-agent-3">user
+          agent</dfn> <em title="must" class="rfc2119">must</em> <a class="internalDFN" href="#dfn-fire-a-device-proximity-event">fire a device proximity event</a>.
+        </p>
+        <div class="note"><div class="note-title"><span>Note</span></div><div class="">
+          The definition of granularity i.e. how often the event is fired is
+          left to the implementation. Implementations may fire the event if
+          they have reason to believe that the page does not have sufficiently
+          fresh data. Different devices may also support different minimum and
+          maximum sensing distances as well as different resolution, thus
+          authors are strongly advised to use the <a class="idlType" href="#idl-def-UserProximityEvent"><code>UserProximityEvent</code></a>
+          interface if the are only interested in finding out if the user is
+          near or far.
+        </div></div>
+        <div class="section" id="event-handlers">
+          <h4><span class="secno">5.2.3 </span>Event handlers</h4>
+          <p>
+            The following are the <a class="internalDFN" href="#dfn-event-handlers">event handlers</a> (and their corresponding
+            <a class="internalDFN" href="#dfn-event-handler-event-types">event handler event types</a>) that <em title="must" class="rfc2119">must</em> be supported as
+            attributes by the <code>Window</code> object:
+          </p>
+          <table class="simple">
+            <thead>
+              <tr>
+                <th>event handler</th>
+                <th>event handler event type</th>
+              </tr>
+            </thead>
+            <tbody>
+              <tr>
+                <td><strong><code>ondeviceproximity</code></strong></td>
+                <td><code>deviceproximity</code></td>
+              </tr>
+            </tbody>
+          </table>
+        </div>
+      </div>
+    </div>
+      
+    <div class="section" id="user-proximity">
+      <!--OddPage--><h2><span class="secno">6. </span>User proximity</h2>
+      <p>
+        The HTML5 specification [<cite><a href="#bib-HTML5" class="bibref">HTML5</a></cite>] defines a <a class="idlType" href="#idl-def-Window"><code>Window</code></a> interface,
+        which this specification extends:
+      </p>
+      <pre class="idl"><span class="idlInterface" id="idl-def-Window-1">partial interface <span class="idlInterfaceID">Window</span> {
+<span class="idlAttribute">    attribute <span class="idlAttrType"><a>EventHandler</a></span> <span class="idlAttrName"><a href="#widl-Window-onuserproximity">onuserproximity</a></span>;</span>
+};</span></pre><div class="section" id="attributes-2"><h3><span class="secno">6.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-Window-onuserproximity"><code>onuserproximity</code> of type <span class="idlAttrType"><a>EventHandler</a></span></dt><dd>
+        </dd></dl></div>
+      <p>
+        The <code>onuserproximity</code> event handler and its corresponding
+        event handler event type <code>userproximity</code> <em title="must" class="rfc2119">must</em> be supported
+        as an IDL attribute by all objects implementing the <a class="idlType" href="#idl-def-Window"><code>Window</code></a>
+        interface.
+      </p>
+      <div class="section" id="userproximityevent-interface">
+        <h3><span class="secno">6.2 </span><a class="idlType" href="#idl-def-UserProximityEvent"><code>UserProximityEvent</code></a> Interface</h3>
+        <pre class="idl"><span class="idlInterface" id="idl-def-UserProximityEvent">[<span class="extAttr">Constructor (DOMString type, optional UserProximityEventInit eventInitDict)</span>]
+interface <span class="idlInterfaceID">UserProximityEvent</span> : <span class="idlSuperclass"><a>Event</a></span> {
+<span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>boolean</a></span> <span class="idlAttrName"><a href="#widl-UserProximityEvent-near">near</a></span>;</span>
+};<br><span class="idlDictionary" id="idl-def-UserProximityEventInit">dictionary <span class="idlDictionaryID">UserProximityEventInit</span> : <span class="idlSuperclass"><a>EventInit</a></span> {
+<span class="idlMember">    <span class="idlMemberType"><a>boolean</a></span> <span class="idlMemberName"><a href="#widl-UserProximityEventInit-near">near</a></span>;</span>
+};</span></span></pre><div class="section" id="attributes-3"><h4><span class="secno">6.2.1 </span>Attributes</h4><dl class="attributes"><dt id="widl-UserProximityEvent-near"><code>near</code> of type <span class="idlAttrType"><a>boolean</a></span>, readonly</dt><dd>
+            The <a class="internalDFN" href="#dfn-current-user-proximity-state">current user proximity state</a>.
+          </dd></dl></div>
+        <div class="section" id="dictionary-userproximityeventinit-members"><h4><span class="secno">6.2.2 </span>Dictionary <a href="#idl-def-UserProximityEventInit" class="idlType"><code>UserProximityEventInit</code></a> Members</h4><dl class="dictionary-members"><dt id="widl-UserProximityEventInit-near"><code>near</code> of type <span class="idlMemberType"><a>boolean</a></span></dt><dd></dd></dl></div>
+        <p>
+          When a <dfn id="dfn-user-agent-4">user agent</dfn> is required to <dfn id="dfn-fire-a-user-proximity-event">fire a user
+          proximity event</dfn>, the <dfn id="dfn-user-agent-5">user agent</dfn> <em title="must" class="rfc2119">must</em> run the
+          following steps:
+        </p>
+        <ol class="rule">
+          <li>
+            <a>Create an event</a> that uses the <a class="idlType" href="#idl-def-UserProximityEvent"><code>UserProximityEvent</code></a>
+            interface, with the name <code>userproximity</code>, which bubbles,
+            is not cancelable, and has no default action, that also meets the
+            following conditions:
+            <ol>
+              <li>
+                If the implementation is unable to report the <a class="internalDFN" href="#dfn-current-user-proximity-state">current user
+                proximity state</a>, initialize the <code>near</code> attribute
+                to false, otherwise initialize the attribute to the <a class="internalDFN" href="#dfn-current-user-proximity-state">current
+                user proximity state</a>.
+              </li>
+            </ol>
+          </li>
+          <li>
+            <a>Queue a task</a> to dispatch the newly created event at the
+            <a class="idlType" href="#idl-def-Window"><code>Window</code></a> object.
+          </li>
+        </ol>
+        <p>
+          When the <a class="internalDFN" href="#dfn-current-user-proximity-state">current user proximity state</a> changes, the <dfn id="dfn-user-agent-6">user
+          agent</dfn> <em title="must" class="rfc2119">must</em> <a class="internalDFN" href="#dfn-fire-a-user-proximity-event">fire a user proximity event</a>.
+        </p>
+        <div class="section" id="event-handlers-1">
+          <h4><span class="secno">6.2.3 </span>Event handlers</h4>
+          <p>
+            The following are the <a class="internalDFN" href="#dfn-event-handlers">event handlers</a> (and their corresponding
+            <a class="internalDFN" href="#dfn-event-handler-event-types">event handler event types</a>) that <em title="must" class="rfc2119">must</em> be supported as
+            attributes by the <code>Window</code> object:
+          </p>
+          <table class="simple">
+            <thead>
+              <tr>
+                <th>event handler</th>
+                <th>event handler event type</th>
+              </tr>
+            </thead>
+            <tbody>
+              <tr>
+                <td><strong><code>onuserproximity</code></strong></td>
+                <td><code>userproximity</code></td>
+              </tr>
+            </tbody>
+          </table>
+        </div>
+      </div>
+    </div>
+    
+    <div id="acknowledgements" class="appendix section">
+      <!--OddPage--><h2><span class="secno">A. </span>Acknowledgements</h2>
+      <p>
+        Doug Turner for the initial prototype. All Device APIs working group
+        participants who have sent helpful feedback. Marcos Caceres for his
+        excellent work on the test suite.
+      </p>
+    </div>
+  
+
+<div class="appendix section" id="references"><!--OddPage--><h2><span class="secno">B. </span>References</h2><div class="section" id="normative-references"><h3><span class="secno">B.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-DOM4">[DOM4]</dt><dd>Anne van Kesteren; Aryeh Gregor; Ms2ger. <a href="http://www.w3.org/TR/dom/"><cite>DOM4.</cite></a> 5 April 2012. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/dom/">http://www.w3.org/TR/dom/</a> 
+</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Ian Hickson; David Hyatt. <a href="http://www.w3.org/TR/html5"><cite>HTML5.</cite></a> 25 May 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/html5">http://www.w3.org/TR/html5</a> 
+</dd><dt id="bib-RFC2119">[RFC2119]</dt><dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in RFCs to Indicate Requirement Levels.</cite></a> March 1997. Internet RFC 2119.  URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a> 
+</dd></dl></div><div class="section" id="informative-references"><h3><span class="secno">B.2 </span>Informative references</h3><p>No informative references.</p></div></div></body></html>
\ No newline at end of file
--- a/proximity/Overview.html	Fri Aug 24 23:36:10 2012 +0300
+++ b/proximity/Overview.html	Sat Aug 25 00:52:13 2012 +0300
@@ -93,9 +93,9 @@
     <section>
       <h2>Terminology</h2>
       <p>
-        The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#function">
-        Function</a></code> interface represents a function in the scripting
-        language being used as defined in [[!HTML5]].
+        The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#eventhandler">
+        EventHandler</a></code> interface represents a callback used for event
+        handlers as defined in [[!HTML5]].
       </p>
       <p>
         The concepts <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#queue-a-task">
@@ -148,7 +148,7 @@
         which this specification extends:
       </p>
       <dl title="partial interface Window" class="idl">
-        <dt>[TreatNonCallableAsNull] attribute Function? ondeviceproximity</dt>
+        <dt>attribute EventHandler ondeviceproximity</dt>
         <dd>
         </dd>
       </dl>
@@ -273,7 +273,7 @@
         which this specification extends:
       </p>
       <dl title="partial interface Window" class="idl">
-        <dt>[TreatNonCallableAsNull] attribute Function? onuserproximity</dt>
+        <dt>attribute EventHandler onuserproximity</dt>
         <dd>
         </dd>
       </dl>
@@ -357,7 +357,8 @@
       <h2>Acknowledgements</h2>
       <p>
         Doug Turner for the initial prototype. All Device APIs working group
-        participants who have sent helpful feedback.
+        participants who have sent helpful feedback. Marcos Caceres for his
+        excellent work on the test suite.
       </p>
     </section>
   </body>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/proximity/tests/submissions/marcos/DeviceProximityEvent_tests.js	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,265 @@
+/**
+* W3C 3-clause BSD License
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* o Redistributions of works must retain the original copyright notice,
+*     this list of conditions and the following disclaimer.
+*
+* o Redistributions in binary form must reproduce the original copyright
+*     notice, this list of conditions and the following disclaimer in the
+*     documentation and/or other materials provided with the distribution.
+*
+* o Neither the name of the W3C nor the names of its contributors may be
+*     used to endorse or promote products derived from this work without
+*     specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+**/
+
+(function() {
+    //inheritance tests
+    test(function() {
+        var event = new DeviceProximityEvent('');
+        assert_true(event instanceof window.DeviceProximityEvent);
+    }, 'the event is an instance of DeviceProximityEvent');
+
+    test(function() {
+        var event = new DeviceProximityEvent('');
+        assert_true(event instanceof window.Event);
+    }, 'the event inherits from Event');
+
+    //Type attribute tests
+    test(function() {
+        assert_throws(null, function() {
+            new DeviceProximityEvent();
+        }, 'First argument is required, so was expecting a TypeError.');
+    }, 'Missing type argument');
+
+    test(function() {
+        var event = new DeviceProximityEvent(undefined);
+        assert_equals(event.type, 'undefined');
+    }, 'Event type set to undefined');
+
+    test(function() {
+        var event = new DeviceProximityEvent(null);
+        assert_equals(event.type, 'null');
+    }, 'type argument is null');
+
+    test(function() {
+        var event = new DeviceProximityEvent(123);
+        assert_equals(event.type, '123');
+    }, 'type argument is number');
+
+    test(function() {
+        var event = new DeviceProximityEvent(new Number(123));
+        assert_equals(event.type, '123');
+    }, 'type argument is Number');
+
+    test(function() {
+        var event = new DeviceProximityEvent([]);
+        assert_equals(event.type, '');
+    }, 'type argument is array');
+
+    test(function() {
+        var event = new DeviceProximityEvent(new Array());
+        assert_equals(event.type, '');
+    }, 'type argument is instance of Array');
+
+    test(function() {
+        var event = new DeviceProximityEvent(['t', ['e', ['s', ['t']]]]);
+        assert_equals(event.type, 't,e,s,t');
+    }, 'type argument is nested array');
+
+    test(function() {
+        var event = new DeviceProximityEvent(Math);
+        assert_equals(event.type, '[object Math]');
+    }, 'type argument is host object');
+
+    test(function() {
+        var event = new DeviceProximityEvent(true);
+        assert_equals(event.type, 'true');
+    }, 'type argument is boolean (true)');
+
+    test(function() {
+        var event = new DeviceProximityEvent(new Boolean(true));
+        assert_equals(event.type, 'true');
+    }, 'type argument is instance of boolean');
+
+    test(function() {
+        var event = new DeviceProximityEvent(false);
+        assert_equals(event.type, 'false');
+    }, 'type argument is boolean (false)');
+
+    test(function() {
+        var event = new DeviceProximityEvent(new Boolean(false));
+        assert_equals(event.type, 'false');
+    }, '');
+
+    test(function() {
+        var event = new DeviceProximityEvent('test');
+        assert_equals(event.type, 'test');
+    }, 'type argument is instance of boolean (false)');
+
+    test(function() {
+        var event = new DeviceProximityEvent(new String('test'));
+        assert_equals(event.type, 'test');
+    }, 'type argument is string');
+
+    test(function() {
+        var event = new DeviceProximityEvent(function test() {});
+        assert_regexp_match(event.type, /function test.+{\s?}/);
+    }, 'type argument is function');
+
+    test(function() {
+        var event = new DeviceProximityEvent({
+            toString: function() {
+                return '123';
+            }
+        });
+        assert_equals(event.type, '123');
+    }, 'type argument is complext object, with toString method');
+
+    test(function() {
+        assert_throws(null, function() {
+            new DeviceProximityEvent({
+                toString: function() {
+                    return function() {}
+                }
+            });
+        });
+    }, 'toString is of type function');
+
+    //test the attributes exist
+    test(function() {
+        var event = new DeviceProximityEvent('test');
+        assert_idl_attribute(event, 'value', 'must have attribute value');
+    }, 'value attribute exist');
+
+    test(function() {
+        var event = new DeviceProximityEvent('test');
+        assert_idl_attribute(event, 'min', 'must have attribute min');
+    }, 'min attribute exist');
+
+    test(function() {
+        var event = new DeviceProximityEvent('test');
+        assert_idl_attribute(event, 'max', 'must have attribute max');
+    }, 'max attribute exist');
+
+    //test readonly attribute double value;
+    test(function() {
+        var event = new DeviceProximityEvent('test');
+        assert_readonly(event, 'value', 'readonly attribute value');
+    }, 'value attribute is readonly');
+
+    //test readonly attribute double min
+    test(function() {
+        var event = new DeviceProximityEvent('test');
+        assert_readonly(event, 'min', 'readonly attribute min');
+    }, 'min attribute is readonly');
+
+    //readonly attribute double max;
+    test(function() {
+        var event = new DeviceProximityEvent('test');
+        assert_readonly(event, 'max', 'readonly attribute max');
+    }, 'max attribute is readonly');
+
+    test(function() {
+        var desc = 'Expected to find ondeviceproximity attribute on window object';
+        assert_idl_attribute(window, 'ondeviceproximity', desc);
+    }, 'ondeviceproximity exists');
+
+    test(function() {
+        var desc = 'window.ondeviceproximity must be null';
+        assert_equals(window.ondeviceproximity, null, desc);
+    }, 'ondeviceproximity is null');
+
+    test(function() {
+        var desc = 'window.ondeviceproximity did not accept callable object',
+            func = function() {},
+            desc = 'Expected to find ondeviceproximity attribute on window object';
+        assert_idl_attribute(window, 'ondeviceproximity', desc);
+        window.ondeviceproximity = func;
+        assert_equals(window.ondeviceproximity, func, desc);
+    }, 'ondeviceproximity is set to function');
+
+    test(function() {
+        var desc = 'window.ondeviceproximity did not treat noncallable as null';
+        window.ondeviceproximity = function() {};
+        window.ondeviceproximity = {};
+        assert_equals(window.ondeviceproximity, null, desc);
+    }, 'treat object as null');
+
+    test(function() {
+        var desc = 'window.ondeviceproximity did not treat noncallable as null';
+        window.ondeviceproximity = function() {};
+        window.ondeviceproximity = {
+            call: 'test'
+        };
+        assert_equals(window.ondeviceproximity, null, desc);
+    }, 'treat object with non-callable call property as null');
+
+    test(function() {
+        var desc = 'window.ondeviceproximity did not treat noncallable (string) as null';
+        window.ondeviceproximity = function() {};
+        window.ondeviceproximity = 'string';
+        assert_equals(window.ondeviceproximity, null, desc);
+    }, 'treat string as null');
+
+    test(function() {
+        var desc = 'window.ondeviceproximity did not treat noncallable (number) as null';
+        window.ondeviceproximity = function() {};
+        window.ondeviceproximity = 123;
+        assert_equals(window.ondeviceproximity, null, desc);
+    }, 'treat number as null');
+
+    test(function() {
+        var desc = 'window.ondeviceproximity did not treat noncallable (undefined) as null';
+        window.ondeviceproximity = function() {};
+        window.ondeviceproximity = undefined;
+        assert_equals(window.ondeviceproximity, null, desc);
+    }, 'treat undefined as null');
+
+    test(function() {
+        var desc = 'window.ondeviceproximity did not treat noncallable (array) as null';
+        window.ondeviceproximity = function() {};
+        window.ondeviceproximity = [];
+        assert_equals(window.ondeviceproximity, null, desc);
+    }, 'treat array as null');
+
+    test(function() {
+        var desc = 'window.ondeviceproximity did not treat noncallable host object as null';
+        window.ondeviceproximity = function() {};
+        window.ondeviceproximity = Node;
+        assert_equals(window.ondeviceproximity, null, desc);
+    }, 'treat non-callable host object as null');
+
+    //Async tests
+    var t = async_test('test if device proximity event recieved');
+    window.addEventListener('deviceproximity', function(e) {
+        t.step(function() {
+            var msg = 'expected instance of DeviceProximityEvent: ';
+            assert_true(e instanceof window.DeviceProximityEvent, msg);
+        });
+        t.done();
+    });
+
+    var t2 = async_test('test if user proximity event recieved');
+    window.ondeviceproximity = function(e) {
+        t2.step(function() {
+            var msg = 'expected instance of DeviceProximityEvent: ';
+            assert_true(e instanceof window.DeviceProximityEvent, msg);
+        });
+        t2.done();
+    };
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/proximity/tests/submissions/marcos/UserProximityEvent_tests.js	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,324 @@
+/**
+* W3C 3-clause BSD License
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* o Redistributions of works must retain the original copyright notice,
+*     this list of conditions and the following disclaimer.
+*
+* o Redistributions in binary form must reproduce the original copyright
+*     notice, this list of conditions and the following disclaimer in the
+*     documentation and/or other materials provided with the distribution.
+*
+* o Neither the name of the W3C nor the names of its contributors may be
+*     used to endorse or promote products derived from this work without
+*     specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+**/
+(function() {
+    //inheritance tests
+    test(function() {
+        var event = new UserProximityEvent('');
+        assert_true(event instanceof window.UserProximityEvent);
+    }, 'the event is an instance of UserProximityEvent');
+
+    test(function() {
+        var event = new UserProximityEvent('');
+        assert_true(event instanceof window.Event);
+    }, 'the event inherits from Event');
+
+    //Type attribute tests
+    test(function() {
+        assert_throws(null, function() {
+            new UserProximityEvent();
+        }, 'First argument is required, so was expecting a TypeError.');
+    }, 'Missing type argument');
+
+    test(function() {
+        var event = new UserProximityEvent(undefined);
+        assert_equals(event.type, 'undefined');
+    }, 'Event type set to undefined');
+
+    test(function() {
+        var event = new UserProximityEvent(null);
+        assert_equals(event.type, 'null');
+    }, 'type argument is null');
+
+    test(function() {
+        var event = new UserProximityEvent(123);
+        assert_equals(event.type, '123');
+    }, 'type argument is number');
+
+    test(function() {
+        var event = new UserProximityEvent(new Number(123));
+        assert_equals(event.type, '123');
+    }, 'type argument is Number');
+
+    test(function() {
+        var event = new UserProximityEvent([]);
+        assert_equals(event.type, '');
+    }, 'type argument is array');
+
+    test(function() {
+        var event = new UserProximityEvent(new Array());
+        assert_equals(event.type, '');
+    }, 'type argument is instance of Array');
+
+    test(function() {
+        var event = new UserProximityEvent(['t', ['e', ['s', ['t']]]]);
+        assert_equals(event.type, 't,e,s,t');
+    }, 'type argument is nested array');
+
+    test(function() {
+        var event = new UserProximityEvent(Math);
+        assert_equals(event.type, '[object Math]');
+    }, 'type argument is host object');
+
+    test(function() {
+        var event = new UserProximityEvent(true);
+        assert_equals(event.type, 'true');
+    }, 'type argument is boolean (true)');
+
+    test(function() {
+        var event = new UserProximityEvent(new Boolean(true));
+        assert_equals(event.type, 'true');
+    }, 'type argument is instance of boolean');
+
+    test(function() {
+        var event = new UserProximityEvent(false);
+        assert_equals(event.type, 'false');
+    }, 'type argument is boolean (false)');
+
+    test(function() {
+        var event = new UserProximityEvent(new Boolean(false));
+        assert_equals(event.type, 'false');
+    }, '');
+
+    test(function() {
+        var event = new UserProximityEvent('test');
+        assert_equals(event.type, 'test');
+    }, 'type argument is instance of boolean (false)');
+
+    test(function() {
+        var event = new UserProximityEvent(new String('test'));
+        assert_equals(event.type, 'test');
+    }, 'type argument is string');
+
+    test(function() {
+        var event = new UserProximityEvent(function test() {});
+        assert_regexp_match(event.type, /function test.+{\s?}/);
+    }, 'type argument is function');
+
+    test(function() {
+        var event = new UserProximityEvent({
+            toString: function() {
+                return '123';
+            }
+        });
+        assert_equals(event.type, '123');
+    }, 'type argument is complext object, with toString method');
+
+    test(function() {
+        assert_throws(null, function() {
+            new UserProximityEvent({
+                toString: function() {
+                    return function() {}
+                }
+            });
+        });
+    }, 'toString is of type function');
+
+    //test readonly attribute boolean near;
+    test(function() {
+        var event = new UserProximityEvent('test');
+        assert_idl_attribute(event, 'near', 'must have attribute near');
+    }, 'must have attribute near');
+
+
+    test(function() {
+        var event = new UserProximityEvent('test');
+        assert_readonly(event, 'near', 'readonly attribute near');
+    }, 'near is readonly');
+
+    test(function() {
+        var event = new UserProximityEvent('test', {
+            near: false
+        });
+        assert_equals(event.near, false, 'near set to false');
+    }, 'near set to false');
+
+    test(function() {
+        var event = new UserProximityEvent('test', {
+            near: true
+        });
+        assert_equals(event.near, true, 'near set to true');
+    }, 'near set to true');
+
+    test(function() {
+        var event = new UserProximityEvent('test', {
+            near: undefined
+        });
+        assert_equals(event.near, false, 'argument is truthy');
+    }, 'near set to a falsy object');
+
+    test(function() {
+        var event = new UserProximityEvent('test', {
+            near: null
+        });
+        assert_equals(event.near, false, 'argument is flasy');
+    }, 'near set to a falsy object');
+
+    test(function() {
+        var event = new UserProximityEvent('test', {
+            near: 0
+        });
+        assert_equals(event.near, false, 'argument is flasy');
+    }, 'near set to a falsy object');
+
+    test(function() {
+        var event = new UserProximityEvent('test', {
+            near: ''
+        });
+        assert_equals(event.near, false, 'argument is flasy');
+    }, 'near set to a falsy object');
+
+    test(function() {
+        var event = new UserProximityEvent('test', {
+            near: '\u0020'
+        });
+        assert_equals(event.near, true, 'argument is truthy');
+    }, 'near set to a truthy object');
+
+    test(function() {
+        var event = new UserProximityEvent('test', {
+            near: 1
+        });
+        assert_equals(event.near, true, 'argument is truthy');
+    }, 'near set to a truthy object');
+
+    test(function() {
+        var event = new UserProximityEvent('test', {
+            near: []
+        });
+        assert_equals(event.near, true, 'argument is truthy');
+    }, 'near set to a truthy object');
+
+    test(function() {
+        var event = new UserProximityEvent('test', {
+            near: {}
+        });
+        assert_equals(event.near, true, 'argument is truthy');
+    }, 'near set to a truthy object');
+
+    test(function() {
+        var dict = {
+            get test() {
+                return false;
+            }
+        };
+        var event = new UserProximityEvent('test', {
+            near: dict.test
+        });
+        assert_equals(event.near, false, 'explict false');
+    }, 'near set to object that resolves to false');
+
+    test(function() {
+        var desc = 'Expected to find onuserproximity attribute on window object';
+        assert_idl_attribute(window, 'onuserproximity', desc);
+    }, 'onuserproximity exists');
+
+    test(function() {
+        var desc = 'window.onuserproximity must be null';
+        assert_equals(window.onuserproximity, null, desc);
+    }, 'onuserproximity is null');
+
+    test(function() {
+        var desc = 'window.onuserproximity did not accept callable object',
+            func = function() {},
+            desc = 'onuserproximity does not exist';
+        assert_idl_attribute(window, 'onuserproximity', desc);
+        window.onuserproximity = func;
+        assert_equals(window.onuserproximity, func, desc);
+    }, 'onuserproximity exists and can be set to a function');
+
+    test(function() {
+        var desc = 'window.onuserproximity did not treat noncallable as null';
+        window.onuserproximity = function() {};
+        window.onuserproximity = {};
+        assert_equals(window.onuserproximity, null, desc);
+    }, 'treat object as null');
+
+    test(function() {
+        var desc = 'window.onuserproximity did not treat noncallable as null';
+        window.onuserproximity = function() {};
+        window.onuserproximity = {
+            call: 'test'
+        };
+        assert_equals(window.onuserproximity, null, desc);
+    }, 'treat object with non-callable call property as null');
+
+    test(function() {
+        var desc = 'window.onuserproximity did not treat noncallable (string) as null';
+        window.onuserproximity = function() {};
+        window.onuserproximity = 'string';
+        assert_equals(window.onuserproximity, null, desc);
+    }, 'treat string as null');
+
+    test(function() {
+        var desc = 'window.onuserproximity did not treat noncallable (number) as null';
+        window.onuserproximity = function() {};
+        window.onuserproximity = 123;
+        assert_equals(window.onuserproximity, null, desc);
+    }, 'treat number as null');
+
+    test(function() {
+        var desc = 'window.onuserproximity did not treat noncallable (undefined) as null';
+        window.onuserproximity = function() {};
+        window.onuserproximity = undefined;
+        assert_equals(window.onuserproximity, null, desc);
+    }, 'treat undefined as null');
+
+    test(function() {
+        var desc = 'window.onuserproximity did not treat noncallable (array) as null';
+        window.onuserproximity = function() {};
+        window.onuserproximity = [];
+        assert_equals(window.onuserproximity, null, desc);
+    }, 'treat array as null');
+
+    test(function() {
+        var desc = 'window.onuserproximity did not treat noncallable host object as null';
+        window.onuserproximity = function() {};
+        window.onuserproximity = Node;
+        assert_equals(window.onuserproximity, null, desc);
+    }, 'treat non-callable host object as null');
+
+    //Async tests
+    var t = async_test('test if user proximity event recieved');
+    window.addEventListener('userproximity', function(e) {
+        t.step(function() {
+            var msg = 'expected instance of UserProximityEvent: ';
+            assert_true(e instanceof window.UserProximityEvent, msg);
+        });
+        t.done();
+    });
+
+    var t2 = async_test('test if user proximity event recieved');
+    window.onuserproximity = function(e) {
+        t2.step(function() {
+            var msg = 'expected instance of UserProximityEvent: ';
+            assert_true(e instanceof window.UserProximityEvent, msg);
+        });
+        t2.done();
+    };
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/proximity/tests/submissions/marcos/index.html	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,12 @@
+<!doctype html>
+<meta charset=utf8>
+<meta content="width=device-width, initial-scale=1" name=viewport>
+<title>Proximity Events Test Suite</title>
+<body> 
+<h1>Test Suite for Proximity Events</h1>
+<div id="log"></div>
+<hr>
+<p><small>Distributed under both the <a href="http://www.w3.org/Consortium/Legal/2008/04-testsuite-license">W3C Test Suite License</a> and the <a href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license">W3C 3-clause BSD License</a>. To contribute to a W3C Test Suite, see the <a href="http://www.w3.org/2004/10/27-testcases">policies and contribution forms</a>.</small></p>
+<script src="http://www.w3c-test.org/resources/testharness.js"></script>
+<script src="DeviceProximityEvent_tests.js"></script>
+<script src="UserProximityEvent_tests.js"></script>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/temperature/Overview.html	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,204 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Ambient Temperature Events</title>
+    <meta charset="utf-8"/>
+    <script src='http://www.w3.org/Tools/respec/respec-w3c-common' class='remove'></script>
+    <!--script src='http://dev.w3.org/2009/dap/ReSpec.js/js/respec.js' class='remove'></script-->
+    <script class="remove">
+      var respecConfig = {
+          specStatus:           "unofficial",
+          shortName:            "temperature",
+          //publishDate:          "yyyy-mm-dd",
+          //previousPublishDate:  "yyyy-mm-dd",
+          previousMaturity:     "ED",
+          edDraftURI:           "http://dvcs.w3.org/hg/dap/raw-file/tip/temperature/Overview.html",
+          //lcEnd:                "yyyy-mm-dd",
+          editors:  [
+			  { name: "Marcos Cáceres", company: "W3C Invited Expert", companyURL: "http://datadriven.com.au" },
+			  { name: "Balaji N.V", company: "Samsung Electronics", companyURL: "http://samsung.com" }
+          ],
+          inlineCSS:    true,
+          noIDLIn:      true,
+          //extraCSS:     ["../ReSpec.js/css/respec.css"],
+          extraCSS:     ["http://dev.w3.org/2009/dap/ReSpec.js/css/respec.css"],
+          wg:           "Device APIs Working Group",
+          wgURI:        "http://www.w3.org/2009/dap/",
+          wgPublicList: "public-device-apis",
+          wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/43696/status",
+      };
+    </script>
+  </head>
+<body>
+    <section id="abstract">
+      This specification defines a means to receive events that correspond to changes in 
+      ambient temperature.
+    </section>
+    
+    <section id="sotd">
+     
+    </section>
+    
+    <section class="informative">
+      <h2>Introduction</h2>
+      <p>
+        The <a>AmbientTemperatureEvent</a> interface provides web developers
+        information about the ambient temperature levels near the hosting device.
+      </p>
+      <p>
+        This is achieved by interrogating a thermometer or similar detectors
+        of a device.
+      </p>
+      <section>
+      <h3>Use Cases</h3>
+      <p>TBW</p>
+      </section>
+    </section>
+    
+    <section id="conformance">
+      <p>
+        This specification defines conformance criteria that apply to a single
+        product: the <dfn>user agent</dfn> that implements the
+        interfaces that it contains.
+      </p>
+    </section>
+    
+    <section>
+      <h2>Terminology</h2>
+      <p>
+        The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#eventhandler">
+        EventHandler</a></code> interface represents a <a href="http://www.w3.org/TR/WebIDL/#idl-callback-functions">callback function</a> used for <a href="http://dev.w3.org/html5/spec/webappapis.html#event-handlers">event
+      handlers</a> as defined in [[!HTML5]]. </p>
+      <p>
+        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]].
+      </p>
+      <p>
+        The terms <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#event-handlers">
+        event handlers</a></dfn> and
+        <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 <dfn>
+      <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#constructing-events">
+      create an event</a></dfn> and <dfn>
+      <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#firing-events">
+      fire an event</a></dfn> are defined in [[!DOM4]].
+      <p>
+        The <dfn>current temperature</dfn> is a value that represents the
+        ambient temperature in degrees Celsius.
+      </p>
+    </section>
+    
+    <section>
+      <h2>Security and privacy considerations</h2>
+      <p>
+      </p>
+    </section>
+    
+    <section>
+      <h2>Temperature</h2>
+      <p>
+        The HTML5 specification [[!HTML5]] defines a <a>Window</a> interface,
+        which this specification extends:
+      </p>
+      <dl title="partial interface Window" class="idl">
+        <dt>attribute EventHandler ontemperature</dt>
+        <dd>
+        </dd>
+      </dl>
+      <p>
+        The <code>ontemperature</code> event handler and its corresponding
+        event handler event type <code>ambienttemperature</code> MUST be supported
+        as an IDL attribute by all objects implementing the <a>Window</a>
+        interface.
+      </p>
+      <section>
+        <h2><a>AmbientTemperatureEvent</a> Interface</h2>
+        <dl title="[Constructor (DOMString type, optional AmbientTemperatureEventInit eventInitDict)]
+                   interface AmbientTemperatureEvent : Event"
+            class="idl" data-merge='AmbientTemperatureEventInit'>
+          <dt>readonly attribute double f</dt>
+          <dd>
+            The <a>current  temperature</a> expressed as fahrenheit.
+          </dd>
+          <dt>readonly attribute double c</dt>
+          <dd>
+            The <a>current  temperature</a> as celsius.
+          </dd>
+          <dt>readonly attribute double k</dt>
+          <dd>
+            The <a>current  temperature</a> expressed as kelvin.
+          When getting, </dd>
+          
+        </dl>
+        <dl title="dictionary AmbientTempEventInit : EventInit" class='idl'>
+          <dt>
+            double value
+          </dt>
+          <dd></dd>
+        </dl>
+        <p>
+          When a <dfn>user agent</dfn> is required to <dfn>fire an ambient temperature event</dfn>, the <dfn>user agent</dfn> MUST run the
+          following steps:
+        </p>
+        <ol class="rule">
+          <li>
+            <a>Create an event</a> that uses the <a>AmbientTemperatureEvent</a>
+            interface, with the name <code>temperature</code>, which
+            bubbles, is not cancelable, and has no default action, that also
+            meets the following conditions:
+            <ol>
+              <li>
+                If the implementation is unable to report the <a>current
+                ambient temperature</a>, initialize the <code>c</code>
+                attribute to positive Infinity, otherwise initialize the
+                attribute to the <a>current ambient temperature</a>.
+              </li>
+            </ol>
+          </li>
+          <li>
+            <a>Queue a task</a> to dispatch the newly created event at the
+            <a>Window</a> object.
+          </li>
+        </ol>
+        <p>
+          When the <a>current temperature</a> changes, the <a>user
+          agent</a> MUST <a>fire a ambient temperature event</a>.
+        </p>
+        <div class="note">
+          The definition of granularity i.e. how often the event is fired is
+          left to the implementation. Implementations may fire the event if
+          they have reason to believe that the page does not have sufficiently
+          fresh data.
+        </div>
+        <section>
+          <h2>Event handlers</h2>
+          <p>
+            The following are the <a>event handlers</a> (and their corresponding
+            <a>event handler event types</a>) that MUST be supported as
+            attributes by the <code>Window</code> object:
+          </p>
+          <table class="simple">
+            <thead>
+              <tr>
+                <th>event handler</th>
+                <th>event handler event type</th>
+              </tr>
+            </thead>
+            <tbody>
+              <tr>
+                <td><strong><code>ontemperature</code></strong></td>
+                <td><code>temperature</code></td>
+              </tr>
+            </tbody>
+          </table>
+        </section>
+      </section>
+    </section>
+      
+    <section class="appendix"></section>
+</body>
+</html>
Binary file wi-addendum-local-services/Example1_registration_page/Slide1.png has changed
Binary file wi-addendum-local-services/Example_device_and_service_description_pages/Slide1.png has changed
Binary file wi-addendum-local-services/Example_device_and_service_description_pages/Slide2.png has changed
Binary file wi-addendum-local-services/Example_scenario_1/Slide1.png has changed
Binary file wi-addendum-local-services/Example_scenario_1/Slide2.png has changed
Binary file wi-addendum-local-services/Example_scenario_1/Slide3.png has changed
Binary file wi-addendum-local-services/Example_scenario_2/Slide1.png has changed
Binary file wi-addendum-local-services/Example_scenario_2/Slide2.png has changed
Binary file wi-addendum-local-services/Example_scenario_2/Slide3.png has changed
Binary file wi-addendum-local-services/Example_scenario_2/Slide4.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wi-addendum-local-services/Overview.html	Sat Aug 25 00:52:13 2012 +0300
@@ -0,0 +1,736 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Web Intents Addendum - Local Services</title>
+    <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
+    <!-- 
+      === NOTA BENE ===
+      For the three scripts below, if your spec resides on dev.w3 you can check them
+      out in the same tree and use relative links so that they'll work offline,
+     -->
+    <script src='http://www.w3.org/Tools/respec/respec-w3c-common' class='remove'></script>
+    <script class='remove'>
+      var respecConfig = {
+          // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
+          specStatus:           "ED",
+          
+          // the specification's short name, as in http://www.w3.org/TR/short-name/
+          shortName:            "Web Intents-LD addendum",
+
+          // if your specification has a subtitle that goes below the main
+          // formal title, define it here
+          // subtitle   :  "an excellent document",
+
+          // if you wish the publication date to be other than today, set this
+          // publishDate:  "2009-08-06",
+
+          // if the specification's copyright date is a range of years, specify
+          // the start date here:
+          // copyrightStart: "2005"
+
+          // if there is a previously published draft, uncomment this and set its YYYY-MM-DD date
+          // and its maturity status
+          // previousPublishDate:  "1977-03-15",
+          // previousMaturity:  "WD",
+
+          // if there a publicly available Editor's Draft, this is the link
+          // edDraftURI:           "http://dev.w3.org/2009/dap/ReSpec.js/documentation.html",
+
+          // if this is a LCWD, uncomment and set the end of its review period
+          // lcEnd: "2009-08-05",
+
+          // if you want to have extra CSS, append them to this list
+          // it is recommended that the respec.css stylesheet be kept
+          extraCSS:             ["http://dev.w3.org/2009/dap/ReSpec.js/css/respec.css"],
+
+          // editors, add as many as you like
+          // only "name" is required
+          editors:  [
+              { name: "Claes Nilsson",
+                company: "Sony Mobile", companyURL: "http://www.sonymobile.com/se/" },
+              { name: "Norifumi Kikkawa",
+                company: "Sony Corporation", companyURL: "http://www.sony.net/"},
+          ],
+
+          // authors, add as many as you like. 
+          // This is optional, uncomment if you have authors as well as editors.
+          // only "name" is required. Same format as editors.
+
+          //authors:  [
+          //    { name: "Your Name", url: "http://example.org/",
+          //      company: "Your Company", companyURL: "http://example.com/" },
+          //],
+          
+          //
+          edDraftURI: "http://w3c-test.org/dap/wi-addendum-local-services/",
+          
+          // name of the WG
+          wg:           "DAP/Web Apps Web Intents task force",
+          
+          // URI of the public WG page
+          wgURI:        "http://www.w3.org/2009/dap/",
+          
+          // name (without the @w3c.org) of the public mailing to which comments are due
+          wgPublicList: "public-web-intents",
+          
+          // URI of the patent status for this WG, for Rec-track documents
+          // !!!! IMPORTANT !!!!
+          // This is important for Rec-track documents, do not copy a patent URI from a random
+          // document unless you know what you're doing. If in doubt ask your friendly neighbourhood
+          // Team Contact.
+          wgPatentURI:  "",
+      };
+    </script>
+  </head>
+  <body>
+    <section id='abstract'>
+      This specification is an addendum to Web Intents, [[!WEBINTENTS]], that defines how Web Intents enabled User Agents can discover and communicate 
+      with local Web Intents Services.
+    </section>
+    
+    <section class='informative'>
+      <h2>Introduction</h2>
+      <p>
+        Web Intents,[[!WEBINTENTS]], is a service discovery and light-weight RPC mechanism for web applications. The concept enables rich integration between web applications. 
+        A typical Web Intents scenario is:
+      </p>
+      <ol>
+         <li>Web Intents Services register their intention to handle an action for the user </li>
+         <li>A web application requests to start an action (share, edit, pick, view, ...)</li>
+         <li>The user selects which service to handle the action</li>
+      </ol>
+      <p>
+        A Web Intents Service is represented by a web page that declaratively marks itself as providing handling functionality for particular intents. Users register Web Intents Services 
+        by visiting web pages that contain registration markup.
+        However, the strength of Web Intents is the ability to provide web applications with access to Services residing not only in the cloud but also in local environments.
+      </p>
+      <p>
+        This specification defines optional extensions to Web Intents enabled User Agents to discover and dynamically register local Web Intents 
+        Services. Note that all details of the specific low level protocols used to discover and communicate with the local services are hidden to
+        the Client Web Applications.          
+      </p>   
+      <p>
+        The following code illustrates how a web application containing links to videos, can initiate video playback by creating and invoking a "video intent" as defined in [[!WEBINTENTS]].
+        This code is the same irrespective of whether the Service executing the intent action is a cloud based Service or a local Service.
+      </p>
+      <pre class="example sh_javascript_dom">
+      
+        // Create a new intent
+var intent = new Intent( "http://webintents.org/view","video/mp4",{ "src":videoCanvas.src, "img": videoCanvas.poster});
+					
+// Start intents picker 
+navigator.startActivity(intent,
+  // On Result
+  function(intentData) {console.log("player.html: On Result" + intentData);}, 
+  // On Failure
+  function(intentData) {console.log("player.html: On Failure" + intentData);});
+      </pre>
+      <p>
+        The example below briefly describes the steps taken when a Service on a local network, e.g. UPnP or mDNS, device is discovered and selected by 
+        the user.
+      </p>      
+      
+      <ol>
+         <li>Triggered by navigator.startActivity the User Agent will start local network discovery of Web Intents Services.</li>
+         <li>Replies from Web Intents enabled devices contain a URL to a Web Intents document, containing Web Intents Service registration 
+             markup, in the device. </li>
+         <li>The Web Intents documents are retrieved by the User Agent and the dynamically registered Services are visible in the Web Intents Service picker. </li>
+         <li>User selects Service.</li>
+         <li>User Agent retrieves the Service page from the the Web Intents local network device and invokes it. </li>
+         <li>The Service page handles the intent. </li>  
+         <li>When handling the intent is finished, the Service page issues window.intent.postResult and closes itself. </li>               
+      </ol>
+      
+    </section>
+    
+    <section id="conformance">     
+      <p>        
+        This specification defines conformance criteria that apply to:
+        <ul>
+          <li><dfn>UPnP enabled User Agent</dfn>: A <a>UPnP enabled User Agent</a> MUST support Web Intents [[!WEBINTENTS]] and the conformance criteria 
+          stated in this specification. </li>
+          <li><dfn>Web Intents enabled UPnP device</dfn>: A <a>Web Intents enabled UPnP device</a> MUST support [[!UPNP-DEVICEARCH]] and the conformance criteria 
+          stated in this specification. </li>
+          <li><dfn>mDNS enabled User Agent</dfn>: An <a>mDNS enabled User Agent</a> MUST support Web Intents [[!WEBINTENTS]] and the conformance criteria 
+          stated in this specification. </li>
+          <li><dfn>Web Intents enabled mDNS device</dfn>: A <a>Web Intents enabled mDNS device</a> MUST support [[!DNS-SD]], [[!MDNS]] and the conformance criteria 
+          stated in this specification. </li>
+        </ul>
+      </p>
+      <p>
+        Implementations that use ECMAScript to implement the APIs defined in
+        this specification must implement them in a manner consistent with the
+        ECMAScript Bindings defined in the Web IDL specification [[!WEBIDL]],
+        as this specification uses that specification and terminology.
+      </p>
+      <section>
+        <h2>Dependencies</h2>
+        <p>
+          This specification relies on the following specifications:
+          
+          <dl>
+            <dt>Web Intents</dt>
+            <dd>This addendum specification is dependent on and defines optional extensions to the basic Web Intents specification, [[!WEBINTENTS]]. </dd>
+            <dt>UPnP Device Architecture 1.0</dt>
+            <dd>This addendum specification is dependent on and defines vendor specific extensions to the UPnP Device Architecture 1.0 specification, [[!UPNP-DEVICEARCH]]. </dd>
+            <dt>IANA Service Name and Transport Protocol Port Number Registry</dt>
+            <dd>This addendum specification adds new entry on it, [[!IANA-SRVPORT-REG]]. </dd>
+            <dt>DNS-SD</dt>
+            <dd>This addendum specification is dependent on it, [[!DNS-SD]]. </dd>
+            <dt>mDNS</dt>
+            <dd>This addendum specification is dependent on it, [[!MDNS]]. </dd>
+         </dl>
+          
+        </p>      
+      </section>
+    </section>
+    
+    <section>
+      <h2>Terminology</h2>
+      <p>
+        Web Intents related terms are used according to section "Terminology" in [[!WEBINTENTS]].
+      </p>
+     
+      <section> 
+        <h3>UPnP related terms</h3>
+        <p>
+          UPnP related terms are used according to [[!UPNP-DEVICEARCH]]. 
+        </p>
+        <p>
+          The <a>UPnP enabled User Agent</a> has the role of a <dfn id="dfn-registration">control point</dfn>  according to UPnP terminology. 
+        </p>     
+        <p>
+          The <a>Web Intents enabled UPnP device</a> discovered by the <a>UPnP enabled User Agent</a> has the roles of <dfn id="dfn-registration">device</dfn> according to UPnP terminology. 
+        </p>        
+      </section>
+      
+      <section> 
+        <h3>mDNS related terms</h3>
+        <p>
+          The <a>mDNS enabled User Agent</a> has the role of a <dfn id="dfn-registration">DNS client</dfn> with capability of [[!DNS-SD]]. 
+        </p>
+        <p>
+          The <a>Web Intents enabled mDNS device</a> discovered by the <a>mDNS enabled User Agent</a> has the roles of <dfn id="dfn-registration">service</dfn> according to [[!MDNS]] and [[!DNS-SD]]. 
+        </p>        
+      </section>     
+      
+
+    </section>
+    
+    <section>
+    
+      <h2>UPnP adaptation</h2> 
+      
+      <section>   
+      
+        <h3><a>Web Intents enabled UPnP device</a></h3> 
+        
+        <p>
+          The <a>Web Intents enabled UPnP device</a> <em class="rfc2119" title="must">must</em> support this section.
+        </p>
+        
+        <section>    
+        
+          <h4>UPnP Web Intents serviceType</h4>
+          
+          <p>
+            The <a>Web Intents enabled UPnP device</a> <em class="rfc2119" title="must">must</em> support one UPnP service which serviceType is the <code>urn:schemas-webintents-org:service:WebIntents:1</code> 
+            as a vendor specific serviceType according to [[!UPNP-DEVICEARCH]]. It is vendor dependent how the <a>Web Intents enabled UPnP device</a> implements the serviceType, 
+            i.e. a device description of any deviceType could include this serviceType.
+          </p>  
+          
+          <p>          
+            The Web Intents serviceType <em class="rfc2119" title="must">must</em> have a dummy state variable, <code>X_State</code> of <code>boolean</code> data type to comform to [[!UPNP-DEVICEARCH]]
+            which requires one or more state variables in a serviceType. The <code>X_State</code> state variable is not used with a value and is never evented. 
+          </p>  
+          <p>
+            The Web Intents  serviceType has no standard action.          
+          </p>          
+
+          <p>
+            See below for the UPnP Service description document of the Web Intents serviceType.
+          </p>           
+          
+          <p align="left"><img src="Example_device_and_service_description_pages/Slide2.png" alt="Service description page" width="600" height="600" ><br>
+           (<a href="Example_device_and_service_description_pages/Slide2.png">View as PNG</a>)
+          </p>   
+             
+        
+        </section>   
+        
+        <section>    
+        
+          <h4>Web Intents specific SSDP headers</h4>           
+
+          <p>
+            The <a>Web Intents enabled UPnP device</a> <em class="rfc2119" title="must">must</em> support SSDP discovery process based on standard UPnP Discovery extended with 2 additional 
+            SSDP headers for M-SEARCH response and NOTIFY when ST/NT headers are:<code>urn:schemas-webintents-org:service:WebIntents:1</code>
+          </p>
+        
+          <ul>
+            <li>
+              <code>location.webintents.org</code>: <em class="rfc2119" title="required">required</em>. States the location to the Web Intents document in the <a>Web Intents enabled UPnP device</a>. 
+              If the value of this header is a relative URL the base URL is the base URL of the <code>LOCATION</code> header.  
+            </li>
+            <li>
+              <code>action.webintents.org</code>: <em class="rfc2119" title="optional">optional</em>. If supported, states the Web Intents 
+              <code>action</code> of the supported Web Intents Services and <em class="rfc2119" title="must">must</em>
+              match the <code>action</code> attributes of the Service registration markup in the Web Intents document. To support more than 
+              one Web Intents <code>action</code> the action strings <em class="rfc2119" title="must">must</em> be separated with 
+              comma. Commas included in action strings <em class="rfc2119" title="must">must</em> be percent-encoded as 
+              defined in [[!RFC3986]], section-2.1.
+              <br />  <br />
+              This header allows the <a>UPnP enabled User Agent</a> to filter received SSDP messages so that the <a>UPnP enabled User Agent</a> only has to 
+              retrieve Web Intents documents for matching Web Intents Actions.        
+            </li>
+          </ul>         
+
+        </section>   
+        
+        <section>    
+        
+          <h4>Web Intents document</h4>   
+
+          <p>
+            The <a>Web Intents enabled UPnP device</a> <em class="rfc2119" title="must">must</em> host Web Intents documents for the Web Intents Services the <a>Web Intents enabled UPnP device</a> supports. 
+            Web Intents documents are html pages that contain Web Intents Service registration markup according to the rules for Web Intents Service registration defined 
+            by [[!WEBINTENTS]]. They may also contain Service handler code for Services registered within the same document. 
+          </p>              
+        
+        </section>   
+        
+        <section>    
+        
+          <h4>Web Intents Service pages</h4>    
+          
+          <p>
+            The <a>Web Intents enabled UPnP device</a> <em class="rfc2119" title="must">must</em> host a Web Intents Service page for each Service that is 
+            referred in Web Intents documents through <code>href</code> attributes in the registration markup. 
+          </p>
+          <p>
+            Service pages contain Service handler code and fulfills the rules for Web Intents Services as defined by [[!WEBINTENTS]]. 
+          </p>   
+        
+        </section>          
+        
+      </section>   
+      
+      <section>
+      
+        <h3><a>UPnP enabled User Agent</a></h3> 
+        
+        <p>
+          The <a>UPnP enabled User Agent</a> <em class="rfc2119" title="must">must</em> support discovery of <a>Web Intents enabled UPnP device<a>s through SSDP Discovery or through Advertisement 
+          or through both methods according to [[!UPNP-DEVICEARCH]] and according to the Web Intents serviceType and Web Intents specific SSDP headers 
+          defined in this specification, section 4.1. 
+        </p>
+  
+        <p>
+          The sections below describe typical steps using these methods.
+        </p>
+       
+          <section class='informative'>
+            <h4>Dynamic Service registration based on M-SEARCH</h4>
+
+            <p>
+              The section describes the discovery process based on standard UPnP M-SEARCH multicast request.
+            </p>
+            
+            <p>
+              When the navigator.startActivity method [[!WEBINTENTS]] is called, the <a>UPnP enabled User Agent</a> runs the following steps:
+            </p>
+              
+            <ol class="rule">          
+              <li>
+                 Send a multicast request with the method M-SEARCH in the format specified by [[!UPNP-DEVICEARCH]].
+                 <br />
+                 The <code>ST</code> header is set to: <code>urn:schemas-webintents-org:service:WebIntents:1</code>
+              </li>
+              <br />
+              <li>
+                 For each matching M-SEARCH response, i.e. the response ST header is <code>urn:schemas-webintents-org:service:WebIntents:1</code> and the <code>action.webintents.org</code> 
+                 header, if present, matches the Action of the invoked intent, 
+                 the <a>UPnP enabled User Agent</a> attempts to retrieve the Web Intents document from the discovered <a>Web Intents enabled UPnP device</a>.              
+                 The value of the <code>location.webintents.org</code> header is the location for the Web Intents document. 
+                 If this value is a relative URL the <a>UPnP enabled User Agent</a> uses the base URL of the <code>LOCATION</code> header as base URL for the location of the 
+                 Web Intents document.  
+                 <br />  <br />
+                 If the <a>UPnP enabled User Agent</a> fails to retrieve the Web Intents document it silently disregards the received M-SEARCH response.
+                 <br />  <br />
+                 If the <code>action.webintents.org</code> header is present and does not match the <code>action</code> attributes of the Services registered in the retrieved Web Intents 
+                 document the <a>UPnP enabled User Agent</a> silently disregards the the received M-SEARCH response.
+              </li>
+              <br />         
+              <li>
+                 It is expected that the Web Intents document contains registration markup and the <a>UPnP enabled User Agent</a> interprets this
+                 registration markup according to the rules for registration defined by [[!WEBINTENTS]] and register the Services accordingly.           
+              </li>
+              <br />          
+              <li>
+                 The <a>UPnP enabled User Agent</a> makes each dynamically registered Service, that matches the Action of the invoked intent, available for selection 
+                 by the user, typically by making them visible and selectable in a Web Intents Service picker.                          
+              </li>
+              <br />          
+              <li>
+                 Based on user selection of a dynamically registered Service the <a>UPnP enabled User Agent</a> loads the 
+                 Service handler code as defined by the <code>href</code> attribute in the registration markup for this Service according to the rules for 
+                 loading Service pages defined in [[!WEBINTENTS]].                        
+              </li>
+      
+            </ol> 
+     
+          </section>
+          
+          <section class='informative'>
+            <h4>Dynamic Service registration based on NOTIFY</h4>
+            <p>
+              This section describes the discovery process based on standard UPnP Advertisement with NOTIFY message.            
+            </p> 
+           
+            <p>
+             The <a>UPnP enabled User Agent</a> <em class="rfc2119" title="may">may</em> continuously listen to and act on advertisments according to the following steps:
+            </p>   
+            <ol class="rule">   
+          
+              <li>
+                The <a>UPnP enabled User Agent</a> maintains a list of announced UPnP services based on received SSDP NOTIFY messages
+                with <code>NT</code> header equal to <code>urn:schemas-webintents-org:service:WebIntents:1</code>.
+              </li>
+              <br /> 
+              <li>
+                When the navigator.startActivity method [[!WEBINTENTS]] is called the <a>UPnP enabled User Agent</a> checks the list
+                of of announced services and attempts to retrieve the Web Intents document from the discovered <a>Web Intents enabled UPnP device</a> in the following cases:                
+                <ul>
+                  <li>
+                    The received NOTIFY message contains an <code>action.webintents.org</code> header and this header matches the Action of the invoked intent.
+                  </li>
+                  <li>
+                    The received NOTIFY message does not contain an <code>action.webintents.org</code> header.
+                  </li>                
+                </ul>
+                <br />     
+                The location of the Web Intents document is the value of the <code>location.webintents.org</code> header. If this value is a relative URL the
+                base URL is the base URL of the <code>LOCATION</code> header.  
+                <br />  <br />
+                If the <a>UPnP enabled User Agent</a> fails to retrieve the Web Intents document it silently disregards the received NOTIFY message.
+                <br />  <br />
+                If the <code>action.webintents.org</code> header does not match the <code>action</code> attribute in the retrieved Web Intents document 
+                the <a>UPnP enabled User Agent</a> silently disregards the received NOTIFY message.
+              </li>
+              <br />         
+              <li>
+                 It is expected that the Web Intents document contains registration markup and the <a>UPnP enabled User Agent</a> interprets the
+                 Web Intents document according to the rules for registration defined by [[!WEBINTENTS]] and register the Services accordingly.                         
+              </li>
+              <br />          
+              <li>
+                 The <a>UPnP enabled User Agent</a> makes each dynamically registered Service, that matches the Action of the invoked intent, available for selection 
+                 by the user, typically by making them visible and selectable in a Web Intents Service picker.                          
+              </li>
+              <br />          
+              <li>
+                 Based on user selection of a dynamically registered Service the <a>UPnP enabled User Agent</a> loads the 
+                 Service handler code as defined by the <code>href</code> attribute in the registration markup for this Service according to the rules for 
+                 loading Service pages defined in [[!WEBINTENTS]].                          
+              </li>
+            </ol> 
+             
+            <p class="note">
+              Power consumption in battery powered devices should be considered. If power consumption is severe continuously listening to SSDP advertisement in the background 
+              should not be used..          
+            </p> 
+          
+          </section>  
+          
+          <section class='informative'>  
+            <h4>Support for Web Intents and UPnP</h4>
+            <p>
+              In addition to the normative statements defined in this specification a <a>UPnP enabled User Agent</a> that complies to this specification 
+              supports Web Intents according to [[!WEBINTENTS]] and UPnP Discovery, Description and Control according to [[!UPNP-DEVICEARCH]]. 
+              However, it is implementation dependent whether this is supported natively in the User Agent or supported through some external component, 
+              e.g. an in-device web server. 
+            </p>         
+          </section>           
+          
+          <section class='informative'>
+      
+            <h4>Service availability management</h4>
+
+            <p>
+             The <a>UPnP enabled User Agent</a> should manage the availability of UPnP services. For example detect when contact with a <a>Web Intents enabled UPnP device</a> is lost through standard
+             UPnP life cycle management and remove a previously discovered and registered Service from the Service picker. However, for battery powered devices
+             power consumption should be considered and long lasting "keep alive" sessions" should be avoided.           
+            </p>        
+        
+          </section>
+
+      </section>        
+      
+   
+      
+    </section>   
+    
+    <section>
+    
+      <h2>mDNS (DNS-SD) adaptation</h2> 
+      
+      <p>
+        This section describes how the User Agent handles Web Intents Services provided by local devices supporting mDNS and DNS-SD.          
+      </p>
+
+      <section>   
+      
+        <h3>Web Intents enabled mDNS device</h3> 
+        
+        <p>
+          The <a>Web Intents enabled mDNS device</a> <em class="rfc2119" title="must">must</em> support this section.
+        </p>
+        
+        <section>    
+        
+          <h4>Web Intents service type for DNS-SD</h4>     
+          
+          <p>
+            The <a>Web Intents enabled mDNS device</a> <em class="rfc2119" title="must">must</em> support [[!DNS-SD]] with a SRV record of the <code>webintents</code> service type. 
+          </p>  
+          
+            <p class="note">
+              A service type <code>webintents</code> should be registered in [[!IANA-SRVPORT-REG]].
+            </p>
+
+          <p>          
+            The TXT record for the <code>webintents</code> service must have following parameters:           
+          </p>          
+          <ul>
+            <li>
+              <code>location</code>: <em class="rfc2119" title="required">required</em>. States the location to the Web Intents document in the <a class="internalDFN" href="#dfn-web-intents-enabled-mdns-device">Web Intents enabled mDNS device</a>. 
+              The value of this header is path to be concatenated with a host of the <a class="internalDFN" href="#dfn-web-intents-enabled-mdns-device">Web Intents enabled mDNS device</a> to determine the location. The definition of the Web Intents document is the same as for UPnP.
+            </li>
+            <li>
+              <code>action</code>: <em class="rfc2119" title="optional">optional</em>. If supported, states the Web Intents 
+              <code>action</code> of the supported Web Intents Services and <em class="rfc2119" title="must">must</em>
+              match the <code>action</code> attributes of the Service registration markup in the Web Intents document. To support more than 
+              one Web Intents <code>action</code> the action strings <em class="rfc2119" title="must">must</em> be separated with 
+              comma. Commas included in action strings <em class="rfc2119" title="must">must</em> be percent-encoded as 
+              defined in [[!RFC3986]], section-2.1.
+              <br>  <br>
+              This allows the <a>mDNS enabled User Agent</a> to filter received mDNS messages so that the <a>mDNS enabled User Agent</a> only has to 
+              retrieve Web Intents documents for matching Web Intents Actions.        
+            </li>
+          </ul>         
+
+        </section>   
+        
+      </section>   
+      <section>    
+        <h3>mDNS enabled User Agent</h3> 
+
+        <p>
+          The <a>mDNS enabled User Agent</a> <em class="rfc2119" title="must">must</em> support discovery of <a>Web Intents enabled mDNS device<a>s through mDNS and DNS-SD 
+          according to [[!MDNS]], [[!DNS-SD]] and according to the Web Intents specific DNS records defined in this specification, section 5.1. 
+        </p>
+        
+        <section class='informative'>
+          <h4>Dynamic Service registration</h4>   
+          <p>
+            When the navigator.startActivity method [[!WEBINTENTS]] is called, the <a>mDNS enabled User Agent</a> typically runs the following steps:
+          </p>
+            
+          <ol class="rule">          
+            <li>
+               Send a multicast PTR query of the <code>_webintents._tcp.local</code> in the format specified by [[!MDNS]] and [[!DNS-SD]].
+               <br />
+            </li>
+            <br />
+            <li>
+               For each response, send a unicast TXT query of the webintents service instance in the PTR answer.
+               <br />
+               <p>This step can be omitted in case that the Web Intents enabled mDNS device attaches a TXT answer with the previous answer.
+            </li>
+            <br />
+            <li>
+               For each matching response, i.e. the response TXT record does not have an action parameter or does have an <code>action</code> parameter matching the Action of the invoked intent,
+               send a unicast request with a SRV query of the webintens service instance.
+               <br />
+               <p>This step can be omitted in case that the Web Intents enabled mDNS device attaches a SRV answer with the previous answer.
+            </li>
+            <br />
+            <li>
+               For each response, send a unicast A and/or AAAA query of the host name in the SRV answer.
+               <br />
+               <p>This step can be omitted in case that the Web Intents enabled mDNS device attaches an A and/or AAAA answer with the previous answer.
+            </li>
+            <br />
+            <li>
+               The <a>mDNS enabled User Agent</a> attempts to retrieve the Web Intents document from the discovered <a>Web Intents enabled mDNS device</a>.
+               The destination URL consists of an IP address in the A or AAAA answer, a port number in the SRV record and an absolute path in the <code>location</code> parameter of the TXT record.  
+               <br />  <br />
+               If the <a>mDNS enabled User Agent</a> fails to retrieve the Web Intents document it silently disregards the received response.
+               <br />  <br />
+               If the <code>action</code> parameter is present and does not match the <code>action</code> attributes of the Services registered in the retrieved Web Intents 
+               document the <a>mDNS enabled User Agent</a> silently disregards the the received response.
+               <br />  <br />
+               Note that following steps are identical to those of UPnP described in 4.2.
+            </li>
+            <br />          
+            <li>
+               It is expected that the Web Intents document contains registration markup and the <a>mDNS enabled User Agent</a> interprets this
+               registration markup according to the rules for registration defined by [[!WEBINTENTS]] and register the Services accordingly.           
+            </li>
+            <br />          
+            <li>
+               The <a>mDNS enabled User Agent</a> makes each dynamically registered Service, that matches the Action of the invoked intent, available for selection 
+               by the user, typically by making them visible and selectable in a Web Intents Service picker.                          
+            </li>
+            <br />          
+            <li>
+               Based on user selection of a dynamically registered Service the <a>mDNS enabled User Agent</a> loads the 
+               Service handler code as defined by the <code>href</code> attribute in the registration markup for this Service according to the rules for 
+               loading Service pages defined in [[!WEBINTENTS]].                        
+            </li>
+    
+          </ol> 
+                 
+        </section>          
+
+      </section>    
+      <section class="informative">
+        <h3>Sample Records</h3> 
+        
+        <p>
+          See below for the example records for Web Intents. An <a>mDNS enabled User Agent</a> looking for devices supporting http://webintents.org/view Web Intents can understand that 
+          it is possible to get a Web Intents document for "LivingRoomTV" at http://192.168.1.47:3619/webintents.html.
+        </p>
+
+        <ul>
+          <li>
+            <code>_webintents._tcp.local. 120 IN PTR LivingRoomTV._webintents._tcp.local.</code>: A LivingRoomTV instance serves webintents service.
+          </li>
+          <li>
+            <code>LivingRoomTV._webintents._tcp.local. 120 IN SRV 0 0 3619 TV40EX-W2000.local.</code>: A host "TV40EX-W2000" in the link local network offers the LivingRoomTV webintents service instance in its port 3619.
+          </li>
+          <li>
+            <code>LivingRoomTV._webintents._tcp.local. 120 IN TXT location=/webintents.html action=http://webintents.org/view</code>: It offers http://webintents.org/view type of Web Intents. The absolete path for its Web Intents document is "/webintents.html". Note that the actual binary format of the TXT record value is concatinating key-value pairs each of which is a single byte length followed by 0-255 length key=value character string as defined in [DNS-SD].
+          </li>
+          <li>
+            <code>TV40EX-W2000 120 IN A 192.168.1.47</code>: A host "TV40EX-W2000" is on 192.168.1.47.
+          </li>
+        </ul>
+
+      </section>   
+                 
+    </section>         
+    
+        
+    <section class='informative'>
+      <h2>APIs / protocols Client - Service </h2>
+      <p>
+        The APIs / protocols for interaction between Client and Service pages are not defined by this specification. It is assumed that Web Intents 
+        based APIs and protocols will be standardized by W3C and that these will be applicable for Client and Service applications running on User Agents that
+        comply to this specification. Different use cases will require different ways of interaction patterns between Client and Service. 
+      </p>
+      
+      <p>
+        Examples:
+      </p>  
+      <ul>
+        <li>
+          A Client application invoking a "View" intent provides, as intent payload data, a link to a video to be displayed at the remote <a>Web Intents enabled UPnP device</a>.
+          The Service application takes full control of the video playback by providing control buttons and sends UPnP commands to the remote device.
+          So in this case there the simple "API" just gives the link to the video to play. 
+        </li>
+        <li>
+          Some use cases require a longer lasting relation between the Client and Service applications. By using the MessagePort[] attribute of the intent object 
+          a message channel can be established between the Client and Service page. This message channel can be used to run Service specific protocols, 
+          for example a protocol that allows the Client application to send simple video playback control commands to a Service application. 
+        </li>
+      </ul>          
+      
+    </section>  
+           
+    <section class='informative appendix'>
+    <h2>Examples and scenarios</h2>
+      <section>
+        <h3>View and control video on remote device through Service page control buttons</h3>
+        <p>
+          The following scenario describes how a Client page uses Web Intents to discover a remote video view service. The Service page 
+          contains the UI for controlling the video playback.
+        </p>
+        
+        <p align="left"><img src="Example_scenario_1/Slide1.png" alt="Example scenario 1/Slide1" width="700" height="700" ><br>
+         (<a href="Example_scenario_1/Slide1.png">View as PNG</a>)
+        </p>      
+        
+        <p align="left"><img src="Example_scenario_1/Slide2.png" alt="Example scenario 1/Slide2" width="700" height="700" ><br>
+         (<a href="Example_scenario_1/Slide2.png">View as PNG</a>)
+        </p> 
+        
+        <p align="left"><img src="Example_scenario_1/Slide3.png" alt="Example scenario 1/Slide3" width="700" height="700" ><br>
+         (<a href="Example_scenario_1/Slide3.png">View as PNG</a>)
+        </p>                 
+      </section>  
+      
+      <section>
+        <h3>View and control video on remote device through Client page control buttons</h3>
+        <p>
+          The following scenario describes how a Client page uses Web Intents to discover a remote video view service. The UI stays in the Client page, 
+          which contains the UI controls for the video playback. This means that there is a need for continuous communication between the Client page and the Service page,
+          which is "hidden", i.e. it has no UI. The Client page creates a messaging channel and sends the messaging channel port to the Service page trhrough the intent invocation.
+          A high level "TV control" protocol, supporting commands such as "play", "pause" and "stop, runs on top of the messaging channel. 
+        </p>
+        <p>
+          In this example the assumption is that he Client invokes an intent to discover a Service that supports a specified protocol running on top of the message channel So the 
+          "discover" intent Action is used and Type is set to the specific protocol used to communicate with the Service.
+        </p>
+        
+        <p class="issue">
+          This scenario assumes the possibility to have hidden/background Service pages or Service pages that are visible inline the Client page.
+          Currently [[!WEBINTENTS]] does not allow this but W3C DAP Action http://www.w3.org/2009/dap/track/actions/519 should add a proposal for a hidden disposition. 
+        </p>   
+        
+        <p align="left"><img src="Example_scenario_2/Slide1.png" alt="Example scenario 2/Slide1" width="700" height="700" ><br>
+         (<a href="Example_scenario_2/Slide1.png">View as PNG</a>)
+        </p>      
+        
+        <p align="left"><img src="Example_scenario_2/Slide2.png" alt="Example scenario 2/Slide2" width="700" height="700" ><br>
+         (<a href="Example_scenario_2/Slide2.png">View as PNG</a>)
+        </p> 
+        
+        <p align="left"><img src="Example_scenario_2/Slide3.png" alt="Example scenario 2/Slide3" width="700" height="700" ><br>
+         (<a href="Example_scenario_2/Slide3.png">View as PNG</a>)
+        </p>    
+        
+        <p align="left"><img src="Example_scenario_2/Slide4.png" alt="Example scenario 2/Slide4" width="700" height="700" ><br>
+         (<a href="Example_scenario_2/Slide4.png">View as PNG</a>)
+        </p>                       
+      </section>  
+            
+      
+    
+      <section>
+        <h3>Example of Web Intents document</h3>
+      
+        <p align="left"><img src="Example1_registration_page/Slide1.png" alt="Example1 registration page" width="280" height="280" ><br>
+         (<a href="Example1_registration_page/Slide1.png">View as PNG</a>)
+        </p>      
+      </section>      
+    
+      <section>
+        <h3>Example of UPnP Device description document</h3>
+        <p align="left"><img src="Example_device_and_service_description_pages/Slide1.png" alt="Example device and service description pages/Slide1" width="600" height="600" ><br>
+         (<a href="Example_device_and_service_description_pages/Slide1.png">View as PNG</a>)
+        </p>   
+      </section>
+            
+    </section>           
+    
+    <section class='appendix'>
+      <h3>Acknowledgements</h3>
+        <p>         
+          Many thanks to Sony colleagues Anders Isberg, Naoyuki Sato, Tatsuya Igarashi, Anders Edenbrandt and Björn Ekberg for all support.
+          <br />  <br />
+          Many thanks to Robin Berjon for making our lives so much easier with his cool specification editing tool.
+        </p>
+    </section>
+  </body>
+</html>
\ No newline at end of file