constructor (name, group, svgElem) {
    this.name_ = name
    this.group_ = svgElem ? null : group

    if (svgElem) {
      // Create a group element with title and add it to the DOM.
      const svgdoc = svgElem.ownerDocument
      this.group_ = svgdoc.createElementNS(NS.SVG, 'g')
      const layerTitle = svgdoc.createElementNS(NS.SVG, 'title')
      layerTitle.textContent = name
      this.group_.append(layerTitle)
      if (group) {
        group.insertAdjacentElement('afterend', this.group_)
      } else {
        svgElem.append(this.group_)
      }
    }

    addLayerClass(this.group_)
    walkTree(this.group_, function (e) {
      e.setAttribute('style', 'pointer-events:inherit')
    })

    this.group_.setAttribute('style', svgElem ? 'pointer-events:all' : 'pointer-events:none')
  }
@param {string} name - Layer name
@param {SVGGElement|null} group - An existing SVG group element or null.
    If group and no svgElem, use group for this layer.
    If group and svgElem, create a new group element and insert it in the DOM after group.
    If no group and svgElem, create a new group element and insert it in the DOM as the last layer.
@param {SVGGElement} [svgElem] - The SVG DOM element. If defined, use this to add
    a new layer to the document.