B2G/gaia/apps/sms/js/compose.js
// anytime content changes - takes a parameter to check for image resizing
anytime content changes - takes a parameter to check for image resizing
anytime content changes - takes a parameter to check for image resizing
function onContentChanged(duck) {
    if (duck instanceof Attachment && duck.type === 'img') {
      return imageAttachmentsHandling();
    }
    var textLength = dom.message.textContent.length;
    var empty = !textLength;
    var hasFrames = !!dom.message.querySelector('iframe');
    if (empty) {
      var brs = dom.message.getElementsByTagName('br');
      if (brs.length > 1 || hasFrames) {
        empty = false;
      }
    }
    var placeholding = dom.message.classList.contains(placeholderClass);
    if (placeholding && !empty) {
      dom.message.classList.remove(placeholderClass);
      compose.disable(false);
      state.empty = false;
    }
    if (!placeholding && empty) {
      dom.message.classList.add(placeholderClass);
      compose.disable(true);
      state.empty = true;
    }
    trigger('input', new CustomEvent('input'));
    if (hasFrames && state.type === 'sms') {
      compose.type = 'mms';
    }
    if (!hasFrames && state.type === 'mms') {
      compose.type = 'sms';
    }
  }
function onContentChanged ( duck ) { if ( duck instanceof Attachment && duck . type === 'img' ) { return imageAttachmentsHandling ( ) ; } var textLength = dom . message . textContent . length ; var empty = ! textLength ; var hasFrames = ! ! dom . message . querySelector ( 'iframe' ) ; if ( empty ) { var brs = dom . message . getElementsByTagName ( 'br' ) ; if ( brs . length > 1 || hasFrames ) { empty = false ; } } var placeholding = dom . message . classList . contains ( placeholderClass ) ; if ( placeholding && ! empty ) { dom . message . classList . remove ( placeholderClass ) ; compose . disable ( false ) ; state . empty = false ; } if ( ! placeholding && empty ) { dom . message . classList . add ( placeholderClass ) ; compose . disable ( true ) ; state . empty = true ; } trigger ( 'input' , new CustomEvent ( 'input' ) ) ; if ( hasFrames && state . type === 'sms' ) { compose . type = 'mms' ; } if ( ! hasFrames && state . type === 'mms' ) { compose . type = 'sms' ; } }
anytime content changes - takes a parameter to check for image resizing
anytime content changes - takes a parameter to check for image resizing
// if the duck is an image attachment, handle resizes // firefox will keep an extra <br> in there // this operation is cancelable