tinymce.full.js
function innerText(html) {
      var schema = new Schema(), domParser = new DomParser({}, schema), text = '';
      var shortEndedElements = schema.getShortEndedElements();
      var ignoreElements = Tools.makeMap('script noscript style textarea video audio iframe object', ' ');
      var blockElements = schema.getBlockElements();

      function walk(node) {
        var name = node.name, currentNode = node;

        if (name === 'br') {
          text += '\n';
          return;
        }

        // img/input/hr
        if (shortEndedElements[name]) {
          text += ' ';
        }

        // Ingore script, video contents
        if (ignoreElements[name]) {
          text += ' ';
          return;
        }

        if (node.type == 3) {
          text += node.value;
        }

        // Walk all children
        if (!node.shortEnded) {
          if ((node = node.firstChild)) {
            do {
              walk(node);
            } while ((node = node.next));
          }
        }

        // Add \n or \n\n for blocks or P
        if (blockElements[name] && currentNode.next) {
          text += '\n';

          if (name == 'p') {
            text += '\n';
          }
        }
      }

      html = filter(html, [
        /<!\[[^\]]+\]>/g // Conditional comments
      ]);

      walk(domParser.parse(html));

      return text;
    }
function innerText(html) {
      var schema = new Schema(), domParser = new DomParser({}, schema), text = '';
      var shortEndedElements = schema.getShortEndedElements();
      var ignoreElements = Tools.makeMap('script noscript style textarea video audio iframe object', ' ');
      var blockElements = schema.getBlockElements();

      function walk(node) {
        var name = node.name, currentNode = node;

        if (name === 'br') {
          text += '\n';
          return;
        }

        // img/input/hr
        if (shortEndedElements[name]) {
          text += ' ';
        }

        // Ingore script, video contents
        if (ignoreElements[name]) {
          text += ' ';
          return;
        }

        if (node.type == 3) {
          text += node.value;
        }

        // Walk all children
        if (!node.shortEnded) {
          if ((node = node.firstChild)) {
            do {
              walk(node);
            } while ((node = node.next));
          }
        }

        // Add \n or \n\n for blocks or P
        if (blockElements[name] && currentNode.next) {
          text += '\n';

          if (name == 'p') {
            text += '\n';
          }
        }
      }

      html = filter(html, [
        /<!\[[^\]]+\]>/g // Conditional comments
      ]);

      walk(domParser.parse(html));

      return text;
    }
function innerText ( html ) { var schema = new Schema ( ) , domParser = new DomParser ( { } , schema ) , text = '' ; var shortEndedElements = schema . getShortEndedElements ( ) ; var ignoreElements = Tools . makeMap ( 'script noscript style textarea video audio iframe object' , ' ' ) ; var blockElements = schema . getBlockElements ( ) ; function walk ( node ) { var name = node . name , currentNode = node ; if ( name === 'br' ) { text += '\n' ; return ; } // img/input/hr if ( shortEndedElements [ name ] ) { text += ' ' ; } // Ingore script, video contents if ( ignoreElements [ name ] ) { text += ' ' ; return ; } if ( node . type == 3 ) { text += node . value ; } // Walk all children if ( ! node . shortEnded ) { if ( ( node = node . firstChild ) ) { do { walk ( node ) ; } while ( ( node = node . next ) ) ; } } // Add \n or \n\n for blocks or P if ( blockElements [ name ] && currentNode . next ) { text += '\n' ; if ( name == 'p' ) { text += '\n' ; } } } html = filter ( html , [ / <!\[[^\]]+\]> / g // Conditional comments ] ) ; walk ( domParser . parse ( html ) ) ; return text ; }
Gets the innerText of the specified element. It will handle edge cases
and works better than textContent on Gecko.

@param {String} html HTML string to get text from.
@return {String} String of text with line feeds.
Gets the innerText of the specified element . It will handle edge cases and works better than textContent on Gecko .