Skip to content

Commit

Permalink
[gi] (2) Add Storage.clear(); define event dispatch for removeItem() …
Browse files Browse the repository at this point in the history
…and clear()

git-svn-id: http://svn.whatwg.org/webapps@1494 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Apr 28, 2008
1 parent 7fcc273 commit c8e6320
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 69 deletions.
135 changes: 83 additions & 52 deletions index
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<h1 id=html-5>HTML 5</h1>

<h2 class="no-num no-toc" id=working>Working Draft &mdash; 27 April 2008</h2>
<h2 class="no-num no-toc" id=working>Working Draft &mdash; 28 April 2008</h2>

<p>You can take part in this work. <a
href="http://www.whatwg.org/mailing-list">Join the working group's
Expand Down Expand Up @@ -31855,6 +31855,7 @@ interface <dfn id=storage0>Storage</dfn> {
[NameGetter] DOMString <a href="#getitem" title=dom-Storage-getItem>getItem</a>(in DOMString key);
[NameSetter] void <a href="#setitem" title=dom-Storage-setItem>setItem</a>(in DOMString key, in DOMString data);
[XXX] void <a href="#removeitem" title=dom-Storage-removeItem>removeItem</a>(in DOMString key); <!-- XXX [[Delete]] DOMB -->
void <a href="#clear0" title=dom-Storage-clear>clear</a>();
};</pre>
<!-- XXX v2 ideas:
a getInfo() method that returns an object that tells you:
Expand Down Expand Up @@ -31925,18 +31926,6 @@ interface <dfn id=storage0>Storage</dfn> {
the user has disabled storage for the domain, or if the quota has been
exceeded.)

<p>When the <code title=dom-Storage-setItem><a
href="#setitem">setItem()</a></code> method is invoked, events are fired
on other <code><a href="#htmldocument">HTMLDocument</a></code> objects
that can access the newly stored data, as defined in the sections on the
<code title=dom-sessionStorage><a
href="#sessionstorage">sessionStorage</a></code> and <code
title=dom-localStorage><a href="#localstorage">localStorage</a></code>
attributes.</p>
<!--
not normative, see the sections below for the normative statement
-->

