- From: Andrew Betts <andrew.betts@ft.com>
- Date: Tue, 28 Aug 2012 10:24:35 +0100
- To: Jo Rabin <jo@linguafranca.org>
- Cc: W3C Coremob Community Group <public-coremob@w3.org>
- Message-ID: <CAC_dz-evzp6WGB-PXX-YjesUQ7Cde0dm+V1ZmnKYVwdKw_5FtQ@mail.gmail.com>
> > The current implementation is confusing because creates an unhelpful > affordance. It would actually be considerably improved by reversing the > semantics, so in terms of the property, rather than navigator.onLine, we > have navigator.offLine, which is false when online or in unknown state, and > true when offline. That would make it much clearer for developers who will > naturally tend to trust the positive assertion implied by the value being > true. The corresponding state-change events might be better renamed as > offlineStart and offlineEnd rather than offline and online for the same > reason. > > And these changes would also be backwards compatible. However, it really > depends how much enthusiasm there is for twiddling with semantics to make > behaviour clearer without functionally achieving anything. A non-normative > guideline on use of the existing implementation may be easier to achieve, > if a bit of a cop out :-) > > Happy to draft a resolution - are there any rules for doing so? > > > Keep it clean? :-) It depends on where we go with this, if the group > decides it would like to request the HTML5 group to do something then a > resolution would be a good thing. For my own part I'm mainly interested in > some example or what specifically you're suggesting here "Instead, it’s > better to use it to fail early and quickly when the device has a high > confidence of no network connection." > OK, well, that would translate into this I guess: PROPOSED RESOLUTION: The CG encourages the standards committee for HTML5 to issue non-normative guidance to developers as part of the HTML5 spec, advising that online events and a window.navigator.onLine value of true indicates, rather than that the user agent is online, that the user agent has no knowledge of the connection state. In short, that false means the UA is offline, while true means nothing. If members feel that there is appetite for a better syntax, we could instead adopt this: PROPOSED RESOLUTION: The existing navigator.onLine property and the online and offline events should be deprecated and replaced by navigator.offLine (with an exactly opposing definition) and the events offlineStart and offlineEnd, which will fire based on the same logic as currently underlies the offline and online events, respectively. But I feel it's probably not worth it. Incidentally, does anyone else think the capitalisation of navigator.offLine is weird, and inconsistent with the (probably more sensible) event names? Andrew -- ------------------------------ This email was sent by a company owned by Pearson plc, registered office at 80 Strand, London WC2R 0RL. Registered in England and Wales with company number 53723.
Received on Tuesday, 28 August 2012 09:25:01 UTC