[whatwg] Firing WebStorage storage event

Ian Hickson ian at hixie.ch
Tue Dec 18 14:29:45 PST 2012

On Wed, 3 Oct 2012, Janusz Majnert wrote:
> I would like to ask for your help. I'm having hard time understanding
> the rules for firing WebStorage's storage event.
> In section 11.2.3
> (http://www.whatwg.org/specs/web-apps/current-work/multipage/webstorage.html#the-localstorage-attribute)
> we have this sentence [1]:
> "
> When the setItem(), removeItem(), and clear() methods are called on a
> Storage object x that is associated with a local storage area, if the
> methods did something, then in every Document object whose Window
> object's localStorage attribute's Storage object is associated with
> the same storage area, other than x, a storage event must be fired, as
> described below.
> "
> "as described below" points to section 11.2.4, which reads [2]:
> "
> The storage event is fired when a storage area changes, as described
> in the previous two sections (for session storage, for local storage).
> When this happens, the user agent must queue a task to fire an event
> with the name storage, which does not bubble and is not cancelable,
> and which uses the StorageEvent interface, at each Window object whose
> Document object has a Storage object that is affected.
> "
> What I understood:
> Sentence [1] says that storage events should be fired on affected
> Document objects, except the one that originated the change.
> Sentences in [2]  say that when a storage event is fired as described
> in [1], a task must be queued to fire storage events on all affected
> Window objects. It also says that Document objects have Storage
> objects, which I don't think is true.
> Is my understanding correct? What am I missing?

This text was poorly written. I've fixed it. Thanks. Let me know if the 
new text is still confusing!

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list