EPUB Reading Systems 3.3

W3C Working Draft

More details about this document
This version:
https://www.w3.org/TR/2022/WD-epub-rs-33-20220331/
Latest published version:
https://www.w3.org/TR/epub-rs-33/
Latest editor's draft:
https://w3c.github.io/epub-specs/epub33/rs/
History:
https://www.w3.org/standards/history/epub-rs-33
Commit history
Test suite:
https://w3c.github.io/epub-tests/index.html
Editors:
Matt Garrish (DAISY Consortium)
Ivan Herman (W3C)
Dave Cramer (Invited Expert)
Former editors:
Garth Conboy (Google)
Marisa DeMeglio (DAISY Consortium)
Daniel Weck (DAISY Consortium)
Feedback:
GitHub w3c/epub-specs (pull requests, new issue, open issues)
public-epub-wg@w3.org with subject line [epub-rs-33] … message topic … (archives)

Abstract

EPUB® 3 defines a distribution and interchange format for digital publications and documents. The EPUB format provides a means of representing, packaging, and encoding structured and semantically enhanced web content — including HTML, CSS, SVG and other resources — for distribution in a single-file container.

This specification defines the conformance requirements for EPUB 3 Reading Systems — the user agents that render EPUB Publications.

Status of This Document

This section describes the status of this document at the time of its publication. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.

This document was published by the EPUB 3 Working Group as a Working Draft using the Recommendation track.

Publication as a Working Draft does not imply endorsement by W3C and its Members.

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 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.

This document is governed by the 2 November 2021 W3C Process Document.

1. Introduction

1.1 Overview

This section is non-normative.

The EPUB 3 standard is separated into two distinct concerns: the authoring of EPUB Publications is defined in the core specification [EPUB-33], while this specification details the rendering requirements for them in EPUB Reading Systems.

An EPUB Reading System can take many forms. It might have a visual display area for rendering the content to users, for example, or it might only provide audio playback of the content. As a result, there is no single set of rules that all Reading Systems must follow. Rather, this specification breaks down the rendering requirements based on a Reading System's capabilities and the features its supports.

Moreover, this specification provides a great deal of flexibility to developers to create unique user interfaces, such as in their bookshelves. As a result, metadata processing requirements are often quite minimal, for example.

So, although this specification identifies the formal requirements for Reading Systems, it is not possible to read this document in isolation. Developers should also familiarize themselves with the full content structure of an EPUB Publication to understand the complete range of information that is available.

Note

A conforming Reading System is not necessarily a single dedicated program or device but might exist as a distributed system.

1.2 Terminology

This specification uses terminology defined in EPUB 3.3 [EPUB-33] as well as the terms defined in this section. Terms appear capitalized wherever used.

Only the first instance of a term in a section links to its definition.

Content Display Area

The area within the Viewport dedicated to the display of EPUB Content Documents. The Content Display Area excludes any borders, margins, headers, footers, or other decoration a EPUB Reading System might inject into the Viewport.

In the case of synthetic spreads, the Viewport contains two Content Display Areas.

1.3 Conformance

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 MAY, MUST, MUST NOT, OPTIONAL, RECOMMENDED, SHOULD, and SHOULD NOT in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

1.4 Relationship to Other Specifications

This section is non-normative.

1.4.1 Relationship to HTML

The [HTML] standard is continuously evolving — there are no longer versioned releases of it. That standard, in turn, references various technologies that continue to evolve, such as MathML, SVG, CSS, and JavaScript.

Reading System developers must keep track of the changes to HTML, and the technologies it references, to ensure they keep their systems up to date.

This specification does not require EPUB Reading Systems to support scripting, HTML forms or the HTML DOM. Reading Systems conformant with this specification are only expected to be able to process a conforming EPUB Content Document. As support for scripting and HTML forms is not compulsory, a conformant Reading System may not be a fully-conformant HTML user agent.

1.4.2 Relationship to SVG

This specification does not reference a specific version of [SVG], but instead uses an undated reference. Whenever there is any ambiguity in this reference, the latest recommended specification is the authoritative reference.

This approach ensures that EPUB will always keep pace with changes to the SVG standard. Reading System developers must keep track of changes to the SVG standard to ensure they keep their systems up to date.

2. Publication Resource Processing

Reading Systems MUST process Publication Resources [EPUB-33].

2.1 Foreign Resources

Reading Systems MAY support an arbitrary set of Foreign Resource types, and if a Foreign Resource is not supported, MUST process fallbacks as defined in Foreign Resources [EPUB-33].

2.2 Remote Resources

Reading Systems SHOULD support remote resources, as defined in Resource Locations [EPUB-33].

2.3 Data URLs

Reading Systems MUST prevent data URLs [RFC2397] from opening in top-level browsing contexts [HTML], except when initiated through a Reading System affordance such as a context menu. If a Reading System does not use a top-level browsing context for Top-level Content Documents, for example if the Top-level Content Document is an SVG, it MUST also prevent data URLs from opening as though they are Top-level Content Documents.

2.4 Core Media Types

If a Reading System has a Viewport, it MUST support the image Core Media Type Resources [EPUB-33].

If it has the capability to render prerecorded audio, it MUST support the audio Core Media Type Resources [EPUB-33].

Note

It is recommended that Reading Systems support at least one of the H.264 [H264] and VP8 [RFC6386] video codecs, but this is not a conformance requirement — a Reading System may support any video codec, or none at all. Reading System developers should take into consideration factors such as breadth of adoption, playback quality, and technology royalties when deciding which video formats to support.

2.5 XML Processing

A Reading System MUST be both of the following:

In addition, when processing XML documents, a Reading System MUST NOT resolve external identifiers in DOCTYPE, ENTITY and NOTATION declarations [XML].

2.6 Internationalization

A Reading System MUST process, for all Publication Resources, the attributes that set the language for the documents' contents, when applicable. This includes:

Similarly, a Reading System MUST process, for all Publication Resources [EPUB-33], the attributes that set the base direction for the documents' contents, when applicable. This includes:

In the absence of this information in a Publication Resource, Reading Systems MUST NOT assume either the language or the base direction of that resource from information expressed in the Package Document (i.e., in xml:lang and dir attributes, in hreflang attributes on link elements, or from dc:language elements [EPUB-33]). Refer to a resource's formal specification for more information about to handle the absence of explicit language or direction information.

2.7 Network Access

Reading Systems MAY support network access to retrieve remote resources and to allow Scripted Content Documents to communicate with web-hosted APIs and retrieve resources.

Providing network access, however, increases both the security risks to the Reading Systems and the security and privacy risks to users. These risks are often unique to Reading Systems and the platforms they run on — the browser cores that most Reading Systems are built on do not offer the same security and privacy controls as web browsers themselves. Consequently, developers need to use extra caution when allowing network access, and more thoroughly test that their Reading Systems are not vulnerable to attacks. More information about these risks is provided in 14. Security and Privacy.

If Reading System developers allow network access, it is strongly RECOMMENDED both that they:

3. Package Document Processing

Reading Systems MUST process the Package Document [EPUB-33].

3.1 Base Direction

If the dir attribute [EPUB-33] is set and indicates a base direction of ltr or rtl, Reading Systems MUST override the bidi algorithm per the higher-level protocols defined in [BIDI], setting the paragraph embedding level to 0 if the base direction is ltr, or 1 if the base direction is rtl.

Otherwise the base direction is auto, in which case Reading Systems MUST determine the text's direction by applying the Unicode Bidi Algorithm, beginning with Rule P2 of [BIDI].

3.2 Unique Identifier

Reading Systems SHOULD NOT depend on the Unique Identifier being unique to one and only one EPUB Publication. Determining whether two EPUB Publications with the same Unique Identifier represent different versions of the same publication, or different publications, may require inspecting other metadata, such as their last modification dates, titles, and authors.