<p>The <dfn id=removeitem
title=dom-Storage-removeItem><code>removeItem(<var
title="">key</var>)</code></dfn> method must cause the key/value pair with
Expand All @@ -31951,6 +31940,26 @@ interface <dfn id=storage0>Storage</dfn> {
data storage area must either be successful, or the data storage area must
not be changed at all.

<p>The <dfn id=clear0 title=dom-Storage-clear><code>clear()</code></dfn>
method must atomically cause the list associated with the object to be
emptied of all key/value pairs.

<p>When the <code title=dom-Storage-setItem><a
href="#setitem">setItem()</a></code>, <code
title=dom-Storage-removeItem><a
href="#removeitem">removeItem()</a></code>, and <code
title=dom-Storage-clear><a href="#clear0">clear()</a></code> methods are
invoked, events are fired on other <code><a
href="#htmldocument">HTMLDocument</a></code> objects that can access the
newly stored or removed data, as defined in the sections on the <code
title=dom-sessionStorage><a
href="#sessionstorage">sessionStorage</a></code> and <code
title=dom-localStorage><a href="#localstorage">localStorage</a></code>
attributes.</p>
<!--
not normative, see the sections below for the normative statement
-->

<h4 id=the-sessionstorage><span class=secno>4.10.3 </span>The <code
title=dom-sessionStorage><a
href="#sessionstorage">sessionStorage</a></code> attribute</h4>
Expand Down Expand Up @@ -32008,11 +32017,14 @@ interface <dfn id=storage0>Storage</dfn> {
other in any way.

<p id=sessionStorageEvent>When the <code title=dom-Storage-setItem><a
href="#setitem">setItem()</a></code> method is called on a <code><a
href="#storage0">Storage</a></code> object <var title="">x</var> that is
associated with a session storage area, then in every <code><a
href="#htmldocument">HTMLDocument</a></code> object whose <code><a
href="#window">Window</a></code> object's <code
href="#setitem">setItem()</a></code>, <code
title=dom-Storage-removeItem><a
href="#removeitem">removeItem()</a></code>, and <code
title=dom-Storage-clear><a href="#clear0">clear()</a></code> methods are
called on a <code><a href="#storage0">Storage</a></code> object <var
title="">x</var> that is associated with a session storage area, then in
every <code><a href="#htmldocument">HTMLDocument</a></code> object whose
<code><a href="#window">Window</a></code> object's <code
title=dom-sessionStorage><a
href="#sessionstorage">sessionStorage</a></code> attribute's <code><a
href="#storage0">Storage</a></code> object is associated with the same
Expand Down Expand Up @@ -32051,16 +32063,20 @@ interface <dfn id=storage0>Storage</dfn> {
local storage area, and return it.

<p id=localStorageEvent>When the <code title=dom-Storage-setItem><a
href="#setitem">setItem()</a></code> method is called on a <code><a
href="#storage0">Storage</a></code> object <var title="">x</var> that is
associated with a local storage area, then in every <code><a
href="#htmldocument">HTMLDocument</a></code> object whose <code><a
href="#window">Window</a></code> object's <code title=dom-localStorage><a
href="#localstorage">localStorage</a></code> attribute's <code><a
href="#storage0">Storage</a></code> object is associated with the same
storage area, other than <var title="">x</var>, a <code
title=event-storage><a href="#storage1">storage</a></code> event must be
fired, as <a href="#storage1" title=event-storage>described below</a>.
href="#setitem">setItem()</a></code>, <code
title=dom-Storage-removeItem><a
href="#removeitem">removeItem()</a></code>, and <code
title=dom-Storage-clear><a href="#clear0">clear()</a></code> methods are
called on a <code><a href="#storage0">Storage</a></code> object <var
title="">x</var> that is associated with a local storage area, then in
every <code><a href="#htmldocument">HTMLDocument</a></code> object whose
<code><a href="#window">Window</a></code> object's <code
title=dom-localStorage><a href="#localstorage">localStorage</a></code>
attribute's <code><a href="#storage0">Storage</a></code> object is
associated with the same storage area, other than <var title="">x</var>, a
<code title=event-storage><a href="#storage1">storage</a></code> event
must be fired, as <a href="#storage1" title=event-storage>described
below</a>.

<h4 id=the-storage0><span class=secno>4.10.5 </span>The <code
title=event-storage><a href="#storage1">storage</a></code> event</h4>
Expand All @@ -32077,19 +32093,34 @@ interface <dfn id=storage0>Storage</dfn> {
href="#storageevent">StorageEvent</a></code>, at <a href="#the-body1">the
body element</a> of each <a href="#active" title="active
document">active</a> <code><a href="#htmldocument">HTMLDocument</a></code>
object affected. The event must have its <code
title=dom-StorageEvent-key><a href="#key">key</a></code> attribute set to
the name of the key in question, its <code
title=dom-StorageEvent-oldValue><a href="#oldvalue">oldValue</a></code>
attribute set to the old value of the key in question, or null if the key
is newly added, its <code title=dom-StorageEvent-newValue>newValue</code>
attribute set to the new value of the key in question, or null if the key
was removed, its <code title=dom-StorageEvent-uri><a
object affected.

<p>If the event is being fired due to an invocation of the <code
title=dom-Storage-setItem><a href="#setitem">setItem()</a></code> or <code
title=dom-Storage-removeItem><a href="#removeitem">removeItem()</a></code>
methods, the event must have its <code title=dom-StorageEvent-key><a
href="#key">key</a></code> attribute set to the name of the key in
question, its <code title=dom-StorageEvent-oldValue><a
href="#oldvalue">oldValue</a></code> attribute set to the old value of the
key in question, or null if the key is newly added, and its <code
title=dom-StorageEvent-newValue>newValue</code> attribute set to the new
value of the key in question, or null if the key was removed.

<p>Otherwise, if the event is being fired due to an invocation of the <code
title=dom-Storage-clear><a href="#clear0">clear()</a></code> method, the
event must have its <code title=dom-StorageEvent-key><a
href="#key">key</a></code>, <code title=dom-StorageEvent-oldValue><a
href="#oldvalue">oldValue</a></code>, and <code
title=dom-StorageEvent-newValue>newValue</code> attributes set to null.

<p>In addition, the event must have its <code title=dom-StorageEvent-uri><a
href="#uri">uri</a></code> attribute set to the address of the page whose
<code><a href="#storage0">Storage</a></code> object was affected, and its
<code title=dom-StorageEvent-source><a href="#source0">source</a></code>
attribute set to the <code><a href="#window">Window</a></code> object of
the <span>browsing content</span> that that documents finds is in.</p>
the <span>browsing content</span> that that document is in, if the two
documents are in the same <a href="#unit-of">unit of related browsing
contexts</a>, or null otherwise.</p>
<!-- XXX onstorage should be defined -->

<h5 id=event0><span class=secno>4.10.5.1. </span>Event definition</h5>
Expand Down Expand Up @@ -40490,7 +40521,7 @@ function receiver(e) {
first and the most recently added element last (except for while steps 8
to 11 of the above algorithm are being executed, of course).

<p>When the steps below require the UA to <dfn id=clear0>clear the list of
<p>When the steps below require the UA to <dfn id=clear1>clear the list of
active formatting elements up to the last marker</dfn>, the UA must
perform the following steps:

Expand Down Expand Up @@ -44276,7 +44307,7 @@ function receiver(e) {
until an element with the same tag name as the token has been popped
from the stack.

<li><a href="#clear0">Clear the list of active formatting elements up to
<li><a href="#clear1">Clear the list of active formatting elements up to
the last marker</a>.
</ol>

Expand Down Expand Up @@ -44666,7 +44697,7 @@ function receiver(e) {
<dt>A start tag whose tag name is "caption"

<dd>
<p><a href="#clear1">Clear the stack back to a table context</a>. (See
<p><a href="#clear2">Clear the stack back to a table context</a>. (See
below.)</p>

<p>Insert a marker at the end of the <a href="#list-of4">list of active
Expand All @@ -44679,7 +44710,7 @@ function receiver(e) {
<dt>A start tag whose tag name is "colgroup"

<dd>
<p><a href="#clear1">Clear the stack back to a table context</a>. (See
<p><a href="#clear2">Clear the stack back to a table context</a>. (See
below.)</p>

<p><a href="#insert0">Insert an HTML element</a> for the token, then
Expand All @@ -44695,7 +44726,7 @@ function receiver(e) {
<dt>A start tag whose tag name is one of: "tbody", "tfoot", "thead"

<dd>
<p><a href="#clear1">Clear the stack back to a table context</a>. (See
<p><a href="#clear2">Clear the stack back to a table context</a>. (See
below.)</p>

<p><a href="#insert0">Insert an HTML element</a> for the token, then
Expand Down Expand Up @@ -44836,7 +44867,7 @@ function receiver(e) {
the <i><a href="#foster">foster parent element</a></i>.</p>
</dl>

<p>When the steps above require the UA to <dfn id=clear1>clear the stack
<p>When the steps above require the UA to <dfn id=clear2>clear the stack
back to a table context</dfn>, it means that the UA must, while the <a
href="#current5">current node</a> is not a <code><a
href="#table">table</a></code> element or an <code><a
Expand Down Expand Up @@ -44877,7 +44908,7 @@ function receiver(e) {
href="#caption0">caption</a></code> element has been popped from the
stack.</p>

<p><a href="#clear0">Clear the list of active formatting elements up to
<p><a href="#clear1">Clear the list of active formatting elements up to
the last marker</a>.</p>

<p>Switch the <span>insertion mode</span> to "<a href="#in-table"
Expand Down Expand Up @@ -45007,7 +45038,7 @@ function receiver(e) {
<dt>A start tag whose tag name is "tr"

<dd>
<p><a href="#clear2">Clear the stack back to a table body context</a>.
<p><a href="#clear3">Clear the stack back to a table body context</a>.
(See below.)</p>

<p><a href="#insert0">Insert an HTML element</a> for the token, then
Expand All @@ -45030,7 +45061,7 @@ function receiver(e) {

<p>Otherwise:</p>

<p><a href="#clear2">Clear the stack back to a table body context</a>.
<p><a href="#clear3">Clear the stack back to a table body context</a>.
(See below.)</p>

<p>Pop the <a href="#current5">current node</a> from the <a
Expand All @@ -45052,7 +45083,7 @@ function receiver(e) {

<p>Otherwise:</p>

<p><a href="#clear2">Clear the stack back to a table body context</a>.
<p><a href="#clear3">Clear the stack back to a table body context</a>.
(See below.)</p>

<p>Act as if an end tag with the same tag name as the <a
Expand All @@ -45073,7 +45104,7 @@ function receiver(e) {
<span>insertion mode</span>.</p>
</dl>

<p>When the steps above require the UA to <dfn id=clear2>clear the stack
<p>When the steps above require the UA to <dfn id=clear3>clear the stack
back to a table body context</dfn>, it means that the UA must, while the
<a href="#current5">current node</a> is not a <code><a
href="#tbody">tbody</a></code>, <code><a href="#tfoot0">tfoot</a></code>,
Expand All @@ -45096,7 +45127,7 @@ function receiver(e) {
<dt>A start tag whose tag name is one of: "th", "td"

<dd>
<p><a href="#clear3">Clear the stack back to a table row context</a>.
<p><a href="#clear4">Clear the stack back to a table row context</a>.
(See below.)</p>

<p><a href="#insert0">Insert an HTML element</a> for the token, then
Expand All @@ -45117,7 +45148,7 @@ function receiver(e) {

<p>Otherwise:</p>

<p><a href="#clear3">Clear the stack back to a table row context</a>.
<p><a href="#clear4">Clear the stack back to a table row context</a>.
(See below.)</p>

<p>Pop the <a href="#current5">current node</a> (which will be a <code><a
Expand Down Expand Up @@ -45163,7 +45194,7 @@ function receiver(e) {
<span>insertion mode</span>.</p>
</dl>

<p>When the steps above require the UA to <dfn id=clear3>clear the stack
<p>When the steps above require the UA to <dfn id=clear4>clear the stack
back to a table row context</dfn>, it means that the UA must, while the <a
href="#current5">current node</a> is not a <code><a
href="#tr">tr</a></code> element or an <code><a
Expand Down Expand Up @@ -45202,7 +45233,7 @@ function receiver(e) {
<p>Pop elements from this stack until an element with the same tag name
as the token has been popped from the stack.</p>

<p><a href="#clear0">Clear the list of active formatting elements up to
<p><a href="#clear1">Clear the list of active formatting elements up to
the last marker</a>.</p>

<p>Switch the <span>insertion mode</span> to "<a href="#in-row"
Expand Down
Loading

0 comments on commit c8e6320

Please sign in to comment.