setName (name, hrService) {
    const previousName = this.name_
    name = toXml(name)
    // now change the underlying title element contents
    const title = this.getTitleElement()
    if (title) {
      while (title.firstChild) { title.removeChild(title.firstChild) }
      title.textContent = name
      this.name_ = name
      if (hrService) {
        hrService.changeElement(title, { '#text': previousName })
      }
      return this.name_
    }
    return null
  }
Set the name of this layer.
@param {string} name - The new name.
@param {module:history.HistoryRecordingService} hrService - History recording service
@returns {string|null} The new name if changed; otherwise, null.