ePub
Creates a new Book
Parameters
options (object)
to pass to the book
Returns
Book
:
a new Book object
Example
ePub("/path/to/book.epub", {})
Book
An Epub representation with methods for the loading, parsing and manipulation
of its contents.
Parameters
Name |
Description |
options.requestMethod method?
|
a request function to use instead of the default
|
options.requestCredentials boolean
(default undefined )
|
send the xhr request withCredentials
|
options.requestHeaders object
(default undefined )
|
send the xhr request headers
|
options.encoding string
(default binary )
|
optional to pass 'binary' or base64' for archived Epubs
|
options.replacements string
(default none )
|
use base64, blobUrl, or none for replacing assets in archived Epubs
|
options.canonical method?
|
optional function to determine canonical urls for a path
|
options.openAs string?
|
optional string to determine the input type
|
Returns
Book
:
Example
new Book("/path/to/book.epub", {})
new Book({ replacements: "blobUrl" })
Static Members
Instance Members
Open a epub or url
Parameters
what (string
= "binary","base64","epub","opf","json","directory"
)
force opening as a certain type
Returns
Promise
:
of when the book has been loaded
Example
book.open("/path/to/book.epub")
Load a resource from the Book
Parameters
path (string)
path to the resource to load
Returns
Promise
:
returns a promise with the requested resource
▸
resolve(path, absolute?)
Resolve a path to it's absolute position in the Book
Parameters
absolute (boolean?)
force resolving the full URL
Returns
string
:
the resolved path string
Get a canonical link to a path
Parameters
Returns
string
:
the canonical path string
Gets a Section of the Book from the Spine
Alias for book.spine.get
Parameters
Returns
Section
:
▸
renderTo(element, options?)
Sugar to render a book to an element
Parameters
element ((element | string))
element or string to add a rendition to
Returns
Rendition
:
▸
setRequestCredentials(credentials)
Set if request should use withCredentials
setRequestCredentials(credentials:
boolean)
Parameters
Get the cover url
Returns
string
:
coverUrl
Find a DOM Range for a given CFI Range
Parameters
cfiRange (EpubCFI)
a epub cfi range
Returns
Range
:
Generates the Book Key using the identifer in the manifest or other string provided
Parameters
identifier (string?)
to use instead of metadata identifier
Returns
string
:
key
Destroy the Book and all associated objects
destroy()
Url
creates a Url object for parsing and manipulation of a url string
Parameters
urlString (string)
a url string (relative or absolute)
baseString (string?)
optional base for the url,
default to window.location.href
Instance Members
Resolves a relative path to a absolute url
Parameters
Returns
string
:
url
Resolve a path relative to the url
Parameters
Returns
string
:
path
Path
Creates a Path object for parsing and manipulation of a path strings
Uses a polyfill for Nodejs path: https://nodejs.org/api/path.html
Parameters
pathString (string)
a url string (relative or absolute)
Instance Members
Check if path ends with a directory
Parameters
Returns
boolean
:
Return the path string
Returns
string
:
path
Spine
A collection of Spine Items
new Spine()
Instance Members
▸
unpack(_package, resolver, canonical)
Unpack items from a opf into spine items
unpack(_package:
Packaging, resolver: method, canonical: method)
Parameters
resolver (method)
URL resolver
canonical (method)
Resolve canonical url
Get an item from the spine
Parameters
Returns
Section
:
section
Example
spine.get();
spine.get(1);
spine.get("chap1.html");
spine.get("#id1234");
Loop over the Sections in the Spine
each(): method
Returns
method
:
forEach
Find the first Section in the Spine
Returns
Section
:
first section
Find the last Section in the Spine
Returns
Section
:
last section
Section
Represents a Section of the Book
In most books this is equivelent to a Chapter
Parameters
item (object)
The spine item representing the section
hooks (object)
hooks for serialize and content
Instance Members
Load the section from its url
Parameters
_request (method?)
a request method to use for loading
Returns
document
:
a promise with the xml document
Render the contents of a section
render(_request: method?):
string
Parameters
_request (method?)
a request method to use for loading
Returns
string
:
output a serialized XML Document
Find a string in a section
Parameters
_query (string)
The query string to find
Returns
Array<object>
:
A list of matches, with form {cfi, excerpt}
▸
reconcileLayoutSettings(globalLayout)
Reconciles the current chapters layout properies with
the global layout properities.
Parameters
globalLayout (object)
The global layout settings object, chapter properties string
Returns
object
:
layoutProperties Object with layout properties
Get a CFI from a Range in the Section
Parameters
Returns
string
:
cfi an EpubCFI string
Get a CFI from an Element in the Section
Parameters
Returns
string
:
cfi an EpubCFI string
Unload the section document
unload()
Locations
Find Locations for a Book
Parameters
Instance Members
Load all of sections in the book to generate locations
Parameters
chars (int)
how many chars to split on
Returns
object
:
locations
Get a location from an EpubCFI
Parameters
Returns
number
:
Get a percentage position in locations from an EpubCFI
Parameters
Returns
number
:
▸
percentageFromLocation(loc, location)
Get a percentage position from a location index
Parameters
Returns
number
:
Get an EpubCFI from location index
Parameters
Returns
EpubCFI
:
cfi
▸
cfiFromPercentage(percentage)
Get an EpubCFI from location percentage
Parameters
Returns
EpubCFI
:
cfi
Load locations from JSON
Parameters
Save locations to JSON
Returns
json
:
Get the current location
currentLocation
Set the current location
currentLocation
Parameters
Locations length
length()
Container
Handles Parsing and Accessing an Epub Container
new Container(containerDocument:
document?)
Parameters
containerDocument (document?)
xml document
Instance Members
▸
parse(containerDocument)
Parse the Container XML
Parameters
Packaging
Open Packaging Format Parser
new Packaging(packageDocument:
document)
Parameters
Instance Members
Parse OPF XML
Parameters
Returns
object
:
parsed package parts
▸
load(json, packageDocument)
Load JSON Manifest
Parameters
Returns
object
:
parsed package parts
Navigation
Navigation Parser
Parameters
xml (document)
navigation html / xhtml / ncx
Instance Members
Parse out the navigation items
Parameters
xml (document)
navigation html / xhtml / ncx
Get an item from the navigation
Parameters
Returns
object
:
navItem
Load Spine Items
Parameters
json (object)
the items to be loaded
Returns
Array
:
navItems
forEach pass through
Parameters
fn (Function)
function to run on each item
Returns
method
:
forEach loop
Resources
Handle Package Resources
new Resources(manifest: Manifest, options:
object?)
Parameters
Name |
Description |
options.replacements string
(default "base64" )
|
|
options.archive Archive?
|
|
options.resolver method?
|
|
Instance Members
Create a url to a resource
Parameters
Returns
Promise<string>
:
Promise resolves with url string
Create blob urls for all the assets
Returns
Promise
:
returns replacement urls
▸
relativeTo(absolute, resolver?)
Resolve all resources URLs relative to an absolute URL
Parameters
absolute (string)
to be resolved to
Returns
Array<string>
:
array with relative Urls
Get a URL for a resource
Parameters
Returns
string
:
url
▸
substitute(content, url?)
Substitute urls in content, with replacements,
relative to a url if provided
Parameters
url (string?)
url to resolve to
Returns
string
:
content with urls substituted
PageList
Page List Parser
Parameters
Instance Members
Parse PageList Xml
Parameters
Get a PageList result from a EpubCFI
Parameters
Returns
number
:
page
Get an EpubCFI from a Page List Item
Parameters
Returns
string
:
cfi
▸
pageFromPercentage(percent)
Get a Page from Book percentage
Parameters
Returns
number
:
page
Returns a value between 0 - 1 corresponding to the location of a page
Parameters
Returns
number
:
percentage
Returns a value between 0 - 1 corresponding to the location of a cfi
Parameters
Returns
number
:
percentage
Archive
Handles Unzipping a requesting files from an Epub Archive
new Archive()
Instance Members
Open an archive
Parameters
isBase64 (boolean?)
tells JSZip if the input data is base64 encoded
Returns
Promise
:
zipfile
▸
openUrl(zipUrl, isBase64?)
Load and Open an archive
Parameters
isBase64 (boolean?)
tells JSZip if the input data is base64 encoded
Returns
Promise
:
zipfile
Request a url from the archive
Parameters
url (string)
a url to request from the archive
type (string?)
specify the type of the returned result
Returns
Promise<(Blob | string | JSON | Document | XMLDocument)>
:
▸
getBlob(url, mimeType?)
Get a Blob from Archive by Url
Parameters
Returns
Blob
:
▸
getText(url, encoding?)
Get Text from Archive by Url
Parameters
Returns
string
:
▸
getBase64(url, mimeType?)
Get a base64 encoded result from Archive by Url
Parameters
Returns
string
:
base64 encoded
▸
createUrl(url, options)
Create a Url from an unarchived item
Parameters
Returns
Promise
:
url promise with Url string
Revoke Temp Url for a achive item
Parameters
url (string)
url of the item in the archive
Rendition
Displays an Epub as a series of Views for each Section.
Requires Manager and View class to handle specifics of rendering
the section contetn.
Parameters
Name |
Description |
options.width number?
|
|
options.height number?
|
|
options.ignoreClass string?
|
class for the cfi parser to ignore
|
options.manager (string | function | object)
(default 'default' )
|
|
options.view (string | function)
(default 'iframe' )
|
|
options.layout string?
|
layout to force
|
options.spread string?
|
force spread value
|
options.minSpreadWidth number?
|
overridden by spread: none (never) / both (always)
|
options.stylesheet string?
|
url of stylesheet to be injected
|
options.resizeOnOrientationChange boolean?
|
false to disable orientation events
|
options.script string?
|
url of script to be injected
|
Static Members
Adds Hook methods to the Rendition prototype
hooks
Type:
object
A Rendered Location Range
location
Properties
Instance Members
Set the manager function
Parameters
▸
requireManager(manager)
Require the manager from passed string, or as a class function
Parameters
Returns
method
:
Require the view from passed string, or as a class function
Parameters
Returns
view
:
Start the rendering
Returns
Promise
:
rendering has started
Call to attach the container to an element in the dom
Container must be attached before rendering can begin
Parameters
Returns
Promise
:
Display a point in the book
The request will be added to the rendering Queue,
so it will wait until book is opened, rendering started
and all other rendering tasks have finished to be called.
Parameters
target (string)
Url or EpubCFI
Returns
Promise
:
Move the Rendition to a specific offset
Usually you would be better off calling display()
Parameters
▸
resize(width?, height?)
Trigger a resize of the views
Parameters
Clear all rendered views
clear()
Go to the next "page" in the rendition
Returns
Promise
:
Go to the previous "page" in the rendition
Returns
Promise
:
Adjust the flow of the rendition to paginated or scrolled
(scrolled-continuous vs scrolled-doc are handled by different view managers)
Parameters
Adjust the layout of the rendition to reflowable or pre-paginated
Parameters
Adjust if the rendition uses spreads
spread(spread:
string, min: int)
Parameters
spread (string)
none | auto (TODO: implement landscape, portrait, both)
min (int)
min width to use spreads at
Adjust the direction of the rendition
Parameters
Report the current location
reportLocation()
Get the Current Location object
currentLocation(): (displayedLocation |
promise)
Returns
(displayedLocation | promise)
:
location (may be a promise)
Remove and Clean Up the Rendition
destroy()
▸
getRange(cfi, ignoreClass)
Get a Range from a Visible CFI
Parameters
Returns
range
:
Get the Contents object of each rendered view
Returns
Array<Contents>
:
Get the views member from the manager
views(): Views
Returns
Views
:
Events
Emit that rendering has started
started
Emit that rendering has attached to an element
attached
Emit that a section has been displayed
displayed
Parameters
Emit that has been an error displaying
displayError
Parameters
Emit that a section has been rendered
rendered
Parameters
Emit that a section has been removed
removed
Parameters
Emit that the rendition has been resized
resized
Parameters
Emit that the rendition has been rotated
orientationchange
Parameters
locationChanged
Deprecated: This is deprecated.
Properties
Emit that a text selection has occured
selected
Parameters
Emit that a mark was clicked
markClicked
Parameters
Hook
Hooks allow for injecting functions that must all complete in order before finishing
They will execute in parallel but all must finish before continuing
Functions may return a promise if they are asycn.
new Hook(context: any)
Parameters
context (any)
scope of this
Example
this.content = new EPUBJS.Hook(this);
Instance Members
Adds a function to be run before a hook completes
register()
Example
this.content.register(function(){...});
Triggers a hook to run all functions
trigger()
Example
this.content.trigger(args).then(function(){...});
Queue
Queue for handling tasks one at a time
new Queue(context: scope)
Parameters
context (scope)
what this will resolve to in the tasks
Instance Members
Add an item to the queue
Returns
Promise
:
Run all tasks sequentially, at convince
Returns
Promise
:
Flush all, as quickly as possible
Returns
Promise
:
Clear all items in wait
clear()
Get the number of tasks in the queue
Returns
number
:
tasks
Pause a running queue
pause()
Layout
Figures out the CSS values to apply for a layout
Parameters
Name |
Description |
settings.layout string
(default 'reflowable' )
|
|
settings.spread string?
|
|
settings.minSpreadWidth number
(default 800 )
|
|
settings.evenSpreads boolean
(default false )
|
|
Instance Members
Switch the flow between paginated and scrolled
Parameters
flow (string)
paginated | scrolled
Returns
string
:
simplified flow
Switch between using spreads or not, and set the
width at which they switch to single.
Parameters
spread (string)
"none" | "always" | "auto"
min (number)
integer in pixels
Returns
boolean
:
spread true | false
▸
calculate(_width, _height, _gap)
Calculate the dimensions of the pagination
Parameters
_width (number)
width of the rendering
_height (number)
height of the rendering
_gap (number)
width of the gap between columns
▸
count(totalLength, pageLength)
Count number of pages
Parameters
Returns
{spreads: Number, pages: Number}
:
Themes
Themes to apply to displayed content
Parameters
Instance Members
Add themes to be used by a rendition
register()
Example
themes.register("light", "http://example.com/light.css")
themes.register("light", { "body": { "color": "purple"}})
themes.register({ "light" : {...}, "dark" : {...}})
Add a default theme to be used by a rendition
Parameters
Example
themes.register("http://example.com/default.css")
themes.register({ "body": { "color": "purple"}})
Register themes object
registerThemes(themes:
object)
Parameters
▸
registerUrl(name, input)
Register a url
Parameters
▸
registerRules(name, rules)
Select a theme
Parameters
Update a theme
Parameters
Inject all themes into contents
Parameters
Add Theme to contents
Parameters
▸
override(name, value, priority)
▸
overrides(contents, content)
Add all overrides
overrides(contents: any, content: Content)
Parameters
Adjust the font size of a rendition
Parameters
Adjust the font-family of a rendition
Parameters
Annotations
Handles managing adding & removing Annotations
Parameters
Instance Members
▸
add(type, cfiRange, data, cb?, className, styles)
Add an annotation to store
Parameters
type (string)
Type of annotation to add: "highlight", "underline", "mark"
cfiRange (EpubCFI)
EpubCFI range to attach annotation to
data (object)
Data to assign to annotation
cb (function?)
Callback after annotation is added
className (string)
CSS class to assign to annotation
styles (object)
CSS styles to assign to annotation
Returns
Annotation
:
annotation
Remove an annotation from store
Parameters
cfiRange (EpubCFI)
EpubCFI range the annotation is attached to
type (string)
Type of annotation to add: "highlight", "underline", "mark"
▸
highlight(cfiRange, data, cb, className, styles)
Add a highlight to the store
Parameters
cfiRange (EpubCFI)
EpubCFI range to attach annotation to
data (object)
Data to assign to annotation
cb (function)
Callback after annotation is added
className (string)
CSS class to assign to annotation
styles (object)
CSS styles to assign to annotation
▸
underline(cfiRange, data, cb, className, styles)
Add a underline to the store
Parameters
cfiRange (EpubCFI)
EpubCFI range to attach annotation to
data (object)
Data to assign to annotation
cb (function)
Callback after annotation is added
className (string)
CSS class to assign to annotation
styles (object)
CSS styles to assign to annotation
▸
mark(cfiRange, data, cb)
Add a mark to the store
Parameters
cfiRange (EpubCFI)
EpubCFI range to attach annotation to
data (object)
Data to assign to annotation
cb (function)
Callback after annotation is added
iterate over annotations in the store
each()
[Not Implemented] Show annotations
show()
[Not Implemented] Hide annotations
hide()
Annotation
Annotation object
Parameters
Name |
Description |
$0.type any
|
|
$0.cfiRange any
|
|
$0.data any
|
|
$0.sectionIndex any
|
|
$0.cb any
|
|
$0.className any
|
|
$0.styles any
|
|
Name |
Description |
options.type string
|
Type of annotation to add: "highlight", "underline", "mark"
|
options.cfiRange EpubCFI
|
EpubCFI range to attach annotation to
|
options.data object
|
Data to assign to annotation
|
options.sectionIndex int
|
Index in the Spine of the Section annotation belongs to
|
options.cb function?
|
Callback after annotation is added
|
className (string)
CSS class to assign to annotation
styles (object)
CSS styles to assign to annotation
Returns
Annotation
:
annotation
Instance Members
Update stored data
Parameters
Add to a view
attach(view: View)
Parameters
Remove from a view
detach(view: View)
Parameters
[Not Implemented] Get text of an annotation
text()
EpubCFI
Parsing and creation of EpubCFIs: http://www.idpf.org/epub/linking/cfi/epub-cfi.html
Implements:
- Character Offset: epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/2/1:3)
- Simple Ranges : epubcfi(/6/4[chap01ref]!/4[body01]/10[para05],/2/1:1,/3:4)
Does Not Implement:
- Temporal Offset (~)
- Spatial Offset (@)
- Temporal-Spatial Offset (~ + @)
- Text Location Assertion ([)
Parameters
ignoreClass (string?)
class to ignore when parsing DOM
Instance Members
Parse a cfi string to a CFI object representation
Parameters
Returns
object
:
cfi
Convert CFI to a epubcfi(...) string
Returns
string
:
epubcfi
▸
compare(cfiOne, cfiTwo)
Compare which of two CFIs is earlier in the text
compare(cfiOne: any, cfiTwo: any):
number
Parameters
Returns
number
:
First is earlier = -1, Second is earlier = 1, They are equal = 0
▸
fromRange(range, base, ignoreClass?)
Create a CFI object from a Range
Parameters
Returns
object
:
cfi
▸
fromNode(anchor, base, ignoreClass?)
Create a CFI object from a Node
Parameters
Returns
object
:
cfi
▸
toRange(_doc, ignoreClass?)
Creates a DOM range representing a CFI
Parameters
_doc (document)
document referenced in the base
Returns
Range
:
Check if a string is wrapped with "epubcfi()"
Parameters
Returns
boolean
:
Collapse a CFI Range to a single CFI Position
Parameters
Contents
Handles DOM manipulation, queries and events for View contents
Parameters
content (element)
Parent Element (typically Body)
cfiBase (string)
Section component of CFIs
sectionIndex (number)
Index in Spine of Conntent's Section
Static Members
Get DOM events that are listened for and passed along
listenedEvents
Instance Members
Get or Set width
Parameters
Returns
number
:
width
Get or Set height
Parameters
Returns
number
:
height
Get or Set width of the contents
Parameters
Returns
number
:
width
Get or Set height of the contents
Parameters
Returns
number
:
height
Get the width of the text using Range
Returns
number
:
width
Get the height of the text using Range
Returns
number
:
height
Get documentElement scrollWidth
Returns
number
:
width
Get documentElement scrollHeight
Returns
number
:
height
Set overflow css style of the contents
Parameters
Set overflowX css style of the documentElement
Parameters
Set overflowY css style of the documentElement
Parameters
▸
css(property, value, priority?)
Set Css styles on the contents element (typically Body)
Parameters
priority (boolean?)
set as "important"
Get or Set the viewport element
Parameters
Get the documentElement
Returns
element
:
documentElement
▸
locationOf(target, ignoreClass?)
Get the location offset of a EpubCFI or an #id
Parameters
ignoreClass (string?)
for the cfi
Append a stylesheet link to the document head
Parameters
▸
addStylesheetRules(rules)
Append a script tag to the document head
Parameters
Returns
Promise
:
loaded
Add a class to the contents container
Parameters
▸
removeClass(className, removeClass)
Remove a class from the contents container
removeClass(className: any, removeClass:
string)
Parameters
▸
range(_cfi, ignoreClass?)
Get a Dom Range from EpubCFI
Parameters
Returns
Range
:
range
▸
cfiFromRange(range, ignoreClass?)
Get an EpubCFI from a Dom Range
Parameters
Returns
EpubCFI
:
cfi
▸
cfiFromNode(node, ignoreClass?)
Get an EpubCFI from a Dom node
Parameters
Returns
EpubCFI
:
cfi
Size the contents to a given width and height
Parameters
▸
columns(width, height, columnWidth, gap)
Apply columns to the contents for pagination
Parameters
▸
scaler(scale, offsetX, offsetY)
Scale contents from center
Parameters
Fit contents into a fixed width and height
Parameters
Set the direction of the text
Parameters
dir (string
= "ltr"
)
"rtl" | "ltr"
Set the writingMode of the text
Parameters
mode (string
= "horizontal-tb"
)
"horizontal-tb" | "vertical-rl" | "vertical-lr"
Mapping
Map text locations to CFI ranges
Parameters
layout (Layout)
Layout to apply
direction (string
= "ltr"
)
Text direction
axis (string
= "horizontal"
)
vertical or horizontal axis
dev (boolean?)
toggle developer highlighting
Instance Members
Find CFI pairs for entire section at once
section(view: any)
Parameters
▸
page(contents, cfiBase, start, end)
Find CFI pairs for a page
Parameters
cfiBase (string)
string of the base for a cfi
start (number)
position to start at
end (number)
position to end at
Set the axis for mapping
Parameters
axis (string)
horizontal | vertical
Returns
boolean
:
is it horizontal?
Core
Core Utilities and Helpers
Core
Static Members
Vendor prefixed requestAnimationFrame
requestAnimationFrame
Returns
function
:
requestAnimationFrame
Gets the height of a document
Returns
number
:
height
Checks if a node is an element
Parameters
Returns
boolean
:
Get a prefixed css property
Parameters
Returns
string
:
Apply defaults to an object
Parameters
Returns
object
:
Extend properties of an object
Parameters
Returns
object
:
▸
insert(item, array, compareFunction?)
▸
locationOf(item, array, compareFunction?, _start?, _end?)
Finds where something would fit into a sorted array
Parameters
Returns
number
:
location (in array)
▸
indexOfSorted(item, array, compareFunction?, _start?, _end?)
Finds index of something in a sorted array
Returns -1 if not found
Parameters
Returns
number
:
index (in array) or -1
Find the bounds of an element
taking padding and margin into account
Parameters
Returns
{width: Number, height: Number}
:
Find the bounds of an element
taking padding, margin and borders into account
Parameters
Returns
{width: Number, height: Number}
:
Find the bounds of any node
allows for getting bounds of text nodes by wrapping them in a range
nodeBounds(node:
node): BoundingClientRect
Parameters
Returns
BoundingClientRect
:
▸
indexOfNode(node, typeId)
Gets the index of a node in its parent
Parameters
Returns
number
:
index
▸
indexOfTextNode(textNode)
Gets the index of a text node in its parent
Parameters
Returns
number
:
index
▸
indexOfElementNode(elementNode)
Gets the index of an element node in its parent
Parameters
Returns
number
:
index
Check if extension is xml
Parameters
Returns
boolean
:
▸
createBlob(content, mime)
Create a new blob
Parameters
Returns
Blob
:
▸
createBlobUrl(content, mime)
Create a new blob url
Parameters
Returns
string
:
url
Remove a blob url
Parameters
▸
createBase64Url(content, mime)
Create a new base64 encoded url
Parameters
Returns
string
:
url
Get type of an object
Parameters
Returns
string
:
type
▸
parse(markup, mime, forceXMLDom)
Parse xml (or html) markup
Parameters
forceXMLDom (boolean)
force using xmlDom to parse instead of native parser
Returns
document
:
document
querySelector polyfill
Parameters
Returns
element
:
element
querySelectorAll polyfill
Parameters
Returns
Array<element>
:
elements
querySelector by property
Parameters
Returns
Array<element>
:
elements
Sprint through all text nodes in a document
Parameters
root (element)
element to start with
func (function)
function to run on each element
▸
treeWalker(root, func, filter)
Create a treeWalker
Parameters
root (element)
element to start with
func (function)
function to run on each element
▸
walk(node, callback, return)
walk(node:
node, callback: any, return: callback)
Parameters
return (callback)
false for continue,true for break inside callback
Convert a blob to a base64 encoded string
blob2base64(blob: Blog):
string
Parameters
Returns
string
:
▸
querySelectorByType(html, element, type)
querySelector with filter by epub type
Parameters
element (string)
element type to find
type (string)
epub type to find
Returns
Array<element>
:
elements
Find direct decendents of an element
Parameters
Returns
Array<element>
:
children
Find all parents (ancestors) of an element
Parameters
Returns
Array<element>
:
parents
▸
filterChildren(el, nodeName, single?)
Find all direct decendents of a specific type
Parameters
Returns
Array<element>
:
children
▸
getParentByTagName(node, tagname)
Filter all parents (ancestors) with tag name
Parameters
Returns
Array<element>
:
parents
Lightweight Polyfill for DOM Range
new RangeObject()