Sha256: 945555faee1065a516fd2c330617f07fbb4f2a062e8ea3b7e0b104ad75790e53

Contents?: true

Size: 1.29 KB

Versions: 46

Compression:

Stored size: 1.29 KB

Contents

"use strict";
const { SVG_NS } = require("../namespaces");

// https://svgwg.org/svg2-draft/render.html#TermNeverRenderedElement
const neverRenderedElements = new Set([
  "clipPath",
  "defs",
  "desc",
  "linearGradient",
  "marker",
  "mask",
  "metadata",
  "pattern",
  "radialGradient",
  "script",
  "style",
  "title",
  "symbol"
]);

// https://svgwg.org/svg2-draft/render.html#Rendered-vs-NonRendered
exports.isRenderedElement = elImpl => {
  if (neverRenderedElements.has(elImpl._localName)) {
    return false;
  }

  // This does not check for elements excluded because of conditional processing attributes or ‘switch’ structures,
  // because conditional processing is not implemented.
  // https://svgwg.org/svg2-draft/struct.html#ConditionalProcessing

  // This does not check for computed style of display being none, since that is not yet implemented for HTML
  // focusability either (and there are no tests yet).

  if (!elImpl.isConnected) {
    return false;
  }

  // The spec is unclear about how to deal with non-SVG parents, so we only perform this check for SVG-namespace
  // parents.
  if (elImpl.parentElement && elImpl.parentElement._namespaceURI === SVG_NS &&
                              !exports.isRenderedElement(elImpl.parentNode)) {
    return false;
  }

  return true;
};

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
appmap-0.66.1 ./node_modules/jsdom/lib/jsdom/living/helpers/svg/render.js
appmap-0.66.0 ./node_modules/jsdom/lib/jsdom/living/helpers/svg/render.js
appmap-0.65.1 ./node_modules/jsdom/lib/jsdom/living/helpers/svg/render.js
appmap-0.65.0 ./node_modules/jsdom/lib/jsdom/living/helpers/svg/render.js
appmap-0.64.0 ./node_modules/jsdom/lib/jsdom/living/helpers/svg/render.js
appmap-0.63.0 ./node_modules/jsdom/lib/jsdom/living/helpers/svg/render.js