This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
@ephox/sugar with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
sugar is a library for manipulating and accessing the DOM. It does not bundle any commands. It is only a collection of modules.
sugar is available as an
npm package. You can install it via the npm package
npm install @ephox/sugar
sugar is the base DOM library used in many projects. It has an API which is broken up into seven main packages. Do not use any modules directly that are not in an
dom: mostly handles inserting, appending, and manipulating individual DOM nodes.
events: handles DOM events and listeners
node: handles different types of nodes such as comments, elements, and text nodes
properties: handles reading, writing, and removing style properties, attributes, and values
search: handles searching for DOM nodes based on selectors, predicates, and DOM position
selection: handles browser ranges and selection
tag: handles specialised HTML tags like
view: handles scrolling, visibility, and measurements
bedrock to run tests. This is packaged as a dev dependency of
sugar. To run the tests, use:
$ yarn test