3.3 Metadata

White Space

Reading Systems MUST strip and collapse ASCII whitespace [Infra] from Dublin Core [DCTERMS] and meta element values [EPUB-33] before processing.

The dc:identifier element

To determine whether the value of a dc:identifier element [EPUB-33] conforms to an established system or has been granted by an issuing authority, Reading Systems SHOULD check for an identifier-type property [EPUB-33].

The dc:title element

Reading Systems MUST recognize the first dc:title element [EPUB-33] in document order as the main title of the EPUB Publication and present it to users before other title elements.

This specification does not define how to process additional dc:title elements.

The dc:language element

The language(s) of the EPUB Publication specified in dc:language elements are informational. Some uses of this information include:

  • exposing it to the user through the Reading System user interface
  • using it to enhance functionality in a bookshelf (e.g., sorting by language)
  • using it to optimize the reading interface (e.g., to preload text-to-speech languages)

See 2.6 Internationalization for more details on how to determine the language of a Publication Resource.

The dc:creator element

When determining display priority, Reading Systems MUST use the document order of dc:creator elements [EPUB-33] in the metadata section, where the first creator element encountered is the primary creator. If a Reading System exposes creator metadata to the user, it SHOULD include all the creators listed in the metadata section whenever possible (e.g., when not constrained by display considerations).

The meta element

Reading Systems SHOULD ignore all meta elements whose property attributes [EPUB-33] define expressions they do not recognize. A Reading System MUST NOT fail when encountering unknown expressions.

If the property attribute's value does not include a prefix [EPUB-33], Reading Systems MUST use the prefix URL "http://idpf.org/epub/vocab/package/meta/#" to expand the value.

If a Reading System does not recognize the scheme attribute [EPUB-33] value, it SHOULD treat the value of the element as a string.

Retrieval and support of linked resources is OPTIONAL.

The language identified in an hreflang attribute is purely advisory. Upon fetching the resource, a Reading System MUST use the language information associated with the resource to determine its language, not the metadata included in the link to the resource.

In the case of a linked metadata record [EPUB-33], Reading Systems MUST NOT skip processing the metadata expressed in the Package Document (i.e., use only the information expressed in the record). Reading Systems MAY compile metadata from multiple linked records.

When resolving discrepancies and conflicts between metadata expressed in the Package Document and in linked metadata records, Reading Systems MUST use the document order of link elements [EPUB-33] in the Package Document to establish precedence (i.e., metadata in the first linked record has the highest precedence and metadata in the Package Document the lowest, regardless of whether the link elements occur before, within, or after the package metadata elements).

Reading Systems MUST ignore any instructions contained in linked resources related to the layout and rendering of the EPUB Publication.

If any of the rel or properties [EPUB-33] attributes' values do not include a prefix, Reading Systems MUST use the prefix URL "http://idpf.org/epub/vocab/package/link/#" to expand the values.

3.4 Manifest

Reading Systems MAY optimize the rendering depending on the properties set in the properties attribute [EPUB-33] (e.g., disable a rendering process or use a fallback). Reading Systems MUST ignore values of the properties attribute they do not recognize.

Reading Systems SHOULD NOT use non-Publication Resources in the rendering of an EPUB Publication due to the inherent limitations and risks involved (e.g., lack of information about the resource and how to process it, security risks from remotely-hosted sources, lack of fallbacks, etc.).

A Reading System that does not support the MIME media type [RFC2046] of a given Publication Resource MUST traverse the manifest fallback chain [EPUB-33] until it identifies a supported Publication Resource to use in place of the unsupported resource. If the Reading System supports multiple Publication Resources in the fallback chain, it MAY select the resource to use based on the resource's properties attribute [EPUB-33] values, otherwise it SHOULD honor the EPUB Creator's preferred fallback order. If a Reading System does not support any resource in the fallback chain, it MUST alert the reader that it could not display the content.

When manifest fallbacks [EPUB-33] are provided for Top-level Content Documents, Reading Systems MAY choose from the available options to find the optimal version to render in a given context (e.g., by inspecting the properties attribute for each).

A Reading System MUST terminate the fallback chain at the first reference to a manifest item it has already encountered.

If any of the properties attribute's values do not include a prefix [EPUB-33], Reading Systems MUST use the prefix URL "http://idpf.org/epub/vocab/package/item/#" to expand the values.

3.5 Spine

Reading Systems MUST provide a means of rendering the EPUB Publication in the order defined in the spine element [EPUB-33], which includes:

When a user traverses the default reading order defined in the spine element, a Reading System MAY automatically skip non-linear itemref elements [EPUB-33]. When a user activates a hyperlink to a non-linear resource, however, Reading Systems MUST render the referenced resource or a designated fallback. Reading Systems MAY also provide the option for users to skip non-linear content by default or not.

If the EPUB Creator has not specified the page-progression-direction attribute [EPUB-33], the Reading System MUST assume the value of default. When page-progression-direction value is default, the Reading System can choose the rendering direction.

If the page-progression-direction attribute has a value other than default, the Reading System MUST ignore any directionality computed from pre-paginated XHTML Content Documents.

If any values of the properties attribute do not include a prefix [EPUB-33], Reading Systems MUST use the prefix URL "http://idpf.org/epub/vocab/package/itemref/#" to expand the values.

Reading Systems MUST ignore all values expressed in spine itemref properties attributes that they do not recognize.

Reading Systems MUST NOT skip spine references to duplicate manifest items when rendering the linear reading order. The Reading System MUST treat these as distinct items for user interface (UI) purposes (for example, each occurrence could be independently bookmarked or annotated). When a Reading System follows a hyperlink to a resource referenced multiple times in the spine, the Reading System MUST navigate to the first occurrence of the document in the linear reading order.

3.5.1 Spine Overrides

When a spine itemref element's properties attribute overrides a global rendering property [EPUB-33], Reading Systems MUST follow the requirements for the override's global value to display that spine item.

For example, a spine item that contains the layout-pre-paginated override [EPUB-33] is rendered following the requirements of the global pre-paginated value.

If more than one override for the same property is specified in a properties attribute, Reading Systems MUST use only the first value.

3.6 Collections

In the context of this specification, support for collections [EPUB-33] in Reading Systems is OPTIONAL. Reading Systems MUST ignore collection elements that define unrecognized roles.

4. Content Document Processing

The definition of EPUB Content Documents [EPUB-33] includes various authoring restrictions to optimize the cross-compatibility of content (e.g., prohibiting CSS for setting language and direction [EPUB-33]). Unless stated otherwise in this specification, Reading Systems MAY support these restricted features.

4.1 XHTML Content Documents

Reading Systems MUST process XHTML Content Documents [EPUB-33].

Unless explicitly defined in this section as overridden, Reading Systems MUST process XHTML Content Documents using semantics defined by the [HTML] specification and honor any applicable user agent conformance constraints expressed therein.

4.1.1 HTML Extensions

4.1.1.1 ARIA

Reading Systems SHOULD recognize embedded ARIA markup and support exposure of any given ARIA roles, states and properties to platform accessibility APIs [WAI-ARIA].

4.1.1.2 Structural Semantics

In addition to the requirements in 9. Processing Structural Semantics, a Reading System MUST ignore semantics expressed on the [HTML] head element or its descendants.

4.1.1.3 RDFa

Reading System support for the attribute processing model [RDFA-CORE] is OPTIONAL.

4.1.1.4 Microdata

Reading System support for the attribute processing model is OPTIONAL, as is the conversion to JSON [Microdata].

4.1.1.5 Content Switching (Deprecated)

Use of the switch element is deprecated [EPUB-33]. Refer to its definition in [EPUBContentDocs-301] for implementation information.

4.1.1.6 The epub:trigger Element (Deprecated)

Use of the trigger element is deprecated [EPUB-33]. Refer to its definition in [EPUBContentDocs-301] for implementation information.

