<commit_before>import { isAndroid, isIE9 } from '../util/env'

export default {
  bind (el, value) {
    if (!isAndroid) {
      el.addEventListener('compositionstart', onCompositionStart)
      el.addEventListener('compositionend', onCompositionEnd)
    }
    if (isIE9) {
      el.addEventListener('cut', trigger)
      el.addEventListener('keyup', triggerOnDelOrBackspace)
    }
  },
  unbind (el) {
    if (!isAndroid) {
      el.removeEventListener('compositionstart', onCompositionStart)
      el.removeEventListener('compositionend', onCompositionEnd)
    }
    if (isIE9) {
      el.removeEventListener('cut', trigger)
      el.removeEventListener('keyup', triggerOnDelOrBackspace)
    }
  }
}

function onCompositionStart (e) {
  e.target.composing = true
}

function onCompositionEnd (e) {
  e.target.composing = false
  trigger(e)
}

function trigger (e) {
  const ev = document.createEvent('HTMLEvents')
  ev.initEvent('input', true, true)
  e.target.dispatchEvent(ev)
}

function triggerOnDelOrBackspace (e) {
  if (e.keyCode === 46 || e.keyCode === 8) {
    trigger(e)
  }
}<commit_msg>better IE9 v-model support<commit_after>import { isAndroid, isIE9 } from '../util/env'

if (isIE9) {
  // http://www.matts411.com/post/internet-explorer-9-oninput/
  document.addEventListener('selectionchange', () => {
    const el = document.activeElement
    if (el && el.vmodel) {
      trigger(el)
    }
  })
}

export default {
  bind (el, value) {
    if (!isAndroid) {
      el.addEventListener('compositionstart', onCompositionStart)
      el.addEventListener('compositionend', onCompositionEnd)
    }
    if (isIE9) {
      el.vmodel = true
    }
  },
  unbind (el) {
    if (!isAndroid) {
      el.removeEventListener('compositionstart', onCompositionStart)
      el.removeEventListener('compositionend', onCompositionEnd)
    }
  }
}

function onCompositionStart (e) {
  e.target.composing = true
}

function onCompositionEnd (e) {
  e.target.composing = false
  trigger(e.target)
}

function trigger (el) {
  const e = document.createEvent('HTMLEvents')
  e.initEvent('input', true, true)
  el.dispatchEvent(e)
}
{'fraction_non_alphanumeric': 0.13606403013182675, 'fraction_numerical': 0.006591337099811676, 'mean_word_length': 3.560085836909871, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4309724', 'n_tokens_mistral': 712, 'n_tokens_neox': 696, 'n_words': 129}