W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2006

[whatwg] Wrong sample code in 4.9.1 of Web Application 1.0 spec

From: Channy Yun <channy@gmail.com>
Date: Sat, 3 Jun 2006 02:48:04 +0900
Message-ID: <3586624e0606021048q2e6fcaf4ge59e3d8d638924c2@mail.gmail.com>

As you know, Bon Echo Alpha3 starts to support client-side session and
persistent storage in Web Application 1.0 spec made by WHATWG. But, as
following sample code of 4.9.1 doesn't work in Bon Echo Alpha 3.

  You have viewed this page
  <span id="count">an untold number of</span>
  var storage = globalStorage['example.com'];
  if (!storage.pageLoadCount)
    storage.pageLoadCount = 0;
  storage.pageLoadCount += 1;
  document.getElementById('count').textContent = storage.pageLoadCount;

Only one line must be fixed.

->storage.pageLoadCount += 1;
+>storage.pageLoadCount = parseInt(storage.pageLoadCount) + 1;

It alway retruns string so it must be parsed to number.
I am not sure whether there is bug from spec or firefox.



Seokchan Yun, Mozilla Korean Community
Received on Friday, 2 June 2006 10:48:04 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:47 UTC