How to use the void-elements.hasOwnProperty 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 blakeembrey / metalsmith-snippet / metalsmith-snippet.js View on Github external
// Set "isInTag" to `true`.
      isInTag = true

      while (offset++ < contents.length) {
        // Stop parsing tag name on first white space or closing tag.
        if (/\s|>/.test(contents[offset])) {
          isInTag = contents[offset] !== '>'

          if (tagname) {
            if (isClosingTag) {
              if (tags[tags.length - 1] === tagname) {
                tags.pop()
              }
            } else {
              if (!voidElements.hasOwnProperty(tagname)) {
                tags.push(tagname)
              }
            }
          }

          break
        }

        tagname += contents[offset]
      }
    } else if (char === '>') {
      isInTag = false
    } else if (char === '&') {
      for (var j = offset; j < contents.length; j++) {
        if (WHITESPACE_REGEXP.test(contents[j])) {
          break

void-elements

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

MIT
Latest version published 7 years ago

Package Health Score

68 / 100
Full package analysis