[whatwg] Offline Web Apps
Křištof Želechovski
giecrilj at stegny.2a.pl
Sat Sep 22 08:48:53 PDT 2007
I do not share your reservations. The file contents does not constitute its
property and, unlike properties, much work is actually needed to extract it.
Therefore the name chosen seems very appropriate.
How is the character encoding determined when the file is read as text? An
arbitrary file is a sequence of bytes and it is up to the application how
these bytes are interpreted as characters.
Moreover, a text file conceptually does not contain a string; it contains,
by convention, lines of text. The result of reading a file as text should
be a sequence of lines, not a string, with the line breaking characters
removed.
A text file can a printout; the difference is that a printout consists of
pages that consist of lines. Printouts are rare these times, but they do
appear from time to time. They can be distinguished from ordinary text
files by the presence of the form characters form feed and vertical tab.
The form feed is used to separate pages, the vertical tab is for
presentation only and should be converted to an empty line or two.
Cheers
Chris
-----Original Message-----
From: whatwg-bounces at lists.whatwg.org
[mailto:whatwg-bounces at lists.whatwg.org] On Behalf Of Maciej Stachowiak
Sent: Saturday, September 22, 2007 1:07 AM
To: Dave Camp
Cc: whatwg at whatwg.org; Ian Hickson; robert at ocallahan.org; Aaron Boodman
Subject: Re: [whatwg] Offline Web Apps
On Sep 21, 2007, at 10:49 AM, Dave Camp wrote:
> On 9/21/07, Robert O'Callahan <robert at ocallahan.org> wrote:
>> Actually we have an experimental API for this now. See here:
>>
http://mxr.mozilla.org/seamonkey/source/dom/public/idl/html/nsIDOMNSHTMLInpu
tElement.idl#55
>>
http://mxr.mozilla.org/seamonkey/source/content/base/public/nsIDOMFileList.i
dl
>>
http://mxr.mozilla.org/seamonkey/source/content/base/public/nsIDOMFile.idl
>> The core is:
>> readonly attribute DOMString fileName;
>> readonly attribute unsigned long long fileSize;
It would be nice if this was designed to handle the possibility of
multiple file selection (which I think Web Forms 2 enables).
>> DOMString getAsText(in DOMString encoding);
>> // raises(FileException) on retrieval
>> DOMString getAsDataURL();
>> // raises(FileException) on retrieval
>>
>> DOMString getAsBinary();
>> // raises(FileException) on retrieval
>>
>> These should be self-explanatory.
Minor nitpicks:
For the ones that don't take a parameter, I think a read-only
attribute would be more appropriate than a "get" function. It's
relatively rare for JS APIs to use no-arg getter instead of an
attribute, and even when it does it's rare for the function name to
start with "get".
More information about the whatwg
mailing list