From cb925ee1fc2325c1cc5f16800fec42f11604b7b0 Mon Sep 17 00:00:00 2001
From: Yoshiki Shibukawa Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
+ This specification defines an API to navigate file system hierarchies, and defines
+ a means by which a user agent may expose sandboxed sections of a
+ user's local filesystem to web applications. It builds on
+ [FILE-WRITER-ED], which in turn built on [FILE-API-ED], each adding a
+ different kind of functionality.
+ This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/. This document was published by the WebApps Working Group as a Working Draft. This document is intended to become a W3C Recommendation. If you wish to make comments regarding this document, please send them to public-webapps@w3.org (subscribe, archives). All feedback is welcome. Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress. This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy. As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative. The key words must, must not, required, should, should not, recommended, may, and optional in this specification are to be interpreted as described in [RFC2119].
+ This specification defines conformance criteria that apply to a single
+ product: a user agent that implements the interfaces that it
+ contains.
+ This section is non-normative.
+ This API is intended to satisfy client-side-storage use cases not
+ well served by databases. These are generally applications that involve
+ large binary blobs and/or share data with applications outside of the
+ browser.
+
+ It is intended to be minimal in extent, but sufficiently powerful that
+ easy-to-use libraries may be built on top of it.
+
+
+
+
+ This section is non-normative.
+ An application can request temporary or persistent
+ storage space. Temporary storage may be easier to get, at the UA's
+ discretion [looser quota restrictions, available without prompting the
+ user], but the data stored there may be deleted at the UA's
+ convenience, e.g. to deal with a shortage of disk space.
+
+ Conversely, once persistent storage has been granted, data
+ stored there by the application should not be deleted by the UA
+ without user intervention. The application may of course delete it at
+ will. The UA should require permission from the user before granting
+ persistent storage space to the application.
+
+ This API specifies the standard origin isolation in a filesystem
+ context, along with persistence of data across invocations.
+ Applications will likely use temporary storage for caching, and
+ if it's still around from a previous session, it is often useful.
+ Persistent data, on the other hand, is useless if you can't access it
+ again the next time you're invoked. However, even persistent
+ data may be deleted manually by the user [either through the UA or via
+ direct filesystem operations].
+ This section is non-normative.
+ Because this API may allow untrusted code to read and write parts of a
+ user's hard drive, there are a number of security and privacy issues
+ that must be dealt with. Risks to the user include:
+
+ As with any other client-side storage, filesystem access allows for
+ cookie-resurrection attacks. UAs will likely wish to present the
+ option of clearing it when the user clears any other origin-specific
+ storage, blocking access to it when cookies are blocked, etc. This is
+ especially important if temporary storage space is permitted by
+ default without explicit user permission.
+
+ There are several ways in which a file system entry point can be
+ obtained. Not all user agents may in fact implement all of
+ them. However, in order to avoid blocking UI actions while waiting on
+ filesystem IO, we define only an asynchronous interface for Window,
+ and restrict the synchronous API to the Worker context defined in
+ [WEBWORKERS-ED].
+ All instances of the All instances of the
+ Requests a filesystem in which to store application data.
+
+ If successful, this function must give access to an
+ origin-private filesystem, as defined above.
+
+ Allows the user to look up the Entry for a file or directory
+ referred to by a local URL.
+ All instances of the
+ Requests a filesystem in which to store application data.
+
+ If successful, this function must give access to an
+ origin-private filesystem, as defined above.
+
+ Allows the user to look up the Entry for a file or directory
+ referred to by a local URL.
+
+ This interface represents a file system.
+
+ An abstract interface representing entries in a file system, each of
+ which may be a File or
+ Copy an entry to a different location on the file system.
+ It is an error to try to:
+
+ Look up metadata about this entry.
+
+ Move an entry to a different location on the file system.
+ It is an error to try to:
+
+ Deletes a file or directory. It is an error to attempt to delete
+ a directory that is not empty. It is an error to attempt to
+ delete the root directory of a filesystem.
+
+ Returns a URL that can be used to identify this entry.
+ Unlike the URN defined in [FILE-API-ED], it has no specific
+ expiration; as it describes a location on disk, it should be valid
+ at least as long as that location exists.
+
+ Do we want to spec out the URL format/scheme? It would be quite
+ nice if these could be edited and manipulated easily, as with
+ normal filesystem paths.
+
+ How and where can these URLs be used? Can they be interchangeable
+ with online URLs for the same domain?
+
+ Proposal currently under discussion:
+
+ This interface represents a directory on a file system.
+
+ Creates a new DirectoryReader to read Entries from this Directory.
+
+ Creates or looks up a directory.
+
+ Creates or looks up a file.
+
+ Deletes a directory and all of its contents, if any. In the event
+ of an error [e.g. trying to delete a directory that contains a
+ file that cannot be removed], some of the contents of the
+ directory may be deleted. It is an error to attempt to delete the
+ root directory of a filesystem.
+
+ This interface lets a user list files and directories in a directory.
+ If there are no additions to or deletions from a directory between the
+ first and last call to readEntries, and no errors occur, then:
+
+ Read the next block of entries from this directory.
+
+ This interface represents a file on a file system.
+
+ Creates a new FileWriter associated with the file
+ that this
+ Returns a File that represents the current state of
+ the file that this
+ Several calls in this API are asynchronous, and use callbacks.
+
+ When
+ The file system was successfully obtained.
+
+ This interface is the callback used to look up Entry objects.
+
+ When
+ This interface is the callback used to look up file and directory
+ metadata.
+
+ This interface is the callback used to create a
+ FileWriter.
+
+ Used to supply a FileWriter as a response to a user
+ query.
+
+ This interface is the callback used to obtain a File.
+
+ This interface is the generic callback used to indicate success of
+ an asynchronous method.
+
+ When an error occurs, the following callback is made:
+
+ This interface represents a file system.
+
+ An abstract interface representing entries in a file system, each of
+ which may be a
+ Copy an entry to a different location on the file system.
+ It is an error to try to:
+
+ Look up metadata about this entry.
+
+ Move an entry to a different location on the file system.
+ It is an error to try to:
+
+ Deletes a file or directory. It is an error to attempt to delete
+ a directory that is not empty. It is an error to attempt to
+ delete the root directory of a filesystem.
+
+ Returns a URL that can be used to identify this entry.
+ Unlike the URN defined in [FILE-API-ED], it has no specific
+ expiration; as it describes a location on disk, it should be valid
+ at least as long as that location exists.
+
+ This interface represents a directory on a file system.
+
+ Creates a new DirectoryReaderSync to read EntrySyncs from this
+ DirectorySync.
+
+ Creates or looks up a directory.
+
+ Creates or looks up a file.
+
+ Deletes a directory and all of its contents, if any. In the event
+ of an error [e.g. trying to delete a directory that contains a
+ file that cannot be removed], some of the contents of the
+ directory may be deleted. It is an error to attempt to delete the
+ root directory of a filesystem.
+
+ This interface lets a user list files and directories in a directory.
+ If there are no additions to or deletions from a directory between the
+ first and last call to readEntries, and no errors occur, then:
+
+ Read the next block of entries from this directory.
+
+ This interface represents a file on a file system.
+
+ Creates a new FileWriterSync associated with the file
+ that this
+ Returns a File that represents the current state of
+ the file that this This section is non-normative.
+ Error conditions can occur when attempting to write files. The list
+ below of potential error conditions is informative, with links to
+ normative descriptions of errors:
+
+ An operation on a file may fail due to the file [or a parent directory]
+ having been removed before the operation is attempted. See
+ NotFoundError.
+
+ An operation on a file may not make sense, e.g. moving a directory into
+ one of its own children. See InvalidModificationError.
+
+ An operation on a file may not make sense if the underlying filesystem
+ has had changes made since the reference was obtained. See
+ TypeMismatchError, InvalidStateError.
+
+ Users may accidentally attempt to create a file where another already
+ exists. See PathExistsError.
+
+ Synchronous methods must throw an exception of the
+ most appropriate type in the table below if there has been an error with
+ writing.
+
+ If an error occurs while processing an asynchronous method,
+ the
+ In order to make it easy for web app developers to write portable
+ applications that work on all platforms, we enforce certain restrictions
+ and make certain guarantees with respect to paths used in this API.
+ This section is non-normative.
+ Paths in this filesystem must be case sensitive and case-preserving.
+
+ Implementations must accept any valid UTF-8 sequence
+ as a path segment, so long as it does not include any characters
+ or sequences restricted below. When returning paths or path segments,
+ implementations must return them in the same normalization in which
+ they were presented.
+ File and directory names must not contain either of the following
+ characters:
+
+ There's been discussion on whether backslash '\' (U+005c) should be
+ disallowed or not. In favor of leaving it in is that it's a legal
+ character on some filesystems, and it seems somewhat arbitrary to
+ remove it. Opposed is that it may cause confusion, and in at least
+ some cases complicates implementation.
+
+ The directory separator is '/' (U+002F).
+
+ The character '/', when it is the first character in a path, refers to
+ the root directory.
+
+ All absolute paths begin with '/'; no relative paths begin with '/'.
+
+ A relative path describes how to get from a particular
+ directory to a file or directory. All methods that accept paths are on
+
+ An absolute path is a relative path from the root
+ directory, prepended with a '/'.
+
+ '.', when used where it is legal to use a directory name, refers to the
+ currently-referenced directory. Thus 'foo/./bar' is equivalent to
+ 'foo/bar', and './foo' is equivalent to 'foo'.
+
+ '..', when used where it is legal to use a directory name, refers to the
+ parent of the currently-referenced directory. Thus, 'foo/..' refers to
+ the directory containing 'foo', and '../foo' refers to an element named
+ 'foo' in the parent of the directory on whose DirectoryEntry or
+ DirectoryEntrySync the method receiving the path is being called.
+
+ What about path and path segment lengths? Should we limit them at
+ all? It's hard to control the true length of a path, due to
+ renames of parent directories, so we really just want to reject the
+ obviously-too-long; they won't often really come up anyway.
+ We should at least provide minimum lengths for paths and segments.
+
+ Should we limit the number of elements in a directory?
+
+ Thanks to Arun Ranganathan for his File API, Opera for theirs, and Robin
+ Berjon both for his work on various file APIs and for ReSpec.
+ No informative references. Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
+ This specification defines an API for writing to files from web applications.
+ This API is designed to be used in conjunction with, and depends on
+ definitions in, other APIs and elements on the web platform. Most
+ relevant among these are [FILE-API-ED] and [WEBWORKERS-ED].
+
+ This API includes:
+ This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/. This document represents the early consensus of the group on
+ the scope and features of the proposed File API: Writer. Issues and
+ editors notes in the document highlight some of
+ the points on which the group is still working and would
+ particularly like to get feedback. This document was published by the WebApps Working Group as a Working Draft. This document is intended to become a W3C Recommendation. If you wish to make comments regarding this document, please send them to public-webapps@w3.org (subscribe, archives). All feedback is welcome. Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress. This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy. As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative. The key words must, must not, required, should, should not, recommended, may, and optional in this specification are to be interpreted as described in [RFC2119].
+ This specification defines conformance criteria that apply to a single
+ product: user agents that implement the interfaces that it
+ contains.
+
+ Everything in this specification is normative except for examples and
+ sections marked as being informative.
+
+ The keywords must, must not, required, shall, shall not, should, should
+ not, recommended, may, and optional in this document are to be
+ interpreted as described in Key words for use in RFCs to
+ Indicate Requirement Levels [RFC2119].
+
+ The following conformance classes are defined by this specification:
+
+ A user agent is considered to be a conforming
+ implementation if it satisfies all of the must-, required- and
+ shall-level criteria in this specification that apply to
+ implementations.
+
+ The terms and algorithms event handler attributes, event
+ handler event types, Function, task,
+ task queue, task source, and queue a
+ task are defined by the HTML 5 specification [HTML5].
+
+ When this specification refers to a write method, it includes
+ both
+ When this specification refers to a write algorithm, it
+ includes the algorithm invoked by any write method as well as the
+ FileSaver write algorithm.
+
+ When this specification says to terminate an algorithm the
+ user agent must terminate the algorithm after finishing the step it is
+ on. Any write algorithm defined in this specification can be
+ terminated by an abort() call.
+
+ When this specification says to make progress notifications,
+ the following are normative:
+
+ When this specification says to fire a progress event called
+
+
+ The term Blob is defined by the File API specification
+ [FILE-API-ED].
+
+ The term ArrayBuffer is defined by the Typed Arrays
+ specification [TYPED-ARRAYS].
+
+ This specification includes algorithms (steps) as part of the definition
+ of methods. Conforming implementations (referred to as user
+ agents from here on) may use other algorithms in the
+ implementation of these methods, provided the end result is the same.
+ This section is non-normative.
+ Web applications are currently fairly limited in how they can write to
+ files. One can present a link for download, but creating and writing
+ files of arbitrary type, or modifying downloaded files on their way to
+ the disk, is difficult or impossible. This specification defines an
+ API through which user agents can permit applications to write
+ generated or downloaded files.
+
+ The [FILE-API-ED] defined interfaces for reading files, manipulation
+ of Blobs of data, and errors raised by file accesses. This
+ specification extends that work with a way to construct Blobs and
+ with synchronous and asynchronous file-writing interfaces. As with
+ reading, writing files on the main thread should happen asynchronously
+ to avoid blocking UI actions. Long-running writes provide status
+ information through delivery of progress events.
+
+ Here is a simple function that writes a text file, given a FileWriter:
+
+ Here's an example of obtaining and using a
+ The BlobBuilder is used to construct Blobs.
+
+ Appends the supplied text to the current contents of the
+
+ This parameter specifies how strings containing
+ Appends the supplied Blob to the current contents of the
+
+ Appends the supplied ArrayBuffer to the current contents of the
+
+ Returns the current contents of the
+ When the
+ This constructor must be visible when the script's global object is
+ either a Window object or an object implementing the WorkerUtils
+ interface.
+
+ This interface provides methods to monitor the asynchronous writing of
+ blobs to disk using progress events [PROGRESS-EVENTS-ED] and event
+ handler attributes.
+
+ This interface is specified to be used within the context of the global
+ object (Window [HTML5]) and within Web Workers (WorkerUtils
+ [WEBWORKERS-ED]).
+
+ The last error that occurred on the
+ Handler for abort events.
+
+ Handler for error events.
+
+ Handler for progress events.
+
+ Handler for write events.
+
+ Handler for writeend events.
+
+ Handler for writestart events.
+
+ The FileSaver object can be in one of 3 states. The
+
+ When the
+ The
+ When the
+ This constructor must be visible when the script's global object is
+ either a Window object or an object implementing the WorkerUtils
+ interface.
+
+ The
+ After its constructor has returned, a new FileSaver must asynchronously
+ execute the following steps. They are referred to elsewhere as the
+ FileSaver write algorithm.
+
+ The following are the event handler attributes (and their
+ corresponding event handler event types) that user agents must
+ support on
+ It seems like this should have a blocking constructor and no methods
+ or properties, if it's to follow the constructor-based model of the
+ asynchronous interface. A global method seems like it would be
+ cleaner, though. Is it important that they match? If so, the asynch
+ constructor could turn into a method instead.
+
+ It's been pointed out that a method name like "saveAs" is too short
+ and generic; any global symbol should be longer and more explicit in
+ order to avoid confusion and naming conflicts.
+
+ This interface expands on the
+ The length of the file. If the user does not have read access to the
+ file, this must be the highest byte offset at which the user has
+ written.
+
+ The byte offset at which the next write to the file will occur.
+ This must be no greater than
+ Seek sets the file position at which the next write will occur.
+
+ When the
+ If nonnegative, an absolute byte offset into the file.
+ Changes the length of the file to that specified. If shortening the
+ file, data beyond the new length must be discarded. If extending
+ the file, the existing data must be zero-padded up to the new
+ length.
+
+ When the
+ Write the supplied data to the file at
+ This interface lets users write, truncate, and append to files using
+ simple synchronous calls.
+
+ This interface is specified to be used only within Web Workers
+ (WorkerUtils [WEBWORKERS-ED]).
+
+ The length of the file. If the user does not have read access to
+ the file, this must be the highest byte offset at which the user has
+ written.
+
+ The byte offset at which the next write to the file will occur.
+ This must be no greater than
+ Seek sets the file position at which the next write will occur.
+
+ Changes the length of the file to that specified. If shortening the
+ file, data beyond the new length must be discarded. If extending
+ the file, the existing data must be zero-padded up to the new
+ length.
+
+ Upon successful completion:
+
+ Write the supplied data to the file at This section is non-normative.
+ Error conditions can occur when attempting to write files. The list
+ below of potential error conditions is informative, with links to
+ normative descriptions of errors:
+
+ The directory containing the file being written may not exist at the
+ time an asynchronous or synchronous write method is called. This
+ may be due to it having been moved or deleted after a reference to it
+ was acquired (e.g. concurrent modification with another
+ application).
+ The file being written may have been removed. If the file is not there,
+ writing to an offset other than zero is not permitted.
+ A file may be unwritable. This may be due to permission problems that
+ occur after a reference to a file has been acquired (e.g. concurrent
+ lock with another application).
+ User agents may determine that some files are unsafe for use within web
+ applications. Additionally, some file and directory structures may be
+ considered restricted by the underlying filesystem; attempts to write to
+ them may be considered a security violation. See the security
+ considerations.
+ A web application may attempt to initiate a write, seek, or truncate via
+ a FileWriter in the
+ During the writing of a file, the web application may itself wish to
+
+ A web application may request unsupported line endings.
+ See SyntaxError.
+
+ As documented in [FILE-API-ED], various errors may occur during
+ reading from the Blob that is the source of the data to be written.
+ These include NotFoundError, SecurityError, and
+ NotReadableError.
+
+ Synchronous write methods must throw an exception of the
+ most appropriate type in the table below if there has been an error with
+ writing.
+
+ If an error occurs while processing an asynchronous write method,
+ the This section is non-normative.
+ Most of the security issues pertaining to writing to a file on the
+ user's drive are the same as those involved in downloading arbitrary
+ files from the Internet. The primary difference [in the case of
+ FileWriter] stems from the fact that the file may be continuously
+ written and re-written, at least until such a time as it is deemed
+ closed by the user agent. This has an impact on disk quota, IO
+ bandwidth, and on processes that may require analysing the content of
+ the file.
+
+ When a user grants an application write access to a file, it doesn't
+ necessarily imply that the app should also receive read access to that
+ file or any of that file's metadata [including length]. This
+ specification describes a way in which that information can be kept
+ secret for write-only files. If the application has obtained a
+
+ Where quotas are concerned, user agents may wish to monitor the
+ size of the file(s) being written and possibly interrupt the script and
+ warn the user if certain limits of file size, remaining space, or disk
+ bandwidth are reached.
+
+ Other parts of the download protection tool-chain such as flagging files
+ as unsafe to open, refusing to create dangerous file names, and making
+ sure that the mime type of a file matches its extension may naturally
+ be applied.
+
+ Thanks to Arun Ranganathan for his File API, Opera for theirs, and Robin
+ Berjon both for his work on various file APIs and for ReSpec.
+ No informative references. This is the 28 June 2013 Editor's Draft of CSSOM. Please send comments to
+ This is the 5 September 2013 Editor's Draft of CSSOM. Please send comments to
www-style@w3.org
(archived)
with [cssom] at the start of the subject line.
@@ -162,16 +162,18 @@ must disclose the information in accordance with
File API: Directories and System
W3C Working Draft 17 April 2012
Abstract
Status of This Document
Table of Contents
FileSystem
interfaceEntry
interfaceDirectoryEntry
interfaceDirectoryReader
interfaceFileEntry
interface1. Conformance
2. Introduction
2.1 Use Cases
+
+
+
+
+
+
+
+
+
+
+
+
+ 2.2 Examples
+ // In the DOM or worker context:
+
+function useAsyncFS(fs) {
+ // see getAsText example in [FILE-API-ED].
+ fs.root.getFile("already_there.txt", null, function (f) {
+ getAsText(f.file());
+ });
+
+ // But now we can also write to the file; see [FILE-WRITER-ED].
+ fs.root.getFile("logFile", {create: true}, function (f) {
+ f.createWriter(writeDataToLogFile);
+ });
+}
+requestFileSystem(TEMPORARY, 1024 * 1024, function(fs) {
+ useAsyncFS(fs);
+});
+
+// In a worker:
+
+var tempFS = requestFileSystem(TEMPORARY, 1024 * 1024);
+var logFile = tempFS.root.getFile("logFile", {create: true});
+var writer = logFile.createWriter();
+writer.seek(writer.length);
+writeDataToLogFile(writer);
+ 3. Terminology
+
+
+ The term throw in this specification, as it pertains to
+ exceptions, is used as defined in the DOM4 specification [DOM4].
+ 4. Data Persistence and accessing the API
+ 4.1 Temporary vs. Persistent Storage
4.2 Restrictions
+ FileSystem
and FileSystemSync
objects returned by
+ requestFileSystem
must have the following properties:
+
+
+
+
+ then the FileSystem
or FileSystemSync
returned from
+ the subsequent request must refer to the same underlying filesystem
+ and root directory as the previous request.
+
+ then the FileSystem
or FileSystemSync
returned from
+ the subsequent request should refer to the same underlying
+ filesystem and root directory as the previous request.4.3 Security Considerations
+
+
+
+
+ This may be mitigated by restricting file creation/rename to
+ non-executable extensions, virtualizing paths [leading to
+ unguessable or non-executable filenames] and by making sure the
+ execute bit is not set on any file created or modified via the API.
+ 4.4 Obtaining access to file system entry points
+ 4.4.1 Using
+ LocalFileSystem
Window implements
LocalFileSystem
;Window
type are defined to also implement the LocalFileSystem
interface.WorkerGlobalScope implements
LocalFileSystem
;WorkerGlobalScope
type are defined to also implement the LocalFileSystem
interface.[Supplemental, NoInterfaceObject]
+interface LocalFileSystem {
+ const unsigned short TEMPORARY = 0;
+ const unsigned short PERSISTENT = 1;
+ void requestFileSystem (unsigned short type, unsigned long long size,
FileSystemCallback
successCallback, optional ErrorCallback
errorCallback);
+ void resolveLocalFileSystemURL (DOMString url, EntryCallback
successCallback, optional ErrorCallback
errorCallback);
+};
+4.4.1.1 Methods
requestFileSystem
Parameter Type Nullable Optional Description type unsigned short
✘ ✘
+ Whether the filesystem requested should be persistent,
+ as defined above. Use one of TEMPORARY
or
+ PERSISTENT
.
+ size unsigned long long
✘ ✘
+ This is an indicator of how much storage space, in bytes, the
+ application expects to need.
+ successCallback FileSystemCallback
✘ ✘
+ The callback that is called when the user agent provides
+ a filesystem.
+ errorCallback ErrorCallback
✘ ✔
+ A callback that is called when errors happen, or when the
+ request to obtain the filesystem is denied.
+ void
resolveLocalFileSystemURL
Parameter Type Nullable Optional Description url DOMString
✘ ✘
+ A URL referring to a local file in a filesystem accessable via
+ this API.
+ successCallback EntryCallback
✘ ✘
+ A callback that is called to report the Entry to which the
+ supplied URL refers.
+ errorCallback ErrorCallback
✘ ✔
+ A callback that is called when errors happen, or when the
+ request to obtain the Entry is denied.
+ void
4.4.1.2 Constants
PERSISTENT
of type unsigned shortTEMPORARY
of type unsigned short4.4.2 Using
+ LocalFileSystemSync
WorkerGlobalScope implements
LocalFileSystemSync
;WorkerGlobalScope
type are defined to also implement the LocalFileSystemSync
interface.[Supplemental, NoInterfaceObject]
+interface LocalFileSystemSync {
+ const unsigned short TEMPORARY = 0;
+ const unsigned short PERSISTENT = 1;
+
FileSystemSync
requestFileSystemSync (unsigned short type, unsigned long long size);
+ EntrySync
resolveLocalFileSystemSyncURL (DOMString url);
+};
+4.4.2.1 Methods
requestFileSystemSync
Parameter Type Nullable Optional Description type unsigned short
✘ ✘
+ Whether the filesystem requested should be persistent,
+ as defined above. Use one of TEMPORARY
or
+ PERSISTENT
.
+ size unsigned long long
✘ ✘
+ This is an indicator of how much storage space, in bytes, the
+ application expects to need.
+ FileSystemSync
resolveLocalFileSystemSyncURL
Parameter Type Nullable Optional Description url DOMString
✘ ✘
+ A URL referring to a local file in a filesystem accessable via
+ this API.
+ EntrySync
4.4.2.2 Constants
PERSISTENT
of type unsigned shortTEMPORARY
of type unsigned short6. The asynchronous filesystem interface
+ 6.1 The
+ FileSystem
interfaceinterface FileSystem {
+ readonly attribute DOMString name;
+ readonly attribute
DirectoryEntry
root;
+};
+6.1.1 Attributes
name
of type DOMString, readonlyroot
of type DirectoryEntry
, readonly6.2 The
+ Entry
interfaceDirectoryEntry
.
+ interface Entry {
+ readonly attribute boolean isFile;
+ readonly attribute boolean isDirectory;
+ void getMetadata (
MetadataCallback
successCallback, optional ErrorCallback
errorCallback);
+ readonly attribute DOMString name;
+ readonly attribute DOMString fullPath;
+ readonly attribute FileSystem
filesystem;
+ void moveTo (DirectoryEntry
parent, optional DOMString newName, optional EntryCallback
successCallback, optional ErrorCallback
errorCallback);
+ void copyTo (DirectoryEntry
parent, optional DOMString newName, optional EntryCallback
successCallback, optional ErrorCallback
errorCallback);
+ DOMString toURL ();
+ void remove (VoidCallback
successCallback, optional ErrorCallback
errorCallback);
+ void getParent (EntryCallback
successCallback, optional ErrorCallback
errorCallback);
+};
+6.2.1 Attributes
filesystem
of type FileSystem
, readonlyfullPath
of type DOMString, readonlyisDirectory
of type boolean, readonlyisFile
of type boolean, readonlyname
of type DOMString, readonly6.2.2 Methods
copyTo
+
+ A copy of a file on top of an existing file must attempt to
+ delete and replace that file.
+ A copy of a directory on top of an existing empty directory must
+ attempt to delete and replace that directory.
+ Directory copies are always recursive--that is, they copy all
+ contents of the directory.
+
+
+ Parameter Type Nullable Optional Description parent DirectoryEntry
✘ ✘
+ The directory to which to move the entry.
+ newName DOMString
✘ ✔
+ The new name of the entry. Defaults to the Entry's current name
+ if unspecified.
+ successCallback EntryCallback
✘ ✔
+ A callback that is called with the Entry for the new object.
+ errorCallback ErrorCallback
✘ ✔
+ A callback that is called when errors happen.
+ void
getMetadata
Parameter Type Nullable Optional Description successCallback MetadataCallback
✘ ✘
+ A callback that is called with the time of the last
+ modification.
+ errorCallback ErrorCallback
✘ ✔
+ A callback that is called when errors happen.
+ void
getParent
Parameter Type Nullable Optional Description successCallback EntryCallback
✘ ✘
+ A callback that is called to return the parent Entry.
+ errorCallback ErrorCallback
✘ ✔
+ A callback that is called when errors happen.
+ void
moveTo
+
+ A move of a file on top of an existing file must attempt to
+ delete and replace that file.
+ A move of a directory on top of an existing empty directory must
+ attempt to delete and replace that directory.
+
+
+ Parameter Type Nullable Optional Description parent DirectoryEntry
✘ ✘
+ The directory to which to move the entry.
+ newName DOMString
✘ ✔
+ The new name of the entry. Defaults to the Entry's current name
+ if unspecified.
+ successCallback EntryCallback
✘ ✔
+ A callback that is called with the Entry for the new location.
+ errorCallback ErrorCallback
✘ ✔
+ A callback that is called when errors happen.
+ void
remove
Parameter Type Nullable Optional Description successCallback VoidCallback
✘ ✘
+ A callback that is called on success.
+ errorCallback ErrorCallback
✘ ✔
+ A callback that is called when errors happen.
+ void
toURL
+
+
+ filesystem:http://example.domain/persistent-or-temporary/path/to/file.html
.DOMString
6.3 The
+ DirectoryEntry
interfaceinterface DirectoryEntry :
Entry
{
+ DirectoryReader
createReader ();
+ void getFile (DOMString path, optional Flags
options, optional EntryCallback
successCallback, optional ErrorCallback
errorCallback);
+ void getDirectory (DOMString path, optional Flags
options, optional EntryCallback
successCallback, optional ErrorCallback
errorCallback);
+ void removeRecursively (VoidCallback
successCallback, optional ErrorCallback
errorCallback);
+};
+6.3.1 Methods
createReader
DirectoryReader
getDirectory
Parameter Type Nullable Optional Description path DOMString
✘ ✘
+ Either an absolute path or a relative path from
+ this DirectoryEntry to the directory to be looked up or created.
+ It is an error to attempt to create a directory whose immediate
+ parent does not yet exist.
+ options Flags
✘ ✔
+
+
+ create
and exclusive
are both
+ true and the path already exists, getDirectory must fail.create
is true, the path doesn't exist,
+ and no other error occurs, getDirectory must create and return
+ a corresponding DirectoryEntry.create
is not true and the path doesn't
+ exist, getDirectory must fail.create
is not true and the path exists,
+ but is a file, getDirectory must fail.successCallback EntryCallback
✘ ✔
+ A callback that is called to return the DirectoryEntry selected
+ or created.
+ errorCallback ErrorCallback
✘ ✔
+ A callback that is called when errors happen.
+ void
getFile
Parameter Type Nullable Optional Description path DOMString
✘ ✘
+ Either an absolute path or a relative path from
+ this DirectoryEntry to the file to be looked up or created. It
+ is an error to attempt to create a file whose immediate parent
+ does not yet exist.
+ options Flags
✘ ✔
+
+
+ create
and exclusive
are both
+ true, and the path already exists, getFile must fail.create
is true, the path doesn't exist,
+ and no other error occurs, getFile must create it as a
+ zero-length file and return a corresponding FileEntry.create
is not true and the path doesn't
+ exist, getFile must fail.create
is not true and the path exists,
+ but is a directory, getFile must fail.successCallback EntryCallback
✘ ✔
+ A callback that is called to return the File selected or
+ created.
+ errorCallback ErrorCallback
✘ ✔
+ A callback that is called when errors happen.
+ void
removeRecursively
Parameter Type Nullable Optional Description successCallback VoidCallback
✘ ✘
+ A callback that is called on success.
+ errorCallback ErrorCallback
✘ ✔
+ A callback that is called when errors happen.
+ void
6.4 The
+ DirectoryReader
interface
+
+
+ interface DirectoryReader {
+ void readEntries (
EntriesCallback
successCallback, optional ErrorCallback
errorCallback);
+};
+6.4.1 Methods
readEntries
Parameter Type Nullable Optional Description successCallback EntriesCallback
✘ ✘
+ Called once per successful call to readEntries to deliver the
+ next previously-unreported set of Entries in the associated
+ Directory. If all Entries have already been returned from
+ previous invocations of readEntries, successCallback must be
+ called with a zero-length array as an argument.
+ errorCallback ErrorCallback
✘ ✔
+ A callback indicating that there was an error reading from the
+ Directory.
+ void
6.5 The
+ FileEntry
interfaceinterface FileEntry :
Entry
{
+ void createWriter (FileWriterCallback
successCallback, optional ErrorCallback
errorCallback);
+ void file (FileCallback
successCallback, optional ErrorCallback
errorCallback);
+};
+6.5.1 Methods
createWriter
FileEntry
represents.
+ Parameter Type Nullable Optional Description successCallback FileWriterCallback
✘ ✘
+ A callback that is called with the new FileWriter.
+ errorCallback ErrorCallback
✘ ✔
+ A callback that is called when errors happen.
+ void
file
FileEntry
represents.
+ Parameter Type Nullable Optional Description successCallback FileCallback
✘ ✘
+ A callback that is called with the File.
+ errorCallback ErrorCallback
✘ ✔
+ A callback that is called when errors happen.
+ void
6.6 Callbacks
+ 6.6.1 The
+ FileSystemCallback
interfacerequestFileSystem()
succeeds, the following
+ callback is made:
+ [Callback=FunctionOnly]
+interface FileSystemCallback {
+ void handleEvent (
FileSystem
filesystem);
+};
+6.6.1.1 Methods
handleEvent
Parameter Type Nullable Optional Description filesystem FileSystem
✘ ✘
+ The file systems to which the app is granted access.
+ void
6.6.2 The
+ EntryCallback
interface[Callback=FunctionOnly]
+interface EntryCallback {
+ void handleEvent (
+ Entry
entry);
+};
+6.6.3 The
+ EntriesCallback
interfacereadEntries()
succeeds, the following callback is
+ made.
+ [Callback=FunctionOnly]
+interface EntriesCallback {
+ void handleEvent (
+ Entry
[] entries);
+};
+6.6.4 The
+ MetadataCallback
interface[Callback=FunctionOnly]
+interface MetadataCallback {
+ void handleEvent (
+ Metadata
metadata);
+};
+6.6.5 The
+ FileWriterCallback
interface[Callback=FunctionOnly]
+interface FileWriterCallback {
+ void handleEvent (FileWriter fileWriter);
+};
+
6.6.5.1 Methods
handleEvent
Parameter Type Nullable Optional Description fileWriter FileWriter
✘ ✘ void
6.6.6 The
+ FileCallback
interface[Callback=FunctionOnly]
+interface FileCallback {
+ void handleEvent (File file);
+};
+
+ 6.6.7 The
+ VoidCallback
interface[Callback=FunctionOnly]
+interface VoidCallback {
+ void handleEvent ();
+};
+
6.6.7.1 Methods
handleEvent
void
6.6.8 The
+ ErrorCallback
interface[Callback=FunctionOnly]
+interface ErrorCallback {
+ void handleEvent (DOMError err);
+};
+
+ 7. The synchronous filesystem interface
+ 7.1 The
+ FileSystemSync
interfaceinterface FileSystemSync {
+ readonly attribute DOMString name;
+ readonly attribute
DirectoryEntrySync
root;
+};
+7.1.1 Attributes
name
of type DOMString, readonlyroot
of type DirectoryEntrySync
, readonly7.2 The
+ EntrySync
interfaceFileEntrySync
or DirectoryEntrySync
.
+ interface EntrySync {
+ readonly attribute boolean isFile;
+ readonly attribute boolean isDirectory;
+
Metadata
getMetadata ();
+ readonly attribute DOMString name;
+ readonly attribute DOMString fullPath;
+ readonly attribute FileSystemSync
filesystem;
+ EntrySync
moveTo (DirectoryEntrySync
parent, optional DOMString newName);
+ EntrySync
copyTo (DirectoryEntrySync
parent, optional DOMString newName);
+ DOMString toURL ();
+ void remove ();
+ DirectoryEntrySync
getParent ();
+};
+7.2.1 Attributes
filesystem
of type FileSystemSync
, readonlyfullPath
of type DOMString, readonlyisDirectory
of type boolean, readonlyisFile
of type boolean, readonlyname
of type DOMString, readonly7.2.2 Methods
copyTo
+
+ A copy of a file on top of an existing file must attempt to
+ delete and replace that file.
+ A copy of a directory on top of an existing empty directory must
+ attempt to delete and replace that directory.
+ Directory copies are always recursive--that is, they copy all
+ contents of the directory.
+
+
+ Parameter Type Nullable Optional Description parent DirectoryEntrySync
✘ ✘
+ The directory to which to move the entry.
+ newName DOMString
✘ ✔
+ The new name of the entry. Defaults to the EntrySync's current
+ name if unspecified.
+ EntrySync
getMetadata
Metadata
getParent
DirectoryEntrySync
moveTo
+
+ A move of a file on top of an existing file must attempt to
+ delete and replace that file.
+ A move of a directory on top of an existing empty directory must
+ attempt to delete and replace that directory.
+
+
+ Parameter Type Nullable Optional Description parent DirectoryEntrySync
✘ ✘
+ The directory to which to move the entry.
+ newName DOMString
✘ ✔
+ The new name of the entry. Defaults to the EntrySync's current
+ name if unspecified.
+ EntrySync
remove
void
toURL
DOMString
7.3 The
+ DirectoryEntrySync
interfaceinterface DirectoryEntrySync :
EntrySync
{
+ DirectoryReaderSync
createReader ();
+ FileEntrySync
getFile (DOMString path, optional Flags
options);
+ DirectoryEntrySync
getDirectory (DOMString path, optional Flags
options);
+ void removeRecursively ();
+};
+7.3.1 Methods
createReader
DirectoryReaderSync
getDirectory
Parameter Type Nullable Optional Description path DOMString
✘ ✘
+ Either an absolute path or a relative path from
+ this DirectoryEntrySync to the directory to be looked up or
+ created. It is an error to attempt to create a directory whose
+ immediate parent does not yet exist.
+ options Flags
✘ ✔
+
+
+ create
and exclusive
are both
+ true and the path already exists, getDirectory must fail.create
is true, the path doesn't exist,
+ and no other error occurs, getDirectory must create and return
+ a corresponding DirectoryEntry.create
is not true and the path doesn't
+ exist, getDirectory must fail.create
is not true and the path exists,
+ but is a file, getDirectory must fail.DirectoryEntrySync
getFile
Parameter Type Nullable Optional Description path DOMString
✘ ✘
+ Either an absolute path or a relative path from
+ this DirectoryEntrySync to the file to be looked up or created.
+ It is an error to attempt to create a file whose immediate
+ parent does not yet exist.
+ options Flags
✘ ✔
+
+
+ create
and exclusive
are both
+ true and the path already exists, getFile must fail.create
is true, the path doesn't exist,
+ and no other error occurs, getFile must create it as a
+ zero-length file and return a corresponding FileEntry.create
is not true and the path doesn't
+ exist, getFile must fail.create
is not true and the path exists,
+ but is a directory, getFile must fail.FileEntrySync
removeRecursively
void
7.4 The
+ DirectoryReaderSync
interface
+
+
+ interface DirectoryReaderSync {
+
EntrySync
[] readEntries ();
+};
+7.4.1 Methods
readEntries
EntrySync
[]7.5 The
+ FileEntrySync
interfaceinterface FileEntrySync :
EntrySync
{
+ FileWriterSync createWriter ();
+ File file ();
+};
+7.5.1 Methods
createWriter
FileEntrySync
represents.
+ FileWriterSync
file
FileEntrySync
represents.
+ File
8. Errors and Exceptions
+ 8.1 Occurrence
8.2 Definitions
+ err
argument to the ErrorCallback
must
+ be a DOMError object [DOM4] of the most appropriate
+ type from the table below.
+ Error Descriptions
+
+
+
+
+
+
+ Name Description
+
+ EncodingError
+
+ A path or URL supplied to the API was malformed.
+
+
+
+ InvalidModificationError
+
+ The modification requested was illegal. Examples of invalid
+ modifications include moving a directory into its own child,
+ moving a file into its parent directory without changing its
+ name, or copying a directory to a path occupied by a file.
+
+
+
+ InvalidStateError
+
+ An operation depended on state cached in an interface object,
+ but that state that has changed since it was read from disk.
+
+
+
+ NotFoundError
+
+ A required file or directory could not be found at the time an
+ operation was processed.
+
+
+
+ NotReadableErr
+
+ A required file or directory could be read.
+
+
+
+ NoModificationAllowedError
+
+ The user attempted to write to a file or directory
+ which could not be modified due to the state of the underlying
+ filesystem.
+
+
+
+ PathExistsError
+
+ The user agent failed to create a file or directory due
+ to the existence of a file or directory with the same path.
+
+
+
+ QuotaExceededError
+
+ The operation failed because it would cause the application to
+ exceed its storage quota.
+
+
+
+ SecurityError
+
+
+
+
+ This is a security error code to be used in situations not
+ covered by any other error codes.
+
+
+
+ TypeMismatchError
+
+ The user has attempted to look up a file or directory, but the
+ Entry found is of the wrong type [e.g. is a DirectoryEntry
+ when the user requested a FileEntry].
+
+ 9. Uniformity of interface
+ 9.1 Case-sensitivity
+ 9.2 Encoding
+ 9.3 Naming restrictions
+
+
+ 9.4 Directories
+ DirectoryEntry
or DirectoryEntrySync
objects; the paths,
+ if relative, are interpreted as being relative to the directories
+ represented by these objects.
+ A. Acknowledgements
+ B. References
B.1 Normative references
B.2 Informative references
File API: Writer
W3C Working Draft 17 April 2012
Abstract
+
+
+
+ BlobBuilder
interface, which enables one to build a
+ Blob from a String.
+ FileSaver
interface, which provides methods to write a
+ Blob to a file, and an event model to monitor the
+ progress of those writes.FileWriter
interface, which expands on FileSaver to add
+ a richer set of output options.FileWriterSync
interface, which provides methods to
+ write and modify files synchronously in a Web Worker.Status of This Document
Table of Contents
1. Conformance
+
+
+ 2. Terminology and Algorithms
+ write
and truncate
.
+
+
+
+ progress
at the
+ FileSaver
object about every 50ms or for every byte written,
+ whichever is less frequent.progress
+ must fire before write
is fired, and at 100% completion
+ of the write operation; if 100% of the file can written in less than
+ 50ms, user agents must fire a progress event called
+ progress
at completion.e
(for some ProgressEvent
e
), the
+ following are normative:
+
+
+
+ The term throw in this specification, as it pertains to
+ exceptions, is used as defined in the DOM4 specification [DOM4].
+ e
does not bubble.
+ e.bubbles
must be false [DOM4].e
is NOT cancelable.
+ e.cancelable
must be false [DOM4].3. Introduction
3.1 Examples
+ function writeFile(writer) {
+ function done(evt) {
+ alert("Write completed.");
+ }
+ function error(evt) {
+ alert("Write failed:" + evt);
+ }
+
+ var bb = new BlobBuilder();
+ bb.append("Lorem ipsum");
+ writer.onwrite = done;
+ writer.onerror = error;
+ writer.write(bb.getBlob());
+}
+ FileSaver
:
+ var bb = new BlobBuilder();
+bb.append("Lorem ipsum");
+var fileSaver = window.saveAs(bb.getBlob(), "test_file");
+fileSaver.onwriteend = myOnWriteEnd;
+
+ 4. The
+ BlobBuilder
interface[Constructor]
+interface BlobBuilder {
+ Blob getBlob (optional DOMString contentType);
+ void append (DOMString text, optional DOMString endings);
+ void append (Blob data);
+ void append (ArrayBuffer data);
+};
+
4.1 Methods
append
BlobBuilder
, writing it as UTF-8, converting newlines as
+ specified in endings
.
+ Parameter Type Nullable Optional Description text DOMString
✘ ✘
+ The data to write.
+ endings DOMString
✘ ✔
+ \n
+ are to be written out. If the user does not provide the
+ endings
parameter, user agents must act as
+ if the user had specified a value of 'transparent'. If the user
+ provides the endings
parameter, user agents
+ must convert newlines as specified below. The possible values
+ are:
+
+
+
+ Value Description
+
+ "transparent"
+
+ Code points from the string must remain unchanged.
+
+
+
+ "native"
+
+ Newlines must be transformed to the default line-ending
+ representation of the underlying host operating system. For
+ example, if the underlying OS is Windows, newlines will be
+ transformed into
+ \r\n
pairs as the text is
+ appended to the state of the BlobBuilder.
+ void
append
BlobBuilder
.
+ Parameter Type Nullable Optional Description data Blob
✘ ✘
+ The data to append.
+ void
append
BlobBuilder
.
+ Parameter Type Nullable Optional Description data ArrayBuffer
✘ ✘
+ The data to append.
+ void
getBlob
BlobBuilder
as a
+ Blob.
+ Parameter Type Nullable Optional Description contentType DOMString
✘ ✔
+ Sets the content type of the blob produced.
+ Blob
4.2 Constructor
+ BlobBuilder
constructor is invoked, user agents
+ must return a new BlobBuilder
object.
+ 5. The
+ FileSaver
interface[Constructor(Blob data)]
+interface FileSaver : EventTarget {
+ void abort ();
+ const unsigned short INIT = 0;
+ const unsigned short WRITING = 1;
+ const unsigned short DONE = 2;
+ readonly attribute unsigned short readyState;
+ readonly attribute DOMError error;
+ [TreatNonCallableAsNull]
+ attribute Function onwritestart;
+ [TreatNonCallableAsNull]
+ attribute Function onprogress;
+ [TreatNonCallableAsNull]
+ attribute Function onwrite;
+ [TreatNonCallableAsNull]
+ attribute Function onabort;
+ [TreatNonCallableAsNull]
+ attribute Function onerror;
+ [TreatNonCallableAsNull]
+ attribute Function onwriteend;
+};
+
5.1 Attributes
error
of type DOMError, readonlyFileSaver
.
+ onabort
of type Functiononerror
of type Functiononprogress
of type Functiononwrite
of type Functiononwriteend
of type Functiononwritestart
of type FunctionreadyState
of type unsigned short, readonlyreadyState
attribute, on getting, must return the
+ current state, which must be one of the following values:
+ 5.2 Methods
abort
abort
method is called, user agents
+ must run the steps below:
+
+
+
+ readyState == DONE
or
+ readyState == INIT
, terminate this
+ overall series of steps without doing anything else.readyState
to DONE
.error
attribute to a
+ DOMError
object of type "AbortError".abort
writeend
void
5.3 Constants
DONE
of type unsigned shortINIT
of type unsigned shortWRITING
of type unsigned short5.4 The FileSaver Constructor
+ FileSaver(data)
constructor takes one argument: the
+ Blob of data to be saved to a file.
+ FileSaver
constructor is called, the user agent
+ must return a new FileSaver
object with readyState
+ set to INIT
.
+ 5.5 The FileSaver Task Source
+
+ FileSaver
interface enables asynchronous writes on
+ individual files by dispatching events to event handler methods. Unless
+ stated otherwise, the task source that is used in this
+ specification is the FileSaver
. This task source is
+ used for any event task that is asynchronously dispatched, or for
+ event tasks that are queued for dispatching.
+
+
+ readyState
to WRITING
.
+
+
+
error
attribute; on getting the
+ error
attribute must be a
+ DOMError
object whose type
+ indicates the kind of error that has occurred.DONE
.error
.writeend
.writestart
.
+
+ DONE
.write
.writeend
.5.6 Event Handler Attributes
+
as DOM attributes:
+ FileSaver
+
+
+
+
+
+
+ event handler attribute
+ event handler event type
+
+
+
+
+
+ onwritestart
+ writestart
+
+
+
+
+ onprogress
+ progress
+
+
+
+
+ onwrite
+ write
+
+
+
+
+ onabort
+ abort
+
+
+
+
+ onerror
+ error
+
+
+
+ onwriteend
+ writeend
6. The
+ FileSaverSync
interface7. The
+ FileWriter
interfaceFileSaver
interface to allow for
+ multiple write actions, rather than just saving a single Blob.
+ interface FileWriter :
FileSaver
{
+ readonly attribute unsigned long long position;
+ readonly attribute unsigned long long length;
+ void write (Blob data);
+ void seek (long long offset);
+ void truncate (unsigned long long size);
+};
+7.1 Attributes
length
of type unsigned long long, readonlyposition
of type unsigned long long, readonlylength
.
+ A newly-created FileWriter must have position set to 0.
+ 7.2 Methods
seek
seek
method is called, user agents must
+ run the steps below.
+
+
+
+
+ readyState
is WRITING
,
+ throw an InvalidStateError and terminate this series
+ of steps.position
to offset
.position > length
then set
+ position
to length.position < 0
then set
+ position
to position + length
.position < 0
then set
+ position
to 0
.Parameter Type Nullable Optional Description offset long long
✘ ✘
+
+ If negative, an offset back from the end of the file.
+ void
truncate
truncate
method is called, user agents
+ must run the steps below (unless otherwise indicated).
+
+
+
+
+ readyState
is WRITING
, throw
+ an InvalidStateError and terminate this series of steps.readyState
to WRITING
.
+
+ error
attribute; on getting the
+ error
attribute must be a
+ DOMError
object whose type
+ indicates the kind of error that has occurred.DONE
.error
.writeend
length
and
+ position
attributes should indicate any
+ modification to the file.writestart
.
+
+ length
must be equal to size
.position
must be the lesser of
+
+
+ size
.
+
+ DONE
.write
writeend
Parameter Type Nullable Optional Description size unsigned long long
✘ ✘
+ The size to which the length of the file is to be adjusted,
+ measured in bytes.
+ void
write
position
. When
+ the write
method is called, user agents must run
+ the steps below (unless otherwise indicated).
+
+
+
+
+ readyState
is WRITING
,
+ throw an InvalidStateError and terminate this series
+ of steps.readyState
to WRITING
.
+
+ error
attribute; on getting the
+ error
attribute must be a
+ DOMError
object whose type
+ indicates the kind of error that has occurred.DONE
.error
.writeend
length
and
+ position
attributes should indicate any
+ fractional data successfully written to the file.writestart
.write
method, the
+ length
and position
attributes must
+ indicate the progress made in writing the file as of the last
+ progress notification.
+
+
+ position
must indicate an increase of
+ data.size
over its pre-write state.length
must be the greater of (the pre-write
+ length
) and (the pre-write position
+ plus data.size
).
+
+ DONE
.write
.writeend
.Parameter Type Nullable Optional Description data Blob
✘ ✘
+ The blob to write.
+ void
8. The
+ FileWriterSync
interfaceinterface FileWriterSync {
+ readonly attribute unsigned long long position;
+ readonly attribute unsigned long long length;
+ void write (Blob data);
+ void seek (long long offset);
+ void truncate (unsigned long long size);
+};
+
8.1 Attributes
length
of type unsigned long long, readonlyposition
of type unsigned long long, readonlylength
.
+ 8.2 Methods
seek
Parameter Type Nullable Optional Description offset long long
✘ ✘
+ An absolute byte offset into the file. If offset
+ is greater than length
, length
is used
+ instead. If offset
is less than zero,
+ length
is added to it, so that it is treated as an
+ offset back from the end of the file. If it is still less than
+ zero, zero is used.
+ void
truncate
+
+
+
+ length
must be equal to size
.position
must be the lesser of
+
+
+ size
.Parameter Type Nullable Optional Description size unsigned long long
✘ ✘
+ The size to which the length of the file is to be adjusted,
+ measured in bytes.
+ void
write
position
.
+ Upon completion, position
will increase by
+ data.size
.
+ Parameter Type Nullable Optional Description data Blob
✘ ✘
+ The blob to write.
+ void
9. Errors and Exceptions
+ 9.1 Occurrence
+ See NotFoundError.
+
+ See NotFoundError.
+
+ See NoModificationAllowedError.
+
+ See SecurityError.
+ WRITING
state.
+ See InvalidStateError.
+ abort
the call to an asynchronous write
+ method.
+ See AbortError.
+ 9.2 Definitions
+ error
attribute of the FileSaver
object must
+ return a DOMError
object [DOM4] of the most appropriate
+ type from the table below. Otherwise it must return null
.
+ Error Descriptions
+
+
+
+
+
+
+ Name Description
+
+ AbortError
+ The read operation was aborted, typically with a call to
+ abort().
+
+
+
+ InvalidStateError
+ An application attempted to initiate a write, truncate, or
+ seek using a
+ FileWriter
which is already in the
+ WRITING state.
+
+
+ NotFoundError
+ One or more of the following occurred:
+
+
+
+ offset
other than
+ zero is specified.
+
+ NoModificationAllowedError
+ The application attempted to write to a file which cannot be
+ modified due to the state of the underlying filesystem.
+
+
+
+ NotReadableError
+ The source Blob could not be read, typically due to
+ permission problems that occur after the Blob reference
+ was acquired.
+
+
+
+ QuotaExceededError
+
+ The operation failed because it would have caused the
+ application to exceed its storage quota.
+
+
+
+ SecurityError
+
+ One or more of the following occurred:
+
+
+
+ This is an error to be used in situations not covered by any
+ other error.
+
+
+
+ SyntaxError
+ The application attempted to supply an invalid line ending
+ specifier to the API.
+
+ 10. Security Considerations
10.1 Basic Security Model
+ 10.2 Write-Only Files
+ FileWriter
through a mechanism that also implies read access,
+ those restrictions may be relaxed.
+ 10.3 Quotas
+ 10.4 Other Standard Techniques
+ A. Acknowledgements
+ B. References
B.1 Normative references
B.2 Informative references
CSS Object Model (CSSOM)
- Editor's Draft 28 June 2013
+ Editor's Draft 5 September 2013
@@ -90,7 +90,7 @@ current W3C publications and the latest revision of this technical report
can be found in the
W3C technical reports index at http://www.w3.org/TR/.
-
CSSGroupingRule
InterfaceCSSMediaRule
InterfaceCSSPageRule
InterfaceCSSNamespaceRule
InterfaceCSSMarginRule
InterfaceCSSNamespaceRule
InterfaceCSSStyleDeclaration
Interface
ElementCSSInlineStyle
InterfaceA
where A
is actually an interface, it generally means an object implementing interface
A
.
The terms whitespace, ignored, specified value, computed value and used value are defined in CSS. -[CSS] +
The terms whitespace and ignored are defined in CSS. [CSS] + +
The terms cascaded value, computed value and used value are defined in CSS Cascade and Inheritance. +[CSSCASCADE]
The terms simple selector, sequence of simple selectors, universal selector and group of selectors are defined in Selectors. [SELECTORS] @@ -279,7 +283,7 @@ Selectors. [SELECTORS]
The term list of CSS page selectors refers to the comma-separated list of page selectors, as defined in CSS Paged Media Module. [CSSPAGE] -
The terms set and clear to refer to the true and +
The terms set and unset to refer to the true and false values of binary flags or variables, respectively. These terms are also used as verbs in which case they refer to mutating some value to make it true or false, respectively.
@@ -290,8 +294,8 @@ mutating some value to make it true or false, respectively.The term supported CSS property refers to a CSS property that the user agent implements, and that is defined to be a case-insensitive property in the CSS specification. A supported CSS property must be in its lowercase form for the purpose of comparisons this specification. -
CSS properties that are case-sensitive such as CSS Variables are author-defined and are represented with dedicated interfaces, and do not -participate in the base CSSOM API. [CSSVARIABLES] +
The term author-defined CSS property refers to var-*
properties as defined in CSS Custom Properties for Cascading Variables,
+and are case-sensitive. [CSSVARIABLES]
The terms ::before pseudo-element and ::after pseudo-element refer to the :before and :after pseudo-elements in CSS, except in this specification the pseudo-elements are assumed to exist for all elements even if no box is generated for them. [CSS] @@ -867,7 +871,7 @@ represents a style sheet as defined by the CSS specification. In the CSSOM a
Specified when created. Either set or clear. Clear by default.
+Specified when created. Either set or unset. Unset by default.
The following CSS style sheets have @@ -881,9 +885,9 @@ represents a style sheet as defined by the CSS specification. In the CSSOM a
Either set or clear. Clear by default.
+Either set or unset. Unset by default.
-Even when clear it does not necessarily mean that the +
Even when unset it does not necessarily mean that the CSS style sheet is actually used for rendering.
Specified when created. Either set or clear. If it is set, the API allows reading and modifying of the CSS
+ Specified when created. Either set or unset. If it is set, the API allows reading and modifying of the CSS
rules.
@@ -917,7 +921,8 @@ represents a style sheet as defined by the CSS specification. In the CSSOM a
-->ownerNode;
readonly attribute StyleSheet? parentStyleSheet;
readonly attribute DOMString? title;
- [PutForwards=mediaText] readonly attribute MediaList media;
+ [SameObject, PutForwards=mediaText] readonly attribute MediaList media;
attribute boolean disabled;
};
@@ -956,7 +961,7 @@ is set, or false otherwise. On setting, the CSSStyleSheet
interface CSSStyleSheet : StyleSheet { readonly attribute CSSRule? ownerRule; - readonly attribute CSSRuleList cssRules; + [SameObject] readonly attribute CSSRuleList cssRules; unsigned long insertRule(DOMString rule, unsigned long index); void deleteRule(unsigned long index); };@@ -967,10 +972,10 @@ CSS rule. If a value other than null is ever returned, then that same value
The cssRules
attribute must follow these steps:
If the origin-clean flag is clear, +
If the origin-clean flag is unset,
throw a SecurityError
exception.
Return a read-only, live CSSRuleList
object representing
- the CSS rules. The same object must be returned on each get access.
Even though the returned CSSRuleList
object is read-only (from the perspective of
client-authored script), it can nevertheless change over time due to its liveness status. For example, invoking
the insertRule()
or deleteRule()
methods can result in
@@ -980,7 +985,7 @@ CSS rule. If a value other than null is ever returned, then that same value
The insertRule(rule, index)
method must run the following steps:
If the origin-clean flag is clear, +
If the origin-clean flag is unset,
throw a SecurityError
exception.
Return the result of invoking insert a CSS rule rule in the CSS rules at index. @@ -989,7 +994,7 @@ CSS rule. If a value other than null is ever returned, then that same value
The deleteRule(index)
method must run the following steps:
If the origin-clean flag is clear, +
If the origin-clean flag is unset,
throw a SecurityError
exception.
Remove a CSS rule in the CSS rules at index.
If the title is not the empty string, the - alternate flag is clear, and + alternate flag is unset, and preferred CSS style sheet set name is the empty string change the preferred CSS style sheet set name to the title.
If any of the following is true clear the +
If any of the following is true unset the disabled flag and terminate these steps:
A persistent CSS style sheet is a CSS style sheet from the document CSS style sheets whose title is the empty string and whose -alternate flag is clear.
+alternate flag is unset.A CSS style sheet set is an ordered collection of one or more CSS style sheets @@ -1090,7 +1095,7 @@ common.
An enabled CSS style sheet set is a CSS style sheet set of which each CSS style sheet has -its disabled flag clear.
+its disabled flag unset.To enable a CSS style sheet set with name name, run these steps:
@@ -1100,7 +1105,7 @@ with name name, run these steps: disabled flag for each CSS style sheet that is in a CSS style sheet set and terminate these steps.Clear the disabled flag for each +
Unset the disabled flag for each CSS style sheet in a CSS style sheet set whose CSS style sheet set name is a case-sensitive match for @@ -1129,7 +1134,7 @@ value is null.
preferred CSS style sheet set name is a concept to determine which CSS style sheets need to have their -disabled flag clear. Initially its value +disabled flag unset. Initially its value is the empty string.To @@ -1243,7 +1248,8 @@ represented by the collection. -->
partial interface Document { - readonly attribute StyleSheetList styleSheets; + [SameObject] readonly attribute StyleSheetList styleSheets; attribute DOMString? selectedStyleSheetSet; readonly attribute DOMString? lastStyleSheetSet; readonly attribute DOMString? preferredStyleSheetSet; @@ -1310,8 +1316,7 @@ this attribute is initially the empty string.The
+document CSS style sheets. The array is live; if the document CSS style sheets change, the array must be updated as appropriate.styleSheetSets
attribute must return a read only array of the CSS style sheet set names of the CSS style sheet sets, in order of the -document CSS style sheets. The array is live; if the document CSS style sheets change, the array must be updated as appropriate. The -same array must be returned every time.The
@@ -1430,7 +1435,7 @@ how to persist the 6.3 Style Sheet Association -enableStyleSheetsForSet(name)
method must, when invoked, run these steps:This section defines the interface a +
This section defines the interface an owner node of a CSS style sheet has to implement and defines the requirements for xml-stylesheet processing instructions @@ -1605,14 +1610,21 @@ document, removed from a document, becomes part of the prolog<
- alternate flag
Set if the
alternate
pseudo-attribute value is a case-sensitive match for - "yes
", or clear otherwise. + "yes
", or unset otherwise.- origin-clean flag -
Set if response is CORS-same-origin, or clear otherwise. +
Set if response is CORS-same-origin, or unset otherwise.
A style sheet referenced by an xml-stylesheet processing instruction using the rules in this section, in the context of
+the Document
of an XML parser is said to be
+a style sheet that is blocking scripts if the ProcessingInstruction
+node was created by that Document
's parser, and the style sheet was
+enabled when the node was created by the parser, and the style sheet ready flag is not yet set, and, the last time the
+event loop reached step 1, the node was in that Document, and the user agent hasn't given up on that particular style sheet
+yet. A user agent may give up on such a style sheet at any time.
Link
Headeralternate
", or false otherwise.
Set if response is CORS-same-origin, or clear otherwise. +
Set if response is CORS-same-origin, or unset otherwise.
A style sheet referenced by a HTTP Link
header using the rules in this section is said to be a style sheet
+that is blocking scripts if the style sheet was enabled when created, and the style sheet ready flag is not yet set,
+and the user agent hasn't given up on that particular style sheet yet. A user agent may give up on such a style sheet at any time.
In addition to the above state, each CSS rule may be associated with other state in accordance with its type.
-To parse a CSS rule from a string string, invoke parse a rule with string and return -the value returned.
+To parse a CSS rule from a string string, run the following steps: + +
Let rule be the return value of invoking parse a rule with string. +
If rule is a syntax error, return rule. +
Let parsed rule be the result of parsing rule according to the appropriate CSS specifications, dropping parts that are said to be + ignored. If the whole style rule is dropped, return a syntax error. +
Return parsed rule. +
To serialize a CSS rule, perform one of the following in accordance with the CSS rule's type:
@@ -1872,6 +1894,7 @@ inherits from this interface. const unsigned short MEDIA_RULE = 4; const unsigned short FONT_FACE_RULE = 5; const unsigned short PAGE_RULE = 6; + const unsigned short MARGIN_RULE = 9; const unsigned short NAMESPACE_RULE = 10; readonly attribute unsigned short type; attribute DOMString cssText; @@ -1895,6 +1918,8 @@ inherits from this interface.CSSPageRule
Return PAGE_RULE
(numeric value 6).
CSSNamespaceRule
+ Return MARGIN_RULE
(numeric value 9).
+
CSSMarginRule
Return NAMESPACE_RULE
(numeric value 10).
Return a value defined on the CSSOM Constants wiki page. @@ -1945,7 +1970,7 @@ unreachable.
interface CSSStyleRule : CSSRule { attribute DOMString selectorText; - [PutForwards=cssText] readonly attribute CSSStyleDeclaration style; };@@ -1959,9 +1984,21 @@ unreachable.
The style
attribute must return a CSSStyleDeclaration
object for the style rule, with the
-declarations being the declared declarations in the rule, in the same order as they were
-specified, with shorthand properties expanded into their longhand properties, in canonical order.
Unset. +
The declared declarations in the rule, in specified order.
+The context object. +
Null. +
The specified order for declarations is the same as specified, but with shorthand properties +expanded into their longhand properties, in canonical order. If a property is specified more than once (after shorthand expansion), only the +one with greatest cascading order must be represented, at the same relative position as it was specified. [CSSCASCADE]
CSSCharsetRule
Interfaceinterface CSSImportRule : CSSRule { readonly attribute DOMString href; - [PutForwards=mediaText] readonly attribute MediaList media; - readonly attribute CSSStyleSheet styleSheet; + [SameObject, PutForwards=mediaText] readonly attribute MediaList media; + [SameObject] readonly attribute CSSStyleSheet styleSheet; };
The href
attribute must return the URL specified by
@@ -2003,7 +2041,7 @@ list is simply empty, i.e., an @import
at-rule always has
The CSSGroupingRule
interface represents an at-rule that contains other rules nested inside itself.
interface CSSGroupingRule : CSSRule { - readonly attribute CSSRuleList cssRules; + [SameObject] readonly attribute CSSRuleList cssRules; unsigned long insertRule(DOMString rule, unsigned long index); void deleteRule(unsigned long index); };@@ -2024,7 +2062,8 @@ invoking insert a CSS rule rule into
The CSSMediaRule
interface represents an @media
at-rule.
interface CSSMediaRule : CSSGroupingRule { - [PutForwards=mediaText] readonly attribute MediaList media; + [SameObject, PutForwards=mediaText] readonly attribute MediaList media; };
The media
attribute must return a MediaList
object for the list of media queries specified
@@ -2038,9 +2077,9 @@ with the @media
at-rule.
interface CSSPageRule : CSSRule { - attribute DOMString selectorText; - [PutForwards=cssText] readonly attribute CSSStyleDeclaration style; };@@ -2053,11 +2092,49 @@ with the
@media
at-rule.
Otherwise, if the algorithm returns a null value, do nothing.
The style
attribute must return a CSSStyleDeclaration
for the @page
-at-rule.
The style
attribute must return a CSSStyleDeclaration
object for the
+@page
at-rule, with the following properties:
+
Unset. +
The declared declarations in the rule, in specified order.
+The context object. +
Null. +
CSSNamespaceRule
InterfaceCSSMarginRule
InterfaceThe CSSMarginRule
interface represents a margin at-rule (e.g. @top-left
) in an @page
at-rule.
+[CSSPAGE]
+
+
interface CSSMarginRule : CSSRule { + readonly attribute DOMString name; + [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; +};+ +
The name
attribute must return the name of the margin at-rule. The @
character is not
+included in the name. [CSSSYNTAX]
+
+
The style
attribute must return a CSSStyleDeclaration
object for the
+margin at-rule, with the following properties:
+
Unset. +
The declared declarations in the rule, in specified order.
+The context object. +
Null. +
CSSNamespaceRule
InterfaceThe CSSNamespaceRule
interface represents an @namespace
at-rule.
A CSS declaration is an abstract concept that is not exposed as an object in the DOM. A CSS declaration has the following associated +properties: + +
The property name of the declaration. +
The value of the declaration represented as a list of component values. +
Either set or unset. Can be changed. +
Set if the property name is defined to be case-sensitive according to its specification, + otherwise unset. +
A CSS declaration block is an ordered collection of CSS
-properties with their associated values, also named CSS declarations. In
+properties with their associated values, also named CSS declarations. In
the DOM a CSS declaration block is a
CSSStyleDeclaration
object. A
-CSS declaration block has two associated properties:
Clear if the object can be manipulated. Set if it can not be - manipulated. Unless otherwise stated it is clear.
Unset if the object can be manipulated. Set if it can not be + manipulated. Unless otherwise stated it is unset.
The CSS declarations associated with the object.
The CSS declarations associated with the object.
The CSS rule that the CSS declaration block is associated with, if any, or null otherwise. + +
The Element or PseudoElement that the CSS declaration block is associated with, if any, or + null otherwise.
To parse a CSS declaration block from a string string, invoke parse a list of declarations with -string and return the value returned.
+To parse a CSS declaration block from a string string, follow these steps: + +
Let declarations be the return value of invoking parse a list of declarations with string. +
Let parsed declarations be a new empty list. +
For each item declaration in declarations, follow these substeps: +
Let parsed declaration be the result of parsing declaration according to the appropriate CSS specifications, dropping parts that + are said to be ignored. If the whole declaration is dropped, let parsed declaration be null. +
If parsed declaration is not null, append it to parsed declarations. +
Return parsed declarations. +
To serialize a CSS declaration with property name property, value value and optionally an important flag set, follow +these steps: -
To serialize a CSS declaration block
-represented by a CSSStyleDeclaration
instance named d,
-let s be the empty string, then run the steps below:
Let s be the empty string. +
Append property to s. +
Append ":
" (U+003A U+0020) to s.
+
Append value to s. +
If the important flag is set, append " !important
" (U+0020 U+0021 U+0069 U+006D U+0070 U+006F U+0072 U+0074 U+0061 U+006E
+ U+0074) to s.
+
Append ";
" (U+003B) to s.
+
Return s. +
To serialize a CSS declaration block declaration block means to run the steps below:
If d.length
is zero (0), then return s.
For each i from zero (0) through d.length
- 1 (inclusive), perform the following sub-steps:
Let n be the value returned by d.item(i)
.
Let v be the value returned by d.getPropertyValue(n)
.
If v is the empty string, then continue.
Otherwise (v is non-empty), perform the following sub-steps:
-If s is not empty, then append a single SPACE (U+0020) to s.
Append n to s.
Append COLON (U+003A) followed by a single SPACE (U+0020), i.e., ":
", to s.
Append v to s.
Let p be the value returned by d.getPropertyPriority(n)
.
If p is not the empty string, then perform the following sub-steps:
+Let list be an empty array. +
Let already serialized be an empty array. +
Declaration loop: For each CSS declaration declaration in declaration block's + declarations, follow these substeps: +
Let property be declaration's property name. +
If property is in already serialized, continue with the steps labeled declaration loop. +
If property maps to one or more shorthand properties, let shorthands be an array of those shorthand properties, in + preferred order, and follow these substeps:
Append a single SPACE (U+0020) followed by EXCLAMATION MARK (U+0021), i.e., " !
", to s.
Append p to s.
Let longhands an array consisting of all CSS declarations in declaration block's + declarations that that are not in already serialized and have a + property name that + maps to one of the shorthand properties in shorthands. +
Shorthand loop: For each shorthand in shorthands, follow these substeps: +
If all properties that map to shorthand are not present in longhands, continue with the steps labeled shorthand loop. +
Let current longhands be an empty array. +
Append all CSS declarations in longhands have a + property name that maps to shorthand to current longhands. +
If there is one or more CSS declarations in current longhands have their + important flag set and one or more with it unset, continue with + the steps labeled shorthand loop. +
Let value be the result of invoking serialize a CSS value of current longhands. +
If value is the empty string, continue with the steps labeled shorthand loop. +
Let serialized declaration be the result of invoking serialize a CSS declaration with property name + shorthand, value value, and the important flag set if the CSS declarations in + current longhands have their important flag set. +
Append serialized declaration to list. +
Append the property names of all items of current longhands to already serialized. +
Remove the items present in current longhands from longhands. +
Append SEMICOLON (U+003B), i.e., ";
", to s.
Return s.
If property is in already serialized, continue with the steps labeled declaration loop. +
Let value be the result of invoking serialize a CSS value of declaration. +
Let serialized declaration be the result of invoking serialize a CSS declaration with property name property, value + value, and the important flag set if declaration has its important + flag set. +
Append serialized declaration to list. +
Append property to already serialized. +
Return list joined with "
" (U+0020).
The serialization of an empty CSS declaration block is the empty string.
@@ -2156,8 +2295,20 @@ let s be the empty string, then run the steps below:The serialization of a non-empty CSS declaration block does not include any surrounding whitespace, i.e., no whitepsace appears before the first property name and no whitespace appears after the final semicolon delimiter that follows the last property value.
+The preferred order of a list of shorthand properties shorthands is as follows: + +
Order shorthands lexicographically. +
Move all items in shorthands that begin with "-
" (U+002D) last in the list, retaining their relative order.
+
Move all items in shorthands that begin with "-
" (U+002D) but do not begin with "-webkit-
" last in the
+ list, retaining their relative order.
+
Order shorthands by the number of longhand properties that map to it, with the greatest number first. +
CSSStyleDeclaration
InterfaceCSSStyleDeclaration
InterfaceThe CSSStyleDeclaration
interface represents a CSS declaration block, including its underlying state, where this
+underlying state depends upon the source of the CSSStyleDeclaration
instance.
The CSSStyleDeclaration
interface represents a CSS declaration block, including its underlying state, where this
-underlying state depends upon the source of the CSSStyleDeclaration
instance.
interface CSSStyleDeclaration {
attribute DOMString cssText;
readonly attribute unsigned long length;
@@ -2179,15 +2327,15 @@ underlying state depends upon the source of the getPropertyValue(DOMString property);
DOMString getPropertyPriority(DOMString property);
void setProperty(DOMString property, [TreatNullAs=EmptyString] DOMString value, [TreatNullAs=EmptyString] optional DOMString priority = "");
+ -->[TreatNullAs=EmptyString] optional DOMString priority);
DOMString removeProperty(DOMString property);
- readonly attribute CSSRule? parentRule;
+ readonly attribute CSSRule? parentRule;
attribute DOMString cssFloat;
};
-The object's supported property indices are the numbers in the range zero to one less than the number of declarations in -the declarations. If there are no such declarations, then there are no -supported property indices. +
The object's supported property indices are the numbers in the range zero to one less than the number of +CSS declarations in the declarations. If there are no such +CSS declarations, then there are no supported property indices.
The cssText
attribute must return the result of
serializing the declarations.
Empty the declarations.
Parse the given value and, if the return value is not the empty list, insert the items in the list - into the declarations, in the same order as they were specified, with shorthand properties - expanded into their longhand properties, in canonical order.
The length
attribute must return the number of declarations in the
-declarations.
The length
attribute must return the number of CSS
+declarations in the declarations.
The item(index)
method must return the name of the property at position
-index.
The item(index)
method must return the
+property name of the CSS declaration at position index.
The getPropertyValue(property)
method must run these steps:
If longhand is a case-sensitive match for a property + name of a CSS declaration in the declarations, let declaration + be that CSS declaration, or null otherwise.
If declaration is null, return the empty string and terminate these steps.
Append the declaration to list.
Return the serialization of list and terminate these steps.
If property is a case-sensitive - match for a property of a declaration in the + match for a property name of a CSS declaration in the declarations, return the result of invoking serialize a CSS value of that declaration and terminate these steps.
Return the empty string.
@@ -2243,10 +2392,9 @@ the case-sensitive match for a property of a
- declaration in the declarations that has the
- important flag set, return
- the string "important
".
important
".
Return the empty string.
@@ -2257,14 +2405,15 @@ value would be "important
".
If the readonly flag is set, throw
- an NoModificationAllowedError
exception and terminate these steps.
NoModificationAllowedError
exception and terminate these steps.
Let property be property converted to ASCII lowercase.
If property is not a case-sensitive match for a supported CSS property, terminate this algorithm.
If value is the empty string, invoke removeProperty()
with property as argument and terminate this algorithm.
If priority is neither an ASCII case-insensitive match for the string "important
"
- nor the empty string terminate this algorithm.
If priority is not specified, let priority action be "leave as is". Otherwise, if priority is the empty string, let
+ priority action be "unset important". Otherwise, if priority is an ASCII case-insensitive match for the
+ string "important
", set priority action to "set important". Otherwise, terminate this algorithm.
Let component value list be the result of parsing value.
value can not include "!important
".
important
".
If component value list is null terminate these steps.
If property is a shorthand property, then for each longhand property longhand that property maps to, in canonical order, set the CSS property longhand to the appropriate value(s) from component value list, with - the important flag set if priority is not the empty string, and with the list of declarations being the + priority action being priority action, and with the list of declarations being the declarations.
Otherwise, set the CSS property property to component value list, with - the important flag set if priority is not the empty string, and with the list of declarations being the + priority action being priority action, and with the list of declarations being the declarations.
To set a CSS property property to a value component value list and optionally with an important flag set, in a -list of declarations declarations, follow these steps: +
To set a CSS property property to a value component value list and with priority action being either "set +important", "unset important" or "leave as is", in a list of declarations declarations, follow these steps:
If property is a case-sensitive match for a property of a declaration in - declarations, let declaration be that declaration. -
Otherwise, append a new declaration with the property name property to declarations and let declaration be that - declaration. -
Set declaration's value to component value list. -
Set the declaration's important flag if important is set, or unset it otherwise. +
If property is a case-sensitive match for a property + name of a CSS declaration in declarations, let declaration be that CSS declaration. +
Otherwise, append a new CSS declaration with the property name property + to declarations and let declaration be that CSS declaration. +
Set declaration's value to component value list. +
If priority action is "set important", set declaration's important flag. +
Otherwise, if priority action is "unset important", unset declaration's important + flag.
The removeProperty(property)
method must run these steps:
If property is a shorthand property, for each longhand property longhand that property maps to, invoke
removeProperty()
with longhand as argument.
-
Otherwise, if property is a case-sensitive match for a property of a declaration in the - declarations, remove the declaration. +
Otherwise, if property is a case-sensitive match for a + property name of a CSS declaration in the + declarations, remove that CSS declaration.
Return value. -
The parentRule
attribute must return the CSSrule
object the
-CSSStyleDeclaration
is object is associated with or null if it is not associated with a CSSrule
object.
The parentRule
attribute must return the
+parent CSS rule.
The cssFloat
attribute, on getting, must return the result of invoking
@@ -2408,10 +2560,10 @@ follows:
To parse a CSS value value for a given property means to follow these steps: @@ -2429,33 +2581,36 @@ part of the property value space and will therefore cause -
To serialize a CSS value of a declaration declaration or a list of longhand declarations list, follow -these rules:
+To serialize a CSS value of a CSS declaration declaration or a list of longhand CSS +declarations list, follow these rules:
If this algorithm is invoked with a list list, follow these substeps:
Let shorthand be the shorthand property that exactly maps to all the longhand properties in list. +
Let shorthand be the shorthand property that exactly maps to all the longhand properties in list. If there are multiple such + shorthand properties, use the first in preferred order.
If shorthand cannot represent the values of list in its grammar, return the empty string and terminate these steps.
Let trimmed list be a new empty array. -
For each declaration declaration in list, if declaration's value is not the initial value, or if +
For each CSS declaration declaration in list, if declaration's + value is not the initial value, or if declaration is a required component of the shorthand property, append declaration to trimmed list.
If trimmed list is empty, append the value of the first item in list to trimmed list.
Let values be a new empty array. -
For each declaration declaration in trimmed list, invoke serialize a CSS value of declaration, and - append the result to values. +
For each CSS declaration declaration in trimmed list, invoke serialize a CSS value of + declaration, and append the result to values.
Return the result of joining values as appropriate according to the grammar of shorthand and terminate these steps.
Let values be a new empty array. -
Append the result of invoking serialize a CSS component value of declaration's value to values. -
If the grammar of the property of declaration is defined to be whitespace-separated, return the result of invoking serialize a - whitespace-separated list of values and terminate these steps. -
If the grammar of the property of declaration is defined to be comma-separated, return the result of invoking serialize a - comma-separated list of values. +
Append the result of invoking serialize a CSS component value of declaration's + value to values. +
If the grammar of the property name of declaration is defined to be + whitespace-separated, return the result of invoking serialize a whitespace-separated list of values and terminate these steps. +
If the grammar of the property name of declaration is defined to be comma-separated, + return the result of invoking serialize a comma-separated list of values.
To @@ -2468,8 +2623,7 @@ depends on the component, as follows:
converted to ASCII lowercase.The number of degrees serialized as per <number> followed by
- the literal string "deg
".
The <number> component serialized as per <number> followed by the unit in canonical form as defined in its respective specification.
The concatenation of:
+The return value of the following algorithm:
If <counter> has three CSS component values the string
- "counters(
".
If <counter> has two CSS component values the string
- "counter(
".
The result of - serializing the - serialized - CSS component values belonging to <counter> as list while omitting - the last CSS component value if it is 'decimal'.
")
" (U+0029).
Let s be the empty string. +
If <counter> has three CSS component values append the string
+ "counters(
" to s.
If <counter> has two CSS component values append the string
+ "counter(
" to s.
Let list be a list of CSS component values belonging to <counter>, omitting the last CSS component value if it is 'decimal'. +
Let each item in list be the result of invoking serialize a CSS component value on that item. +
Append the result of invoking serialize a comma-separated list on list to s. +
Append ")
" (U+0029) to s.
Return s.
dpcm
".
The string "rect(
", followed by the result
- of serializing the
- serialized
- CSS component values belonging to <shape> as list, followed by
- ")
" (U+0029).
The return value of the following algorithm: +
Let s be the string "rect(
".
+
Let list be a list of the CSS component values belonging to <shape>. +
Let each item in list be the result of invoking serialize a CSS component value of that item. +
Append the result of invoking serialize a comma-separated list on list to s. +
Append ")
" (U+0029) to s.
+
Return s. +
Here are some examples of before and after results on specified values. The before column could be what the author wrote in a style sheet, while @@ -2689,22 +2849,28 @@ the after column shows what querying the DOM would return.
[NoInterfaceObject] interface ElementCSSInlineStyle { - [PutForwards=cssText] readonly attribute CSSStyleDeclaration style; };-
The style
attribute must return a CSS declaration block with the
-declarations being set to the result of parsing
-the style
content attribute, in the same order as specified, with shorthand properties expanded to their longhand properties, in canonical
-order. If the
-style
content attribute is absent, the object represents an empty list of
-declarations. Mutating the CSSStyleDeclaration
object must set the
-style
content attribute on the element to the
-serialization of the
-CSSStyleDeclaration
's declarations.
-The same object must be returned each time. The object is live; if the
-style
content attribute is set, changed or removed, the declarations must be
-updated as appropriate.
The style
attribute must return a live CSS declaration block with the following
+properties:
+
Unset. +
The result of parsing the style
content attribute, in
+ specified order. If the style
content attribute is absent, the object represents an
+ empty list of CSS declarations. Mutating the declarations
+ must set the style
content attribute on the context object to the
+ serialization of the declarations. If the
+ style
content attribute is set, changed or removed, the declarations must be
+ updated as appropriate.
+
Null. +
The context object. +
If the user agent supports HTML, the following IDL applies: [HTML] @@ -2718,8 +2884,8 @@ updated as appropriate.
Window
Interfacepartial interface Window { - CSSStyleDeclaration getComputedStyle(Element elt, optional DOMString pseudoElt); + [NewObject] CSSStyleDeclaration getComputedStyle(Element elt, optional DOMString pseudoElt); };
The getComputedStyle(elt, pseudoElt)
method must run these
@@ -2741,18 +2907,21 @@ steps:
Return a CSS declaration block with the - readonly flag set and the - declarations set to all longhand properties - that are supported CSS properties with the value being the resolved value - computed for obj using the style rules associated - with doc.
-This means that even if obj is in a
- different document (e.g. one fetched via XMLHttpRequest
) it
- will still use the style rules associated with the document that is
- associated with the global object on which
- getComputedStyle()
was
- invoked to compute the CSS declaration block.
Return a live CSS declaration block with the following properties: +
Set. +
All longhand properties that are supported CSS properties, in lexicographical order, with the value being + the resolved value computed for obj using the style rules associated with doc.
+This means that even if obj is in a different document (e.g. one fetched via XMLHttpRequest
) it will still use
+ the style rules associated with the document that is associated with the global object on which
+ getComputedStyle()
was invoked to compute the CSS declaration block.
Null. +
obj. +
Because of historical IDL limitations the The The The The The The Set.
+ All longhand properties that are supported CSS properties, in lexicographical order, that have a
+ cascaded value for the context object, with the value being the cascaded value computed for the
+ context object using the style rules associated with the context object's associated
+ document. Null.
+ The context object.
+ The Set.
+ All longhand properties that are supported CSS properties, in lexicographical order, with the value being
+ the computed value computed for the context object using the style rules associated with the
+ context object's associated document. Null.
+ The context object.
+ The Set.
+ All longhand properties that are supported CSS properties, in lexicographical order, with the value being
+ the used value computed for the context object using the style rules associated with the
+ context object's associated document. Null.
+ The context object.
+ The This is the 27 June 2013 Editor's Draft of CSSOM View. Please send
+ This is the 6 September 2013 Editor's Draft of CSSOM View. Please send
comments to
www-style@w3.org
(archived)
@@ -289,8 +289,8 @@ case that element acts as viewport and initial containing block.
The right-most edge of the element's right padding edge and the right margin edge of the element's all descendant boxes,
excluding boxes that have an ancestor of the element as their containing block.
The bottom-most edge of the element's bottom padding edge and the bottom margin edge of the element's all descendant boxes,
- excluding boxes that have an ancestor of the element as their containing block.
+ The bottom-most edge of the element's bottom padding edge and the bottom margin edge of the element's all descendant
+ boxes, excluding boxes that have an ancestor of the element as their containing block.
The element's left padding edge.
The element's right padding edge.
The bottom-most edge of the element's bottom padding edge and the bottom margin edge of the element's all descendant boxes,
- excluding boxes that have an ancestor of the element as their containing block.
+ The bottom-most edge of the element's bottom padding edge and the bottom margin edge of the element's all descendant
+ boxes, excluding boxes that have an ancestor of the element as their containing block.
The left-most edge of the element's left padding edge and the left margin edge of the element's all descendant boxes,
excluding boxes that have an ancestor of the element as their containing block.
@@ -421,7 +421,7 @@ layout box (the column or column group, respectively). All coordinates and dimensions for the APIs defined in this
-specification are in CSS pixels.
+specification are in CSS pixels, unless otherwise specified.
This does not apply to e.g.
Accessing The moveTo method must follow these steps:
+
+ Optionally, terminate these steps.
+ Let target be the browsing context of the context
+ object.
+ Let source be the browsing context of the incumbent script.
+ If source is not allowed to resize and move target, terminate these steps.
+ Optionally, clamp x and y in a user-agent-defined manner so that the window does not move outside the available space.
+ Move target's window such that the window's top left corner is at coordinates (x, y) relative to the top left corner of
+ the output device, measured in CSS pixels at 100% zoom. The positive axes are rightward and downward.
+ The moveBy method must follow these steps:
+
+ Optionally, terminate these steps.
+ Let target be the browsing context of the context
+ object.
+ Let source be the browsing context of the incumbent script.
+ If source is not allowed to resize and move target, terminate these steps.
+ Optionally, clamp x and y in a user-agent-defined manner so that the window does not move outside the available space.
+ Move target's window x CSS pixels at 100% zoom righward and y CSS pixels at 100% zoom downward.
+ The resizeTo method must follow these steps:
+
+ Optionally, terminate these steps.
+ Let target be the browsing context of the context
+ object.
+ Let source be the browsing context of the incumbent script.
+ If source is not allowed to resize and move target, terminate these steps.
+ Optionally, clamp x and y in a user-agent-defined manner so that the window does not get too small or bigger than the available
+ space.
+ Resize target's window by moving its right and bottom edges such that the distance between the left and right edges are x CSS
+ pixels at 100% zoom and the distance between the top and bottom edges are y CSS pixels at 100% zoom.
+ Optionally, move target's window in a user-agent-defined manner so that it does not grow outside the available space.
+ The resizeBy method must follow these steps:
+
+ Optionally, terminate these steps.
+ Let target be the browsing context of the context
+ object.
+ Let source be the browsing context of the incumbent script.
+ If source is not allowed to resize and move target, terminate these steps.
+ Optionally, clamp x and y in a user-agent-defined manner so that the window does not get too small or bigger than the available
+ space.
+ Resize target's window by moving its right edge x CSS pixels at 100% zoom righward and its bottom edge y CSS pixels at
+ 100% zoom downward.
+ Optionally, move target's window in a user-agent-defined manner so that it does not grow outside the available space.
+ A browsing context A is allowed to resize and move a browsing
+context B if all the following conditions are met:
+
+ B is an auxiliary browsing context that was created by a script (as opposed to by an action of the user).
+ A is familiar with B.
+ The The The The The The The The When setting the If the given value is a If the given value is a If the given value is a If the given value is a If the element does not have any associated CSS layout box, the
element is the root element and the If the element is the root element invoke
If the element is the HTML Scroll the element to
The When setting the If the given value is a If the given value is a If the given value is a If the given value is a If the element does not have any associated CSS layout box, the
element is the root element and the If the element is the root element invoke
If the element is the HTML Scroll the element to
x, The The If the element has no associated CSS layout box or if the CSS layout box is inline, return zero.
- If the element is the root element and the element's document's browsing context is a
- top-level browsing context, return the viewport width excluding the size of a rendered scroll bar (if
- any).
+ If the element is the root element and the element's document is not in quirks mode, or
+ if the element is the HTML Return the width of the padding edge excluding the width of any rendered scrollbar between the padding edge and the
border edge.
The If the element has no associated CSS layout box or if the CSS layout box is inline, return zero.
- If the element is the root element and the element's document's browsing context is a
- top-level browsing context, return the viewport height excluding the size of a rendered scroll bar (if any).
+ If the element is the root element and the element's document is not in quirks mode, or
+ if the element is the HTML Return the height of the padding edge excluding the height of any rendered scrollbar between the padding edge and the
border edge.
The getComputedStyle()
method used to be on
@@ -2770,43 +2939,78 @@ document if obj is an [NoInterfaceObject]
interface GetStyleUtils {
- readonly attribute CSSStyleDeclaration specifiedStyle;
- readonly attribute CSSStyleDeclaration defaultStyle;
- readonly attribute CSSStyleDeclaration computedStyle;
- readonly attribute CSSStyleDeclaration usedStyle;
+ [SameObject] readonly attribute CSSStyleDeclaration cascadedStyle;
+ [SameObject] readonly attribute CSSStyleDeclaration rawComputedStyle;
+ [SameObject] readonly attribute CSSStyleDeclaration usedStyle;
};
-
specifiedStyle
attribute must return a CSS declaration block
-with the readonly flag set and the
-declarations set to all longhand properties
-that are supported CSS properties with the value being the specified value
-computed for the context object using the style rules associated
-with the context object's associated document.defaultStyle
attribute must return a CSS declaration block with
-the readonly flag set and the
-declarations set to all longhand properties that are
-supported CSS properties with the value being the
-computed value computed for the context object using the user-agent-level style rules and user-level style rules
-associated with the context object's associated document, ignoring transitions, animations, author-level style
-rules, author-level presentational hints and override-level style rules.computedStyle
attribute must return a CSS declaration block with
-the readonly flag set and the
-declarations set to all longhand properties
-that are supported CSS properties with the value being the computed value
-computed for the context object using the style rules associated
-with the context object's associated document.usedStyle
attribute must return a CSS declaration block with the
-readonly flag set and the
-declarations set to all longhand properties
-that are supported CSS properties with the value being the used value
-computed for the context object using the style rules associated
-with the context object's associated document.specifiedStyle
, computedStyle
and
-usedStyle
methods expose information from CSS style sheets with the
+cascadedStyle
attribute must return a live CSS declaration block
+with the following properties:
+
+
+
+
+
+rawComputedStyle
attribute must return a live CSS declaration
+block with the following properties:
+
+
+
+usedStyle
attribute must return a live CSS declaration block with the
+following properties:
+
+
+
+cascadedStyle
, rawComputedStyle
+and usedStyle
methods expose information from CSS style sheets with the
origin-clean flag unset.
@@ -2951,6 +3155,9 @@ Message Header Field Registry.
CSSOM View Module
- Editor's Draft 27 June 2013
+ Editor's Draft 6 September 2013
@@ -83,7 +83,7 @@ current W3C publications and the latest revision of this technical report
can be found in the W3C technical reports
index at http://www.w3.org/TR/.
-
@@ -316,8 +316,8 @@ case that element acts as viewport and initial containing block.
3.1 CSS pixels
matchMedia()
as the units
@@ -494,14 +494,18 @@ be enum ScrollBehavior { "auto", "instant", "smooth" };
dictionary ScrollOptions {
- double x;
- double y;
ScrollBehavior behavior = "auto";
};
partial interface Window {
MediaQueryList matchMedia(DOMString query);
- readonly attribute Screen screen;
+ [SameObject] readonly attribute Screen screen;
+
+ // browsing context
+ void moveTo(double x, double y);
+ void moveBy(double x, double y);
+ void resizeTo(double x, double y);
+ void resizeBy(double x, double y);
// viewport
readonly attribute double innerWidth;
@@ -535,11 +539,74 @@ partial interface screen
attribute must return the Screen
object
-associated with the Window
object. It always returns the same
-object.Window
object.
screen
through a WindowProxy
object might yield different
results when the Document
is navigated.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
innerWidth
attribute must return the viewport width including the size of a rendered
scroll bar (if any), or zero if there is no viewport. availWidth
attribute must return the available width of the rendering surface of the output
-device. availHeight
attribute must return the available height of the rendering surface of the output
-device. width
attribute must return the width of the output device. width
attribute must return the width of the output device, in CSS pixels at 100% zoom.
+height
attribute must return the height of the output device. height
attribute must return the height of the output device, in CSS pixels at 100% zoom.
+colorDepth
attribute must return 24.7 Extensions to the
-Element
Interfacepartial interface Element {
+
dictionary ScrollOptionsHorizontal : ScrollOptions {
+ double x;
+};
+dictionary ScrollOptionsVertical : ScrollOptions {
+ double y;
+};
+
+partial interface Element {
ClientRectList getClientRects();
ClientRect getBoundingClientRect();
void scrollIntoView(optional boolean top = true, optional ScrollOptions options);
- attribute (double or ScrollOptions) scrollTop;
- attribute (double or ScrollOptions) scrollLeft;
+ attribute (double or ScrollOptionsVertical) scrollTop;
+ attribute (double or ScrollOptionsHorizontal) scrollLeft;
readonly attribute double scrollWidth;
readonly attribute double scrollHeight;
readonly attribute double clientTop;
@@ -920,25 +996,25 @@ var exampleHeight = example.height;
scrollTop
attribute these steps must be run:
-
ScrollOptions
object, and the y
dictionary member is not present, abort these steps.
- ScrollOptions
object, let y be the value of the y
dictionary member. Otherwise,
- let y be the given value.ScrollOptionsVertical
object, and the y
dictionary member is not present, abort these steps.
+ ScrollOptionsVertical
object, let y be the value of the y
dictionary member.
+ Otherwise, let y be the given value.Document
is in
quirks mode, or the element has no associated scrolling box, or the element has no overflow,
terminate these steps.scroll()
with zero as first
- argument and y as second, and, if the given value is a ScrollOptions
object, the given value as the third argument.ScrollOptionsVertical
object, the given value as the third argument.
body
element,
the Document
is in quirks mode, and the element
does not have any vertical overflow, invoke
scroll()
with
scrollX
as first
- argument and y as second, and, if the given value is a ScrollOptions
object, the given value as the third argument.ScrollOptionsVertical
object, the given value as the third argument.
scrollLeft
,y, with the scroll behavior being the value of the behavior
dictionary
- member if the given value is a ScrollOptions
object, or auto
otherwise.
+ member if the given value is a ScrollOptionsVertical
object, or auto
otherwise.
scrollLeft
attribute must return the result of running these steps:scrollLeft
attribute these steps must be run:
-
ScrollOptions
object, and the x
dictionary member is not present, abort these steps.
- ScrollOptions
object, let x be the value of the x
dictionary member. Otherwise,
- let x be the given value.ScrollOptionsHorizontal
object, and the x
dictionary member is not present, abort these steps.
+ ScrollOptionsHorizontal
object, let x be the value of the x
dictionary member.
+ Otherwise, let x be the given value.Document
is in
quirks mode, or the element has no associated scrolling box, or the element has no overflow,
terminate these steps.scroll()
with
- x as first argument and zero as second, and, if the given value is a ScrollOptions
object, the given value as the third
+ x as first argument and zero as second, and, if the given value is a ScrollOptionsHorizontal
object, the given value as the third
argument.body
element,
the Document
is in quirks mode, and the element
does not have any vertical overflow, invoke
scroll()
with
x as first argument and
- scrollY
as second, and, if the given value is a ScrollOptions
object, the given value as the third
+ scrollY
as second, and, if the given value is a ScrollOptionsHorizontal
object, the given value as the third
argument.scrollTop
, with the scroll behavior being the value of the behavior
dictionary
- member if the given value is a ScrollOptions
object, or auto
otherwise.
+ member if the given value is a ScrollOptionsHorizontal
object, or auto
otherwise.
scrollWidth
attribute must return the result of running these steps:clientWidth
attribute must run these steps:
@@ -1042,8 +1119,10 @@ var exampleHeight = example.height;
body
element and the element's document is in
+ quirks mode, return the viewport width excluding the size of a rendered scroll bar
+ (if any).
clientHeight
attribute must run these steps:
@@ -1203,7 +1282,7 @@ a scrolling box scrolling box, in order of innermost to outermost scr
body
element and the element's document is in
+ quirks mode, return the viewport height excluding the size of a rendered scroll
+ bar (if any).
8 Extensions to the
HTMLElement
Interfacepartial interface HTMLElement {
- readonly attribute Element offsetParent;
+ readonly attribute Element? offsetParent;
readonly attribute double offsetTop;
readonly attribute double offsetLeft;
readonly attribute double offsetWidth;
@@ -1361,10 +1440,10 @@ browsers -->
};
partial dictionary MouseEventInit {
- double screenX = 0;
- double screenY = 0;
- double clientX = 0;
- double clientY = 0;
+ double screenX = 0.0;
+ double screenY = 0.0;
+ double clientX = 0.0;
+ double clientY = 0.0;
};
screenX
attribute must return the x-coordinate of
@@ -1572,12 +1651,15 @@ David Vest,
Elliott Sprehn,
Garrett Smith,
Hallvord R. M. Steen,
+Kang-Hao Lu,
Leif Arne Storset,
Luiz Agostini,
Maciej Stachowiak,
Michael Dyck,
Mike Wilson,
Morten Stenshorne,
+Olli Pettay,
+Pavel Curtis,
Peter-Paul Koch,
Rachel Kmetz,
Robert O'Callahan,
@@ -1585,6 +1667,7 @@ Sam Weinig,
Scott Johnson,
Sebastian Zartner,
Sylvain Galineau,
+Tab Atkins,
Tarquin Wilton-Jones,
Thomas Moore, and
Xiaomei Ji
diff --git a/lib/js/js/web.jsx b/lib/js/js/web.jsx
index 0b0b67c4..4abcc783 100644
--- a/lib/js/js/web.jsx
+++ b/lib/js/js/web.jsx
@@ -647,11 +647,9 @@ native class Element extends Node {
// implements GetStyleUtils
/** @see http://dev.w3.org/csswg/cssom/ */
- __readonly__ var specifiedStyle : CSSStyleDeclaration;
+ __readonly__ var cascadedStyle : CSSStyleDeclaration;
/** @see http://dev.w3.org/csswg/cssom/ */
- __readonly__ var defaultStyle : CSSStyleDeclaration;
- /** @see http://dev.w3.org/csswg/cssom/ */
- __readonly__ var computedStyle : CSSStyleDeclaration;
+ __readonly__ var rawComputedStyle : CSSStyleDeclaration;
/** @see http://dev.w3.org/csswg/cssom/ */
__readonly__ var usedStyle : CSSStyleDeclaration;
@@ -666,9 +664,9 @@ native class Element extends Node {
/** @see http://dev.w3.org/csswg/cssom-view/ */
function scrollIntoView(top : boolean, options : ScrollOptions) : void;
/** @see http://dev.w3.org/csswg/cssom-view/ */
- var scrollTop : variant/*(double or ScrollOptions)*/;
+ var scrollTop : variant/*(double or ScrollOptionsVertical)*/;
/** @see http://dev.w3.org/csswg/cssom-view/ */
- var scrollLeft : variant/*(double or ScrollOptions)*/;
+ var scrollLeft : variant/*(double or ScrollOptionsHorizontal)*/;
/** @see http://dev.w3.org/csswg/cssom-view/ */
__readonly__ var scrollWidth : number/*double*/;
/** @see http://dev.w3.org/csswg/cssom-view/ */
@@ -1523,6 +1521,8 @@ native class CSSRule {
__readonly__ var FONT_FACE_RULE : number/*unsigned short*/;
static __readonly__ var PAGE_RULE : number/*unsigned short*/;
__readonly__ var PAGE_RULE : number/*unsigned short*/;
+ static __readonly__ var MARGIN_RULE : number/*unsigned short*/;
+ __readonly__ var MARGIN_RULE : number/*unsigned short*/;
static __readonly__ var NAMESPACE_RULE : number/*unsigned short*/;
__readonly__ var NAMESPACE_RULE : number/*unsigned short*/;
__readonly__ var type : number/*unsigned short*/;
@@ -1573,13 +1573,21 @@ native final class CSSMediaRule extends CSSGroupingRule {
} // end of CSSMediaRule
/** @see http://dev.w3.org/csswg/cssom/ */
-native final class CSSPageRule extends CSSRule {
+native final class CSSPageRule extends CSSGroupingRule {
var selectorText : string/*DOMString*/;
__readonly__ var style : CSSStyleDeclaration;
} // end of CSSPageRule
+/** @see http://dev.w3.org/csswg/cssom/ */
+native final class CSSMarginRule extends CSSRule {
+
+ __readonly__ var name : string/*DOMString*/;
+ __readonly__ var style : CSSStyleDeclaration;
+
+} // end of CSSMarginRule
+
/** @see http://dev.w3.org/csswg/cssom/ */
native final class CSSNamespaceRule extends CSSRule {
@@ -2119,6 +2127,15 @@ native final __fake__ class Window extends EventTarget {
function matchMedia(query : string/*DOMString*/) : MediaQueryList;
/** @see http://dev.w3.org/csswg/cssom-view/ */
__readonly__ var screen : Screen;
+ // browsing context
+ /** @see http://dev.w3.org/csswg/cssom-view/ */
+ function moveTo(x : number/*double*/, y : number/*double*/) : void;
+ /** @see http://dev.w3.org/csswg/cssom-view/ */
+ function moveBy(x : number/*double*/, y : number/*double*/) : void;
+ /** @see http://dev.w3.org/csswg/cssom-view/ */
+ function resizeTo(x : number/*double*/, y : number/*double*/) : void;
+ /** @see http://dev.w3.org/csswg/cssom-view/ */
+ function resizeBy(x : number/*double*/, y : number/*double*/) : void;
// viewport
/** @see http://dev.w3.org/csswg/cssom-view/ */
__readonly__ var innerWidth : number/*double*/;
@@ -2287,6 +2304,25 @@ native final __fake__ class Window extends EventTarget {
function btoa(btoa : string/*DOMString*/) : string/*DOMString*/;
function atob(atob : string/*DOMString*/) : string/*DOMString*/;
+ // implements LocalFileSystem
+
+ /** @see http://www.w3.org/TR/2012/WD-file-system-api-20120417/ */
+ static __readonly__ var TEMPORARY : number/*unsigned short*/;
+ /** @see http://www.w3.org/TR/2012/WD-file-system-api-20120417/ */
+ __readonly__ var TEMPORARY : number/*unsigned short*/;
+ /** @see http://www.w3.org/TR/2012/WD-file-system-api-20120417/ */
+ static __readonly__ var PERSISTENT : number/*unsigned short*/;
+ /** @see http://www.w3.org/TR/2012/WD-file-system-api-20120417/ */
+ __readonly__ var PERSISTENT : number/*unsigned short*/;
+ /** @see http://www.w3.org/TR/2012/WD-file-system-api-20120417/ */
+ function requestFileSystem(type : number/*unsigned short*/, size : number/*unsigned long long*/, successCallback : function(filesystem:FileSystem):void/*FileSystemCallback*/) : void;
+ /** @see http://www.w3.org/TR/2012/WD-file-system-api-20120417/ */
+ function requestFileSystem(type : number/*unsigned short*/, size : number/*unsigned long long*/, successCallback : function(filesystem:FileSystem):void/*FileSystemCallback*/, errorCallback : function(err:DOMError):void/*ErrorCallback*/) : void;
+ /** @see http://www.w3.org/TR/2012/WD-file-system-api-20120417/ */
+ function resolveLocalFileSystemURL(url : string/*DOMString*/, successCallback : function(entry:Entry):void/*EntryCallback*/) : void;
+ /** @see http://www.w3.org/TR/2012/WD-file-system-api-20120417/ */
+ function resolveLocalFileSystemURL(url : string/*DOMString*/, successCallback : function(entry:Entry):void/*EntryCallback*/, errorCallback : function(err:DOMError):void/*ErrorCallback*/) : void;
+
// implements WindowSessionStorage
/** @see http://dev.w3.org/html5/webstorage/ */
@@ -2331,9 +2367,8 @@ native final __fake__ class Window extends EventTarget {
/** @see http://dev.w3.org/csswg/cssom/ */
native __fake__ class GetStyleUtils {
- __readonly__ var specifiedStyle : CSSStyleDeclaration;
- __readonly__ var defaultStyle : CSSStyleDeclaration;
- __readonly__ var computedStyle : CSSStyleDeclaration;
+ __readonly__ var cascadedStyle : CSSStyleDeclaration;
+ __readonly__ var rawComputedStyle : CSSStyleDeclaration;
__readonly__ var usedStyle : CSSStyleDeclaration;
} // end of GetStyleUtils
@@ -2345,8 +2380,6 @@ native final class PseudoElement extends GetStyleUtils {
/** @see http://dev.w3.org/csswg/cssom-view/ */
/* dictionary */ class ScrollOptions {
- var x : number/*double*/;
- var y : number/*double*/;
var behavior : string/*ScrollBehavior*/;
} // end of ScrollOptions
@@ -2382,11 +2415,25 @@ native final class CaretPosition {
} // end of CaretPosition
+/** @see http://dev.w3.org/csswg/cssom-view/ */
+/* dictionary */ class ScrollOptionsHorizontal extends ScrollOptions {
+
+ var x : number/*double*/;
+
+} // end of ScrollOptionsHorizontal
+
+/** @see http://dev.w3.org/csswg/cssom-view/ */
+/* dictionary */ class ScrollOptionsVertical extends ScrollOptions {
+
+ var y : number/*double*/;
+
+} // end of ScrollOptionsVertical
+
/** @see http://www.w3.org/TR/html5/single-page.html */
native class HTMLElement extends Element {
/** @see http://dev.w3.org/csswg/cssom-view/ */
- __readonly__ var offsetParent : Element;
+ __readonly__ var offsetParent : Nullable.