4.1.1.7 Custom Attributes

Reading Systems MAY support custom attributes provided the attributes do not modify the requirements of this specification.

4.1.2 HTML Deviations and Constraints

4.1.2.1 MathML

To support MathML [MathML3] embedded in XHTML Content Documents, a Reading System:

Note

Reading Systems may choose to use third-party libraries such as MathJax to provide MathML rendering.

4.1.2.2 Embedded SVG

Reading Systems MUST process SVG embedded in XHTML Content Documents as defined in 4.2 SVG Content Documents.

4.1.2.2.1 Embedded SVG and CSS

For the purposes of styling SVG embedded in XHTML Content Documents by reference, Reading Systems MUST NOT apply CSS style rules of the containing document to the referenced SVG document.

For the purposes of styling SVG embedded in XHTML Content Documents by inclusion, Reading Systems MUST apply applicable CSS rules of the containing document to the included SVG elements.

Note

SVG included by reference is processed as a separate document, and can include its own CSS style rules just like an SVG Content Document would. Note that this is consistent with situations where an [HTML] object element references an external [HTML] element.

4.1.2.3 Form Submission

Reading System support for the submission of [HTML] forms is OPTIONAL. A Reading System might, for example, prevent form submissions by limiting access to networking.

4.2 SVG Content Documents

Reading Systems MUST process SVG Content Documents [EPUB-33].

To process SVG Content Documents and SVG embedded in XHTML Content Documents, a Reading System:

4.3 Cascading Style Sheets (CSS)

If a Reading System has a Viewport, it MUST support the visual rendering of XHTML Content Documents via CSS [EPUB-33].

To support CSS, a Reading System:

In addition to supporting CSS properties as defined above, a Reading System's user agent style sheet SHOULD support the [HTML] suggested default rendering.

Reading System developers should implement CSS support at the level of major browsers and publicly document their user agent style sheets and how they interact with EPUB Creator's style sheets.

4.4 Scripting

Reading Systems SHOULD support scripting [EPUB-33].

Reading System support for scripting depends on its usage context:

If a Reading System supports scripting:

Editor's note

Note that the definition of epubReadingSystem is currently marked as "at risk". If, in the final version of this document, the object becomes non-normative, then each "MUST" statement in the last bullet item would become a "MAY".

If a Reading System does not support scripting, it MUST process fallbacks for scripted content as defined in Fallbacks for Scripted Content Documents [EPUB-33].

4.4.1 Local Storage

Scripts may save persistent data through cookies and web storage [HTML], but Reading Systems MAY block such attempts. Reading Systems that allow users to store data MUST ensure they do not make that data available to other unrelated documents (e.g., ones that could be spoofed). In particular, checking for a matching document identifier (or similar metadata) is not a valid method to control access to persistent data.

Reading Systems that allow local storage [HTML] SHOULD provide methods for users to inspect or delete that data.

4.4.2 Event Model

Reading Systems SHOULD follow the DOM Event model as per [HTML] and pass UI events to the scripting environment before performing any default action associated with these events.

Reading System developers must ensure that scripts cannot disable critical functionality (such as navigation) to constrain the extent to which a potentially malicious script could impact their Reading Systems. As a result, although the scripting environment should be able to cancel the default action of any event, some events either might not be passed through or might not be cancelable.

4.4.3 Security Considerations

This section is non-normative.

Reading System developers who also support scripting must be aware of the security issues that arise when Reading Systems execute scripted content. As the underlying scripting model employed by Reading Systems and browsers is the same, developers must take into consideration the same kinds of issues encountered in web contexts.

