js/tinymce/tinymce.jquery.js
function (args) {
        var self = this, rng = self.getRng(), tmpElm = self.dom.create("body");
        var se = self.getSel(), whiteSpaceBefore, whiteSpaceAfter, fragment;

        args = args || {};
        whiteSpaceBefore = whiteSpaceAfter = '';
        args.get = true;
        args.format = args.format || 'html';
        args.selection = true;
        self.editor.fire('BeforeGetContent', args);

        if (args.format === 'text') {
          return self.isCollapsed() ? '' : Zwsp.trim(rng.text || (se.toString ? se.toString() : ''));
        }

        if (rng.cloneContents) {
          fragment = args.contextual ? FragmentReader.read(self.editor.getBody(), rng).dom() : rng.cloneContents();
          if (fragment) {
            tmpElm.appendChild(fragment);
          }
        } else if (rng.item !== undefined || rng.htmlText !== undefined) {
          // IE will produce invalid markup if elements are present that
          // it doesn't understand like custom elements or HTML5 elements.
          // Adding a BR in front of the contents and then remoiving it seems to fix it though.
          tmpElm.innerHTML = '<br>' + (rng.item ? rng.item(0).outerHTML : rng.htmlText);
          tmpElm.removeChild(tmpElm.firstChild);
        } else {
          tmpElm.innerHTML = rng.toString();
        }

        // Keep whitespace before and after
        if (/^\s/.test(tmpElm.innerHTML)) {
          whiteSpaceBefore = ' ';
        }

        if (/\s+$/.test(tmpElm.innerHTML)) {
          whiteSpaceAfter = ' ';
        }

        args.getInner = true;

        args.content = self.isCollapsed() ? '' : whiteSpaceBefore + self.serializer.serialize(tmpElm, args) + whiteSpaceAfter;
        self.editor.fire('GetContent', args);

        return args.content;
      }
function (args) {
        var self = this, rng = self.getRng(), tmpElm = self.dom.create("body");
        var se = self.getSel(), whiteSpaceBefore, whiteSpaceAfter, fragment;

        args = args || {};
        whiteSpaceBefore = whiteSpaceAfter = '';
        args.get = true;
        args.format = args.format || 'html';
        args.selection = true;
        self.editor.fire('BeforeGetContent', args);

        if (args.format === 'text') {
          return self.isCollapsed() ? '' : Zwsp.trim(rng.text || (se.toString ? se.toString() : ''));
        }

        if (rng.cloneContents) {
          fragment = args.contextual ? FragmentReader.read(self.editor.getBody(), rng).dom() : rng.cloneContents();
          if (fragment) {
            tmpElm.appendChild(fragment);
          }
        } else if (rng.item !== undefined || rng.htmlText !== undefined) {
          // IE will produce invalid markup if elements are present that
          // it doesn't understand like custom elements or HTML5 elements.
          // Adding a BR in front of the contents and then remoiving it seems to fix it though.
          tmpElm.innerHTML = '<br>' + (rng.item ? rng.item(0).outerHTML : rng.htmlText);
          tmpElm.removeChild(tmpElm.firstChild);
        } else {
          tmpElm.innerHTML = rng.toString();
        }

        // Keep whitespace before and after
        if (/^\s/.test(tmpElm.innerHTML)) {
          whiteSpaceBefore = ' ';
        }

        if (/\s+$/.test(tmpElm.innerHTML)) {
          whiteSpaceAfter = ' ';
        }

        args.getInner = true;

        args.content = self.isCollapsed() ? '' : whiteSpaceBefore + self.serializer.serialize(tmpElm, args) + whiteSpaceAfter;
        self.editor.fire('GetContent', args);

        return args.content;
      }
function ( args ) { var self = this , rng = self . getRng ( ) , tmpElm = self . dom . create ( "body" ) ; var se = self . getSel ( ) , whiteSpaceBefore , whiteSpaceAfter , fragment ; args = args || { } ; whiteSpaceBefore = whiteSpaceAfter = '' ; args . get = true ; args . format = args . format || 'html' ; args . selection = true ; self . editor . fire ( 'BeforeGetContent' , args ) ; if ( args . format === 'text' ) { return self . isCollapsed ( ) ? '' : Zwsp . trim ( rng . text || ( se . toString ? se . toString ( ) : '' ) ) ; } if ( rng . cloneContents ) { fragment = args . contextual ? FragmentReader . read ( self . editor . getBody ( ) , rng ) . dom ( ) : rng . cloneContents ( ) ; if ( fragment ) { tmpElm . appendChild ( fragment ) ; } } else if ( rng . item !== undefined || rng . htmlText !== undefined ) { // IE will produce invalid markup if elements are present that // it doesn't understand like custom elements or HTML5 elements. // Adding a BR in front of the contents and then remoiving it seems to fix it though. tmpElm . innerHTML = '<br>' + ( rng . item ? rng . item ( 0 ) . outerHTML : rng . htmlText ) ; tmpElm . removeChild ( tmpElm . firstChild ) ; } else { tmpElm . innerHTML = rng . toString ( ) ; } // Keep whitespace before and after if ( / ^\s / . test ( tmpElm . innerHTML ) ) { whiteSpaceBefore = ' ' ; } if ( / \s+$ / . test ( tmpElm . innerHTML ) ) { whiteSpaceAfter = ' ' ; } args . getInner = true ; args . content = self . isCollapsed ( ) ? '' : whiteSpaceBefore + self . serializer . serialize ( tmpElm , args ) + whiteSpaceAfter ; self . editor . fire ( 'GetContent' , args ) ; return args . content ; }
Returns the selected contents using the DOM serializer passed in to this class.

@method getContent
@param {Object} args Optional settings class with for example output format text or html.
@return {String} Selected contents in for example HTML format.
@example
// Alerts the currently selected contents
alert(tinymce.activeEditor.selection.getContent());

// Alerts the currently selected contents as plain text
alert(tinymce.activeEditor.selection.getContent({format: 'text'}));
Returns the selected contents using the DOM serializer passed in to this class .