- From: Mounir Lamouri <mounir@lamouri.fr>
- Date: Sat, 03 Dec 2011 00:22:15 +0100
- To: public-device-status@w3.org
On 12/02/2011 11:24 PM, Carr, Wayne wrote: > Current text for charging attribute: "The attribute must be set to false > if the battery is discharging, and set to true, if the battery is > charging, full, the implementation is unable to report the state, or > there is no battery attached to the system, or otherwise. > > No exceptions." > > Suggested text for charging attribute: "The attribute must be set to > false if the battery is discharging, and set to true if the battery is > charging.If the implementation is unable to determine the state or there > is no battery attached to the system or for any other state not > explicitly defined, the attribute must be set to true. No exceptions." As I said in the previous thread, I believe this change would be okay. Actually, that's already what Gecko is doing: the battery can be discharging and have level=1.0. There is no valid reason to prevent that per-spec. Actually, it is useful for backends like Android where level has a precision of 0.01: it could last a few minutes between battery being unplugged and level moving from 1.00 to 0.99. > A Boolean probably isn’t the best thing here.Enumeration of {charging, > discharging, unknown} is an alternate fix. Such API would lead to mis-use and errors like: if (battery.chargingState == "charging") { } In addition, it will increase fingerprinting (assuming no battery would be in state "unknown"). Finally, it is not following the goal of this specification: always defaulting to a charging state (for already given reasons). -- Mounir
Received on Friday, 2 December 2011 23:22:38 UTC