 
   applySpecialHeading = (area, org, childIdx, text) ->
     sh = getTextMatchElement(area, '.section-heading', org)
+    return unless sh
     sh.childNodes[childIdx].textContent = null
     span = document.createElement('span')
     span.textContent = org

  applySectionHeadings = (area) ->
    for sh in window.JapaneseMenu.defS.Settings.sectionHeadings
      el = getTextMatchElement(area, '.section-heading', sh.label)
      applyTextWithOrg(el, sh.value)
    for sh in window.JapaneseMenu.defS.Settings.subSectionHeadings
      el = getTextMatchElement(area, '.sub-section-heading', sh.label)
      applyTextWithOrg(el, sh.value)

  getTextMatchElement = (area, query, text) ->
    elems = area.querySelectorAll(query)
    for el in elems
      return el if el.textContent.includes(text)
    null

  applyTextContentBySettingsId = (data) ->
    el = document.querySelector("[id='#{data.id}']")

    return if before == text
    elem.textContent = text
    elem.setAttribute('title', before)
    elem.setAttribute('data-localized', 'true')

module.exports = window.JapaneseMenu = new JapaneseMenu()
