How to use the void-elements.reduce function in void-elements

To help you get started, we’ve selected a few void-elements examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webmodules / range-normalize / index.js View on Github external
 * Module dependencies.

var indexOf = require('index-of');
var debug = require('debug')('range-normalize');

// map to an Object for faster lookup times
var voidElements = require('void-elements').reduce(function (obj, name) {
  obj[name.toUpperCase()] = true;
  return obj;
}, {});

 * Module exports.

module.exports = normalize;

 * "Normalizes" the DOM Range instance, such that slight variations in the start
 * and end containers end up being normalized to the same "base" representation.
 * The aim is to always have `startContainer` and `endContainer` pointing to
 * TextNode instances.


Array of "void elements" defined by the HTML specification.

Latest version published 7 years ago

Package Health Score

68 / 100
Full package analysis