Each Reading System must establish if it can trust the scripts in a particular document. Reading Systems should treat all scripts as untrusted (and potentially malicious), and developers should examine all vectors of attack and protect against them. In particular, developers should consider the following:

  • an attack against the runtime environment (e.g., stealing files from a user's hard drive);

  • an attack against the Reading System itself (e.g., stealing a list of a user's books or causing unexpected behavior);

  • an attack of one Content Document against another (e.g., stealing data that originated in a different document);

  • an attack of an unencrypted script against an encrypted portion of a document (e.g., an injected malicious script extracting protected content);

  • an attack against the local network (e.g., stealing data from a server behind a firewall).

To limit the possible damage of untrusted scripts, this specification recommends that Reading Systems establish a unique origin [URL] allocated to each EPUB Publication (see 7.1.1 URL of the Root Directory). Assigning a unique origin ensures that spine-level scripts [EPUB-33] are isolated from other EPUB Publications, and limits access to cookies [HTML], web storage [HTML], etc.

Examples of web APIs that are tied to the concept of "origin" include web storage [HTML] and IndexedDB [INDEXEDDB], which EPUB Content Documents can interact with via scripting. Reading Systems that allow users to add/remove publications from a managed library (their "bookshelf") may maintain the publication's unique origin when the publication is removed and subsequently re-imported into the content library. Conversely, Reading Systems may create a new unique origin for every newly added publication.

This specification also recommends that container-constrained scripts [EPUB-33] not be allowed to modify the DOM of the host EPUB Content Document and/or manipulate the containing rectangle (see 4.4 Scripting).

Note that compliance with these recommendations does not guarantee protection from the possible attacks listed above; developers must examine each potential vulnerability within the context of their Reading System.

5. Navigation Document Processing

Reading Systems MUST process EPUB Navigation Documents [EPUB-33].

To process the EPUB Navigation Document, a Reading System:

Reading Systems MUST honor the above requirements irrespective of whether the EPUB Navigation Document is part of the spine [EPUB-33].

6. Layout Rendering Control Processing

6.1 Fixed-Layout Documents

Reading Systems MUST support the rendering of Fixed-Layout Documents [EPUB-33].

6.1.1 Fixed-Layout Properties

6.1.1.1 The rendition:layout Property

The default value reflowable MUST be assumed by EPUB Reading Systems as the global value if no meta element carrying the rendition:layout property occurs in the Package Document metadata [EPUB-33].

When the rendition:layout property is set to pre-paginated, Reading Systems MUST NOT include space between the adjacent content slots when rendering Synthetic Spreads.

The rendition:layout property values have the following processing requirements:

reflowable

Reading Systems MAY apply dynamic pagination when rendering.

pre-paginated

Reading Systems MUST produce exactly one page per spine itemref [EPUB-33] when rendering.

When a spine itemref element's properties attribute contains an override of the global rendition:layout property [EPUB-33], Reading Systems MUST follow the requirements for the override's global value when displaying that spine item (e.g., a spine item that specifies layout-prepaginated is rendered following the requirements of the global pre-paginated value).

6.1.1.2 The rendition:orientation Property

The default value auto MUST be assumed by EPUB Reading Systems as the global value if no meta element carrying the rendition:orientation property occurs in the Package Document metadata [EPUB-33].

The rendition:orientation property values have the following processing requirements:

auto

The Reading System determines the orientation in which to render the content.

landscape

Reading Systems that support multiple orientations SHOULD render the content in lanscape orientation.

portrait

Reading Systems that support multiple orientations SHOULD render the content in portrait orientation.

The means by which they convey the intent is implementation specific.

6.1.1.3 The rendition:spread Property

The default value auto MUST be assumed by EPUB Reading Systems as the global value if no meta element carrying the rendition:spread property occurs in the Package Document metadata [EPUB-33].

The rendition:spread property values have the following processing requirements:

none

Reading Systems MUST NOT incorporate spine items in a Synthetic Spread. Reading Systems SHOULD create a single Viewport positioned at the center of the screen.

landscape

Reading Systems SHOULD render a Synthetic Spread for spine items only when the device is in landscape orientation.

portrait (deprecated)

Reading Systems SHOULD treat the value "portrait" as a synonym of "both" and create spreads regardless of orientation.

both

Reading Systems SHOULD render a Synthetic Spread regardless of device orientation.

auto

Reading Systems MAY use Synthetic Spreads in specific or all device orientations as part of a Content Display Area utilization optimization process.

6.1.1.4 The rendition:page-spread-* Properties

The rendition:page-spread-left property [EPUB-33] indicates that the given spine item SHOULD be rendered in the left-hand slot in the spread, and rendition:page-spread-right property [EPUB-33] that it SHOULD be rendered in the right-hand slot.

Reading Systems that support the spread-none property MUST recognize the rendition:page-spread-center property as an alias for it, otherwise they MUST ignore the rendition:page-spread-center property.

The rendition:page-spread-left and rendition:page-spread-right properties apply to both pre-paginated and reflowable content, and they only apply when the Reading System is creating Synthetic Spreads.

The rendition:page-spread-* properties MUST take precedence over whatever value of the page-break-before property [CSSSnapshot] has been set for an XHTML Content Document.

When a reflowable spine item follows a pre-paginated one, the reflowable one SHOULD start on the next page — as defined by the page-progression-direction attribute [EPUB-33] — when it lacks a rendition:page-spread-* property value.

If the reflowable spine item has a rendition:page-spread-* specification, it MUST be honored (e.g., by inserting a blank page).

Similarly, when a pre-paginated spine item follows a reflowable one, the pre-paginated one SHOULD start on the next page (as defined by the page-progression-direction attribute) when it lacks a rendition:page-spread-* property value. If the pre-paginated spine item has a rendition:page-spread-* specification, it MUST be honored (e.g., by inserting a blank page).

When a Reading System encounters two spine items that represent a true spread (i.e., two adjacent spine items with the rendition:page-spread-left and rendition:page-spread-right properties), it SHOULD create the spread with no space between the adjacent pages.

6.1.2 Initial Containing Block Dimensions

XHTML

Reading Systems MUST use the width and height expressions as defined in Expressing in HTML [EPUB-33] to render XHTML Content Documents.

Reading Systems MUST clip XHTML content to the initial containing block (ICB) dimensions declared in the viewport meta tag — content positioned outside of the initial containing block will not be visible. When the ICB aspect ratio does not match the aspect ratio of the Reading System Content Display Area, Reading Systems MAY position the ICB inside the area to accommodate the user interface; in other words, added letter-boxing space MAY appear on either side (or both) of the content.

SVG

Reading Systems MUST use the dimensions as defined in Expressing the ICB in SVG [EPUB-33] to render SVG Content Documents.

6.1.3 Viewport Rendering

When rendering Fixed-Layout Documents, the default intent is that the Content Display Area SHOULD occupy as much of the available Viewport area as possible. Reading Systems SHOULD NOT inject additional content such as border, margins, headers, or footers into the Viewport.

Note

This specification does not define how the initial containing block [CSS2] is placed within the Reading System Content Display Area.

Note

The exposure of Reading System control widgets to the user is implementation-specific and not included in the above behavioral expectations.

6.2 Reflowable Layouts

Reading Systems SHOULD process the general package rendering properties [EPUB-33].

6.2.1 The rendition:flow Property

If a Reading System supports the specified rendering, it SHOULD use that method to handle overflow content, but MAY provide the option for users to override the requested rendering.

The default global value is auto if no meta element carrying this property occurs in the metadata section [EPUB-33]. Reading Systems MAY support only this default value.

The rendition:flow property values have the following processing requirements:

paginated

The Reading System SHOULD dynamically paginate all overflow content.

scrolled-continuous

The Reading System SHOULD render all Content Documents such that overflow content is scrollable, and SHOULD present the EPUB Publication as one continuous scroll from spine item to spine item (except where locally overridden [EPUB-33]).

scrolled-doc

The Reading System SHOULD render all Content Documents such that users can scroll overflow content, and SHOULD present each spine item as a separate scrollable document.

auto

The Reading System MAY render overflow content using its default method or a user preference, whichever is applicable.

For the rendition:flow-scrolled-continuous property, the scroll direction MUST be defined relative to the block flow direction of the root element of the XHTML Content Document referenced by the itemref element [EPUB-33]. The scroll direction MUST be vertical if the block flow direction is downward (top-to-bottom). It MUST be horizontal if the block flow direction of the root element is rightward (left-to-right) or leftward (right-to-left).

Reading Systems MUST ignore the rendition:flow property and its overrides when processing pre-paginated spine items [EPUB-33].

6.2.2 The rendition:align-x-center Property

When the rendition:align-x-center property is set on a spine item, Reading Systems SHOULD render the content centered horizontally within the Viewport or spread, as applicable. This property does not affect the rendering of the spine item, only the placement of the resulting content box.

For reflowable content, Reading Systems that support this property MUST center each virtual page.

This specification does not define a default rendering behavior when Reading Systems do not support this property or EPUB Creators do not specify it. Reading Systems MAY render spine items by their own design.

6.3 Custom Properties

Reading Systems MAY support custom properties provided they do not introduce expressions that conflict behaviorally with the properties defined in the Package Rendering Vocabulary [EPUB-33].

7. Open Container Format Processing

Reading Systems MUST process the EPUB Container [EPUB-33].

Note

An application that processes EPUB Containers does not have to be a full-fledged Reading System (e.g., an application might only extract the content of a container or check the validity of the packaged content). In these cases, developers of such applications can ignore the rendering requirements for Reading Systems defined in this section.

7.1 OCF Abstract Container

7.1.1 URL of the Root Directory

Reading Systems MUST assign a URL [URL] to the Root Directory of the OCF Abstract Container. This URL is called the container root URL [EPUB-33]. It is implementation specific, but the implementation MUST have the following properties:

Note

The unicity of the origin per each user-specific instance of an EPUB Publication in a Reading System means that if two different users acquire a copy of the same EPUB Publication, the origins will be different for the two users on those copies even if the same Reading System is used.

Note

The properties of the container root URL are such that a conforming Reading System will parse any relative URL string to a content URL. In other words, relative links do not "leak" outside the container content, which is an important feature for security.

In practice, the container root URL behaves similarly to a URL defined as follows:

URL component Values
scheme http or https
host localhost
port a dynamic port uniquely assigned to the EPUB instance

for example:

Container File File Path URL
Root Directory empty string http://localhost:49152/
Package Document EPUB/package.opf http://localhost:49152/EPUB/package.opf
Content Document HTML/file name.xhtml http://localhost:49152/HTML/file%20name.xhtml
URL string
(found for example in the package document)
Content URL
../HTML/file%20name.xhtml http://localhost:49152/HTML/file%20name.xhtml
/Media/img.png http://localhost:49152/Media/img.png
../../../Media/img.png http://localhost:49152/Media/img.png

Note that the last two links are disallowed in an EPUB Publications to ensure better interoperability with non-conforming or legacy Reading Systems and toolchains.

Note

Some language specifications reference Requests For Comments that preceded [URL], in which case the earlier RFC applies for content in that particular language.

Note

Unlike most language specifications, Reading Systems must use the container root URL as the base URL [URL] for all files within the META-INF directory. See also the section on Parsing URLs in the META-INF Directory in [EPUB-33].

7.1.2 File Names

Although EPUB Creators are required to follow various File Name and File Path restrictions [EPUB-33] for maximum interoperability, Reading Systems SHOULD attempt to process File Names and Paths that do not adhere to these requirements. Invalid File Names and Paths may only be problematic on some operating systems.

This specification does not specify how a Reading System that is unable to represent OCF File Names and Paths would handle this incompatibility.

If a Reading System cannot preserve the names of files during an unzipping process, it will have to adjust the content to compensate for name changes (i.e., in any URIs that reference the original name).

7.1.3 META-INF Directory

Container File (container.xml)

A Reading System MUST, by default, use the Package Document referenced the from first rootfile element [EPUB-33] to render the EPUB Publication. If the Reading System recognizes a means of selecting from the other available options, it MAY choose a more appropriate Package Document.

Metadata File (metadata.xml)

Reading Systems SHOULD ignore metadata.xml files [EPUB-33] with unrecognized root elements.

Manifest File (manifest.xml)

Reading Systems MUST NOT use ancillary manifest information contained in the ZIP archive or in the manifest.xml file [EPUB-33] for processing an EPUB Publication.

Signature File (signature.xml)

Before computing the digest used to validate the signature in the signature.xml file [EPUB-33], Reading Systems MUST decrypt any data encrypted after signing — data encrypted before signing MUST NOT be decrypted.

Refer to Decryption Transform for XML Signature [XMLENC-DECRYPT] for more information about identifying data encrypted after signing.

Other Files

Reading Systems MUST NOT fail when encountering configuration files in the META-INF directory not listed in Reserved Files [EPUB-33].

7.2 OCF ZIP Container

A Reading System:

With respect to specific fields in the OCF ZIP Container archive, the Reading System:

7.3 Font Obfuscation

Reading Systems SHOULD support deobfuscation of fonts as defined in Font Obfuscation [EPUB-33].

To restore the original data, Reading Systems should simply reverse the process: the source file becomes the obfuscated data, and the destination file contains the raw data.

Note

EPUB 3 allowed font obfuscation prior to EPUB 3.0.1, but did not specify the order of obfuscation and compression. As a result, Reading Systems might encounter invalid fonts after decompression and deobfuscation. In such instances, deobfuscating the data before inflating it may return a valid font. Reading Systems do not have to support this method of retrieval, but developers should consider it when supporting EPUB 3 content generally.

8. Media Overlays Processing

Reading Systems with the capability to render prerecorded audio SHOULD support Media Overlays [EPUB-33].

If a Reading System does not support Media Overlays, it MUST ignore both:

8.1 Loading the Media Overlay

When a Reading System loads a Package Document, it MUST refer to the manifest item elements' [EPUB-33] media-overlay attributes to discover the corresponding Media Overlays for EPUB Content Documents.

Reading Systems MUST support playback for XHTML Content Documents, and MAY support SVG Content Documents.

Playback MUST start at the Media Overlay element which corresponds to the desired EPUB Content Document starting point. Note that the start of an EPUB Content Document MAY correspond to an element at the start or in the middle of a Media Overlay. When the Media Overlay Document finishes playing, the Reading System SHOULD load the next EPUB Content Document (as specified in the Package Document spine) and also load its corresponding Media Overlay Document, provided that one is given.

8.2 Basic Playback

8.2.1 Timing and Synchronization

Reading Systems MUST render immediate children of the body element [EPUB-33] in a sequence. A seq element's [EPUB-33] children MUST be rendered in sequence, and playback completes when the last child finishes playing. Reading System MUST render a par element's [EPUB-33] children in parallel (with each starting at the same time), and playback completes when all the children finish playing. Reading System playback of the Media Overlay Document completes when the body element's last child finishes playing.

8.2.2 Rendering Audio

When presented with a Media Overlay audio element, Reading Systems MUST play the audio resource referenced by the src attribute, starting at the clip offset time given by the clipBegin attribute and ending at the clip offset time given by the clipEnd attribute [EPUB-33].

In addition:

  • If the EPUB Creator has not specified a clipBegin attribute, Reading Systems MUST assume the value "0".

  • If the EPUB Creator has not specified a clipEnd attribute, Reading Systems MUST assume the value to be the full duration of the physical media.

  • If the value of clipEnd exceeds the full duration of the physical media, Reading Systems MUST assume its value to be the full duration of the physical media.

User-controllable audio playback options SHOULD include timescale modification, in which the user can alter the playback rate without distorting the pitch. The suggested range is half-speed to double-speed.

8.2.3 Rendering EPUB Content Document Elements

When presented with a Media Overlay text element [EPUB-33] whose src attribute contains a URL-fragment string referencing a specific part of an EPUB Content Document, Reading Systems SHOULD ensure the referenced portion is visible in the Viewport. In addition to [HTML] element ID references and SVG Fragment Identifiers [SVG], Reading Systems MAY support other fragment identifier schemes.

During Media Overlays playback, Reading Systems with a Viewport SHOULD add the class names given by the metadata properties active-class and playback-active-class [EPUB-33] to the appropriate elements, when specified, in the EPUB Content Document. Conversely, the class names SHOULD be removed when the playback state changes, as described in Associating Style Information [EPUB-33].

The active-class and playback-active-class metadata properties are OPTIONAL, and if omitted, Reading System behavior is implementation-specific.

Reading System behavior when a fragment identifier [EPUB-33] does not reference an element is also implementation-specific.

8.3 Interacting with the EPUB Content Document

8.3.1 Navigation

Because the Media Overlay is closely linked to the EPUB Content Document, it is very easy for Reading Systems to locate a position in the EPUB Content Document based on the current position in the Media Overlay playback. If the user pauses synchronized playback and navigates to a different part of the EPUB Publication, synchronized playback MUST resume at that point. For example, if a specific page number in the EPUB Content Document is the desired location, then this same point is located in the Media Overlay and playback started there.

This same approach allows for synchronizing the Media Overlay playback with user selection of a navigation point in the EPUB Navigation Document. The Reading System loads the Media Overlay for that file and finds the correct point for starting playback based on the ID of the navigation point target.

Note

EPUB Creators may associate a Media Overlay Document directly with an EPUB Navigation Document in order to provide synchronized playback of its contents, regardless of whether the XHTML Content Document in which it resides is included in the spine. See EPUB Navigation Document [EPUB-33] for more information.

Note

EPUB Creators may associate Media Overlay Document elements with EPUB Content Document structures such as tables. Reading Systems should ensure that Media Overlay playback remains synchronized with user navigation of table rows and cells. The Reading System might also play the corresponding table header preceding the contents of the cell.

8.3.2 Embedded Audio and Video

An EPUB Content Document with which a Media Overlay is associated MAY itself contain embedded video and audio media. The Media Overlay elements MAY point to these elements. Unlike text and images, video and audio media have an intrinsic duration. Consequently, when a Reading System renders the synchronization described by a Media Overlay, it MUST override the default playback behavior of audio and video media embedded within the associated EPUB Content Document.

Note that the rules below apply only to referenced [HTML] video or audio elements within the associated EPUB Content Document. That is to say, the rules apply to only those elements pointed to by text elements [EPUB-33] within the Media Overlay (i.e., via the src attribute). These rules do not apply to embedded media not referenced by Media Overlay elements.

  • Reading Systems MUST deactivate the public playback interface for all referenced audio and video media embedded within an EPUB Content Document (typically: play/pause control, time slider, volume level, etc.). This behavior avoids interference between the scheduled playback sequence defined by the Media Overlay, and the arbitrary playback behavior due to user interaction or script execution. As a result, when the Reading System is in playback mode, it SHOULD:

    • Hide the individual video/audio UI controls from the page, which overrides the default behavior defined by the [HTML] controls attribute.

    • Prevent scripts embedded within the EPUB Content Document from invoking the JavaScript audio/video playback API (i.e., authored as part of the default behavior).

  • Reading Systems MUST initialize all referenced audio and video media embedded within an EPUB Content Document to their "stopped" state, and ready them to play from the zero-position within their content stream (possibly displaying the image specified using the [HTML] poster attribute). This requirement overrides the default behavior defined by the [HTML] autoplay attribute.

  • When an EPUB Content Document element becomes active, the CSS Style Sheet visual highlighting rules apply regardless of the content type referred to by that element's src attribute (e.g., the CSS class name defined by the active-class metadata property [EPUB-33] SHOULD be applied to visible video and audio player controls within the host EPUB Content Document).

  • In addition to the default behavior of Media Overlay activation for textual fragments and images, audio and video playback MUST be started and stopped according to the duration implied by the authored Media Overlay synchronization (as per the standard [SMIL3] timing model). There are two possible scenarios:

    • When a Media Overlay text element has no audio [EPUB-33] sibling within its par [EPUB-33] parent container, the referenced EPUB Content Document audio or video media MUST play until it ends, at which point the text element's lifespan terminates. In this case, the implicit duration of the text element (and by inference, of the parent par container) is that of the referenced audio or video clip.

    • When a Media Overlay text element has an audio sibling within its par parent container, Reading Systems MUST constrain the playback duration of the referenced EPUB Content Document audio or video media by the duration of the audio sibling. In this case, the actual duration of the parent par container is that of the child audio clip, regardless of the duration of the video or audio media pointed to by the text element. This behavior can result in embedded video or audio media ending playback prematurely (before reaching its full duration), or ending before the playback of the parallel Media Overlay audio is finished (in which case the last-played video frame SHOULD remain visible until the parent par container finally ends). This behavior is equivalent of the Media Overlay audio element implicitly carrying the behavior of the [SMIL3] endsync attribute.

      Furthermore, Reading Systems SHOULD expose user controls for the volume levels of each independent audio track (i.e., from the audio element of the Media Overlay, and from the embedded audio or video media within the EPUB Content Document), so that users can adjust the audio output to match their requirements. Note that having overlapping audio tracks is typically an authoring-time concern: content producers usually add a layer of audio information over a video track for description purposes. Reading Systems handling of simultaneous volume levels in any specific way is OPTIONAL.

  • When a text element becomes inactive in the Media Overlay, and when it points to embedded video or audio media, that referenced media MUST be reset to its initial "stopped" state, ready to be played from the zero-position within their content stream (possibly displaying the poster image specified using the [HTML] markup).

8.3.3 Text-to-Speech

When a Media Overlay text element [EPUB-33] with no audio [EPUB-33] sibling element references text within the target EPUB Content Document, Reading Systems capable of text-to-speech (TTS) playback SHOULD render the referenced text using TTS.

Reading Systems SHOULD use the speech-related information provided in the target EPUB Content Document to play the audio stream as part of the Media Overlay rendering.

Note

See EPUB 3 Text-to-Speech Support [EPUB-TTS-10] for more information about supporting TTS technologies in EPUB Publications.

The Media Overlay text element's lifespan corresponds to the rendering time of the associated speech synthesis. The implicit duration of the text element (and by inference, of the parent par element) is therefore determined by the execution of the Text-to-Speech engine, and cannot be known at authoring time (factors like speech rate, pauses and other prosody parameters influence the audio output). This also means that Reading Systems should treat the duration property values set in the Package Document as approximative when making use of them.

8.4 Skippability and Escapability

8.4.1 Skippability

Reading Systems SHOULD use the semantic information provided by Media Overlay elements' epub:type attribute to offer users the option of skipping content.

When skipping of content is enabled, Reading Systems MUST suppress playback of any par and seq elements whose epub:type attribute contains a semantic that matches a skippable structure.

8.4.2 Escapability

Reading Systems SHOULD allow escaping of nested structures. Reading Systems MUST determine the start of nested structures by the value of the epub:type attribute and SHOULD offer users the option to skip playback of that structure and resume with whatever content comes after it.

9. Processing Structural Semantics

Reading Systems MAY support structural semantics [EPUB-33] in EPUB Content Documents.

When processing the epub:type attribute, a Reading System:

When the Reading System behavior associated with a given epub:type value conflicts with an element's native behavior, the behavior associated with the element MUST be given precedence.

10. Vocabulary Association Mechanisms

Reading Systems MUST support vocabulary association mechanisms [EPUB-33].

Reserved Prefixes

Reading Systems MUST resolve all reserved prefixes [EPUB-33] used in Package Documents using their predefined URLs unless the EPUB Creator declares a local prefix. Reading Systems MUST use the URLs defined for locally overridden prefixes (using the prefix attribute) when encountered.

As changes to the reserved prefixes and updates to Reading Systems are not always going happen in synchrony, Reading Systems MUST NOT fail when encountering unrecognized prefixes (i.e., not reserved and not declared using the prefix attribute).

The prefix attribute

If the prefix attribute includes a declaration for a predefined prefix, Reading Systems MUST use the URL mapping defined in the prefix attribute, regardless of whether of it maps to the same URL as the predefined prefix.

Expanding property Data Types

Reading Systems MUST expand property values [EPUB-33] as follows:

  • If the property consists only of a reference, concatenate the prefix URL associated with the default vocabulary [EPUB-33] to the reference.

  • If the property consists of a prefix and reference, concatenate the URL defined for the prefix to the reference. If the EPUB Creator has not defined a matching prefix, and it is not a reserved prefix [EPUB-33], the property is invalid and Reading Systems MUST ignore it.

  • If the property consists only of a prefix (i.e., there is no reference after the colon), the property is invalid and Reading Systems MUST ignore it.

The result MUST be a valid URL string [URL]. If the process results in an invalid URL, Reading Systems MUST ignore the property.

Reading Systems do not have to parse the resulting URL [URL] or attempt to dereference the resource.

11. Backward Compatibility

Reading Systems MUST attempt to process an EPUB Publication whose Package Document version attribute [EPUB-33] is less than "3.0".

EPUB Publications with older version numbers will not always render exactly as intended unless processed according to their respective specifications. Reading Systems SHOULD support such EPUB Publications as defined by those specifications.

12. Forward Compatibility

Reading Systems SHOULD attempt to process an EPUB Publication whose Package Document version attribute [EPUB-33] is greater than "3.0".

13. Accessibility

This section is non-normative.

Although the primary focus of this specification is on how to process and render EPUB Publications it does not mandate specific user interfaces that all Reading Systems must offer. This does not mean that there are not common accessibility issues that all Reading Systems developers should be aware of, or seek to avoid in their applications.

The W3C's User Agent Accessibility Guidelines [UAAG20] provides many useful practices developers should apply to improve their Reading Systems as many browser acccessibility issues have parallels in EPUB.

The following list outlines some additional EPUB-specific areas where a lack of accessibility impacts the reading experience for users:

The DAISY Consortium maintains an accessibility test suite to aid in evaluating these issues and more.

14. Security and Privacy

This section is non-normative.

14.1 Overview

The particularity of an EPUB Publication is its structure. The EPUB format provides a means of representing, packaging, and encoding structured and semantically enhanced web content — including HTML, CSS, SVG, and other resources — for distribution in a single-file container.

For Reading Systems, this means that the security and privacy issues are primarily based on the features of those formats, and closely mirror the threats presented by web content generally.

Reading System developers also have a dual responsibility of both ensuring the security and privacy of their applications and helping limit the threats to users from the content that renders within them. The rest of this section explores the risk model of EPUB 3 with the aim of helping developers recognize and mitigate these risks.

Note

For the risks associated with the authoring of EPUB Publications, refer to the security and privacy section of [EPUB-33].

14.2 Threat Model

The greatest threats to users come from the content they read [EPUB-33], and the first line of defence against these attacks is the Reading Systems they use. Users expect that Reading Systems act as safeguards against malicious content and are often unaware that EPUB Publications are susceptible to the same security risks as web sites.

But although Reading Systems are relied on to provide security and privacy, they can also pose unintended threats to users depending on how information is handled. Tracking user information to optimize experiences is a common need, for example, but done without user permission and Reading Systems can run afoul of legal privacy requirements.

This section outlines some of the key threats that Reading System developers must take into consideration, with further details and recommendations in the following sections.

Scripting

Malicious scripts present several attack vectors against reading systems. If local storage is not secure, for example, they can attempt to compromise the user's data. Provided with network access, they may attempt unauthorized collection of user data.

More detailed discussion of these issues and how to mitigate them is provided in 4.4.3 Security Considerations.

Malicious content

EPUB Publications may contain resources designed to exploit security flaws in Reading Systems or the operating systems they run on.

Remote resources

Remote resources present the same risks as any EPUB Publication loaded from an untrusted source. Even if the publisher of the EPUB Publication is trusted, remote resources may be compromised.

Calls to remote resources can also be used to track information about users (e.g., through server logs). Reading Systems should limit the information they expose through HTTP requests to only what is essential to obtain the resource.

The origin of an EPUB is both unknown to the EPUB Creator and specific to each Reading System implementation. Consequently, if the EPUB Creator hosts remote resources on a web server they control, the server effectively cannot use security features that require specifying allowable origins, such as headers for CORS, Content-Security-Policy, or X-Frame-Options.

External links

Like remote resources, external links may be used to trick unwitting users into opening malicious resources on the web designed to exploit the Reading System or operating system.

Likewise, Reading Systems should also avoid exposing potentially identifying information about users through the traversal of links (e.g., not using tracking identifiers or exposing unnecessary information about the user's environment).

User-generated content

User-generated content within a reading experience, for example through text areas or other interactive components, could pose a threat to reading system security or user privacy if the content is not properly secured. More details on scripting security are provided in 4.4.3 Security Considerations.

Collection of user data

Collecting information about the user and their reading habits without obtaining their permission can violate privacy laws, even if the information is only intended for internal use.

Attempting to profile users based on their reading habits or through metadata in their publication (e.g., accessibility preferences) can expose users to unintended harms.

Additionally, the security considerations that apply to [XML] and [ZIP] files also apply to the Package Document and the Open Container Format, respectively. See the "Security Consideration" sections of the Media Type registrations for the application/oebps-package+xml and the application/epub+zip formats for further details.

14.3 Recommendations

The strongest measure that Reading System developers can take for privacy is to specify the data they intend to collect and use about the user and/or their reading behaviour and seek the consent of users to obtain it. They should also allow personalization and control over this information.

If a Reading System allows users to store persistent data, especially personally identifiable information, it must treat that data as sensitive.

It is understood that the collection of some user data may be required for the sale, delivery, and operation of an EPUB Publication, particularly on platforms where the sale of an EPUB Publication and the method of reading it are connected. In these cases, it is recommended that the Reading System or retailer be clear about the data being collected, how it is used, and allow for user opt-outs where possible. Anonymization of data is strongly recommended for the privacy and the security of the user and Reading System.

It is also understood that user data may be required or helpful for some Reading System affordances. In these cases, anonymization is strongly recommended. It is also recommended that Reading Systems inform users of what data is needed, what it is to be used for, and to provide methods to opt-out.

Content processors — defined as entities that handle the ingestion of EPUB content for distribution, display, or sale — should also be aware of the potential risks in ingestion. It is advised that content processors check content for malicious content on ingestion, in addition to the validation steps that usually occur. This could include running virus scans, validating external links and remote resources, and other precautions.

15. epubReadingSystem Object

(Feature at Risk) Issue 1: Are there enough implementations?

Although this section is normative, it is not clear whether implementations of this interface are widespread enough to warrant this status. If it turns out not to be the case, this section will be marked as non-normative in the final version of the specification.

Note

Reading Systems act as the core rendering engines of EPUB Publications and provide a scripting environment based on the [DOM] specification. So, although this interface definition uses the [WEBIDL] notation for implementation by Reading Systems, web browsers generally do not have to implement these objects.

15.1 Interface Definition

This specification extends the the Navigator object [HTML] as follows.

WebIDL[Exposed=(Window)]
interface EpubReadingSystem {
    [LegacyUnforgeable] readonly attribute DOMString name;
    [LegacyUnforgeable] readonly attribute DOMString version;
    boolean hasFeature(DOMString feature, optional DOMString version);
};

partial interface Navigator {
    [LegacyUnforgeable, SameObject] readonly attribute EpubReadingSystem epubReadingSystem;
};
Note

This specification does not define an epubReadingSystem property extension for the WorkerNavigator object [HTML]. Reading Systems therefore do not have to expose the epubReadingSystem object in the scripting context of Workers, and EPUB Creators cannot rely on its presence.

15.2 Description

The Navigator.epubReadingSystem object provides an interface through which a Scripted Content Document can query information about a user's Reading System.

The object exposes properties of the Reading System (its name and version), and provides the hasFeature method which can be invoked to determine the features it supports.

Reading Systems MUST expose the epubReadingSystem object on the navigator object of all loaded Scripted Content Documents, including any nested container-constrained scripting contexts [EPUB-33]. Reading Systems MUST ensure that the epubReadingSystem object is available no later than when the DOMContentLoaded event is triggered [HTML].

Note

Reading systems implementations may create cloned instances of the epubReadingSystem object in Scripted Content Documents for technical feasibility reasons. In such cases, the Reading System must ensure they consistently maintain the object's state — as reflected by the values of its properties and methods — across all copied instances.

15.3 Properties

The Reading System MUST make the following properties available for retrieving information about it.

Name Description
name Returns a String value representing the name of the Reading System (e.g., "iBooks", "Kindle").
version Returns a String value representing the version of the Reading System (e.g., "1.0", "2.1.1").

This specification used to define a layoutStyle property, but it is now deprecated [EPUB-33]. Refer to its definition in [EPUBContentDocs-301] for more information.

15.4 Methods

15.4.1 hasFeature

15.4.1.1 Description

The hasFeature method returns a boolean value indicating whether the Reading System supports any version of the specified feature, or undefined if the Reading System does not recognize the specified feature.

The optional version parameter allows EPUB Creators to query custom features that could change in incompatible ways over time. The return value indicates support only for the specified version of the feature.

Features defined in this specification are versionless. If a Reading System supports a feature defined in this specification, it MUST ignore any supplied version parameter and return a true value.

15.4.1.2 Features

The following table lists the set of features that Reading Systems that support the epubReadingSystem object MUST recognize. When the features are queried from the hasFeature method, Reading Systems MUST return a boolean value indicating their support.

Name Description
dom-manipulation Scripts may make structural changes to the document’s DOM (applies to spine-level scripting [EPUB-33] only).
layout-changes Scripts may modify attributes and CSS styles that affect content layout (applies to spine-level scripting [EPUB-33] only).
touch-events The device supports touch events, and the Reading System passes touch events to the content.
mouse-events The device supports mouse events, and the Reading System passes mouse events to the content.
keyboard-events The device supports keyboard events, and the Reading System passes keyboard events to the content.
spine-scripting Indicates whether the Reading System supports spine-level scripting [EPUB-33] (e.g., so a container-constrained script [EPUB-33] can determine whether any actions that depend on scripting support in a Top-level Content Document have any chance of success before attempting them).

Reading System developers MAY add additional features, but future versions of this specification could append to this list in ways that might conflict or be incompatible with any such custom additions.

A. Change Log

This section is non-normative.

Note that this change log only identifies substantive Changes since EPUB 3.2 — those that affect the conformance of Reading Systems or are similarly noteworthy.

For a list of all issues addressed during the revision, refer to the Working Group's issue tracker.

B. Acknowledgements

This section is non-normative.

Specifications, like art, are human creations. No human has done more for EPUB than Garth Conboy, who has been there every step of the way, from the very first OEB 1.0 in 1999 to today's EPUB 3.3. None of this would have happened without Garth's vision, knowledge, and preternatural good nature. We dedicate EPUB 3.3 to his memory. We are forever in your debt, Garth.

The following members of the EPUB 3 Working Group contributed to the development of this specification:

C. References

C.1 Normative references

[BIDI]
Unicode Bidirectional Algorithm. Mark Davis; Aharon Lanin; Andrew Glass. Unicode Consortium. 27 August 2021. Unicode Standard Annex #9. URL: https://www.unicode.org/reports/tr9/tr9-44.html
[CSS-FONTS-4]
CSS Fonts Module Level 4. John Daggett; Myles Maxfield; Chris Lilley. W3C. 21 December 2021. W3C Working Draft. URL: https://www.w3.org/TR/css-fonts-4/
[CSSSnapshot]
CSS Snapshot. URL: https://www.w3.org/TR/CSS/
[DCTERMS]
DCMI Metadata Terms. DCMI Usage Board. DCMI. 20 January 2020. DCMI Recommendation. URL: https://www.dublincore.org/specifications/dublin-core/dcmi-terms/
[DOM]
DOM Standard. Anne van Kesteren. WHATWG. Living Standard. URL: https://dom.spec.whatwg.org/
[DOM-Level-2-Style]
Document Object Model (DOM) Level 2 Style Specification. Chris Wilson; Philippe Le Hegaret. W3C. 3 November 2020. W3C Recommendation. URL: https://www.w3.org/TR/DOM-Level-2-Style/
[EPUB-33]
EPUB 3.3. Matt Garrish; Ivan Herman; Dave Cramer. W3C. 31 March 2022. W3C Working Draft. URL: https://www.w3.org/TR/epub-33/
[EPUBContentDocs-301]
EPUB Content Documents 3.0.1. Markus Gylling; William McCoy; Elika J. Etimad; Matt Garrish. IDPF. 26 June 2014. URL: http://idpf.org/epub/301/spec/epub-contentdocs-20140626.html
[HTML]
HTML Standard. Anne van Kesteren; Domenic Denicola; Ian Hickson; Philip Jägenstedt; Simon Pieters. WHATWG. Living Standard. URL: https://html.spec.whatwg.org/multipage/
[Infra]
Infra Standard. Anne van Kesteren; Domenic Denicola. WHATWG. Living Standard. URL: https://infra.spec.whatwg.org/
[MathML3]
Mathematical Markup Language (MathML) Version 3.0 2nd Edition. David Carlisle; Patrick D F Ion; Robert R Miner. W3C. 10 April 2014. W3C Recommendation. URL: https://www.w3.org/TR/MathML3/
[Microdata]
HTML Microdata. Charles 'chaals' (McCathie) Nevile; Dan Brickley; Ian Hickson. W3C. 28 January 2021. W3C Working Group Note. URL: https://www.w3.org/TR/microdata/
[OpenType]
OpenType specification. Microsoft. URL: http://www.microsoft.com/typography/otspec/default.htm
[RDFA-CORE]
RDFa Core 1.1 - Third Edition. Ben Adida; Mark Birbeck; Shane McCarron; Ivan Herman et al. W3C. 17 March 2015. W3C Recommendation. URL: https://www.w3.org/TR/rdfa-core/
[RFC1951]
DEFLATE Compressed Data Format Specification version 1.3. P. Deutsch. IETF. May 1996. Informational. URL: https://www.rfc-editor.org/rfc/rfc1951
[RFC2046]
Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types. N. Freed; N. Borenstein. IETF. November 1996. Draft Standard. URL: https://www.rfc-editor.org/rfc/rfc2046
[RFC2119]
Key words for use in RFCs to Indicate Requirement Levels. S. Bradner. IETF. March 1997. Best Current Practice. URL: https://www.rfc-editor.org/rfc/rfc2119
[RFC2397]
The "data" URL scheme. L. Masinter. IETF. August 1998. Proposed Standard. URL: https://www.rfc-editor.org/rfc/rfc2397
[RFC8174]
Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words. B. Leiba. IETF. May 2017. Best Current Practice. URL: https://www.rfc-editor.org/rfc/rfc8174
[SMIL3]
Synchronized Multimedia Integration Language (SMIL 3.0). Dick Bulterman. W3C. 1 December 2008. W3C Recommendation. URL: https://www.w3.org/TR/SMIL3/
[SVG]
SVG. W3C. URL: https://www.w3.org/TR/SVG/
[TrueType]
TrueType™ Reference Manual. Apple, Inc. URL: https://developer.apple.com/fonts/TrueType-Reference-Manual/
[URL]
URL Standard. Anne van Kesteren. WHATWG. Living Standard. URL: https://url.spec.whatwg.org/
[W3CProcess]
W3C Process Document. URL: https://www.w3.org/Consortium/Process/
[WAI-ARIA]
Accessible Rich Internet Applications (WAI-ARIA) 1.0. James Craig; Michael Cooper et al. W3C. 20 March 2014. W3C Recommendation. URL: https://www.w3.org/TR/wai-aria/
[WEBIDL]
Web IDL Standard. Edgar Chen; Timothy Gu. WHATWG. Living Standard. URL: https://webidl.spec.whatwg.org/
[WOFF]
WOFF File Format 1.0. Jonathan Kew; Tal Leming; Erik van Blokland. W3C. 13 December 2012. W3C Recommendation. URL: https://www.w3.org/TR/WOFF/
[WOFF2]
WOFF File Format 2.0. Vladimir Levantovsky; Raph Levien. W3C. 10 March 2022. W3C Recommendation. URL: https://www.w3.org/TR/WOFF2/
[XML]
Extensible Markup Language (XML) 1.0 (Fifth Edition). Tim Bray; Jean Paoli; Michael Sperberg-McQueen; Eve Maler; François Yergeau et al. W3C. 26 November 2008. W3C Recommendation. URL: https://www.w3.org/TR/xml/
[XML-NAMES]
Namespaces in XML 1.0 (Third Edition). Tim Bray; Dave Hollander; Andrew Layman; Richard Tobin; Henry Thompson et al. W3C. 8 December 2009. W3C Recommendation. URL: https://www.w3.org/TR/xml-names/
[ZIP]
.ZIP File Format Specification. 1 September 2012. Final. URL: https://www.pkware.com/documents/casestudies/APPNOTE.TXT

C.2 Informative references

[CSS2]
Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. Bert Bos; Tantek Çelik; Ian Hickson; Håkon Wium Lie. W3C. 7 June 2011. W3C Recommendation. URL: https://www.w3.org/TR/CSS21/
[EPUB-TTS-10]
EPUB 3 Text-to-Speech Enhancements 1.0. Matt Garrish. W3C. 31 March 2022. W3C Working Group Note. URL: https://www.w3.org/TR/epub-tts-10/
[EPUBPackages-32]
EPUB Packages 3.2. Matt Garrish; Dave Cramer. EPUB 3 Community Group. 08 May 2019. URL: https://www.w3.org/publishing/epub32/epub-packages.html
[H264]
H.264 : Advanced video coding for generic audiovisual services. 2017-04-13. URL: https://www.itu.int/ITU-T/recommendations/rec.aspx?rec=13189
[INDEXEDDB]
Indexed Database API. Nikunj Mehta; Jonas Sicking; Eliot Graff; Andrei Popescu; Jeremy Orlow; Joshua Bell. W3C. 8 January 2015. W3C Recommendation. URL: https://www.w3.org/TR/IndexedDB/
[RFC6386]
VP8 Data Format and Decoding Guide. J. Bankoski; J. Koleszar; L. Quillio; J. Salonen; P. Wilkins; Y. Xu. IETF. November 2011. Informational. URL: https://www.rfc-editor.org/rfc/rfc6386
[UAAG20]
User Agent Accessibility Guidelines (UAAG) 2.0. James Allan; Greg Lowney; Kimberly Patch; Jeanne F Spellman. W3C. 15 December 2015. W3C Working Group Note. URL: https://www.w3.org/TR/UAAG20/
[WAI-ARIA-11]
Accessible Rich Internet Applications (WAI-ARIA) 1.1. Joanmarie Diggs; Shane McCarron; Michael Cooper; Richard Schwerdtfeger; James Craig. W3C. 14 December 2017. W3C Recommendation. URL: https://www.w3.org/TR/wai-aria-1.1/