tinymce.full.js
function () {
        var self = this, rng = self.getRng(), elm;
        var startContainer, endContainer, startOffset, endOffset, root = self.dom.getRoot();

        function skipEmptyTextNodes(node, forwards) {
          var orig = node;

          while (node && node.nodeType === 3 && node.length === 0) {
            node = forwards ? node.nextSibling : node.previousSibling;
          }

          return node || orig;
        }

        // Range maybe lost after the editor is made visible again
        if (!rng) {
          return root;
        }

        startContainer = rng.startContainer;
        endContainer = rng.endContainer;
        startOffset = rng.startOffset;
        endOffset = rng.endOffset;

        if (rng.setStart) {
          elm = rng.commonAncestorContainer;

          // Handle selection a image or other control like element such as anchors
          if (!rng.collapsed) {
            if (startContainer == endContainer) {
              if (endOffset - startOffset < 2) {
                if (startContainer.hasChildNodes()) {
                  elm = startContainer.childNodes[startOffset];
                }
              }
            }

            // If the anchor node is a element instead of a text node then return this element
            //if (tinymce.isWebKit && sel.anchorNode && sel.anchorNode.nodeType == 1)
            // return sel.anchorNode.childNodes[sel.anchorOffset];

            // Handle cases where the selection is immediately wrapped around a node and return that node instead of it's parent.
            // This happens when you double click an underlined word in FireFox.
            if (startContainer.nodeType === 3 && endContainer.nodeType === 3) {
              if (startContainer.length === startOffset) {
                startContainer = skipEmptyTextNodes(startContainer.nextSibling, true);
              } else {
                startContainer = startContainer.parentNode;
              }

              if (endOffset === 0) {
                endContainer = skipEmptyTextNodes(endContainer.previousSibling, false);
              } else {
                endContainer = endContainer.parentNode;
              }

              if (startContainer && startContainer === endContainer) {
                return startContainer;
              }
            }
          }

          if (elm && elm.nodeType == 3) {
            return elm.parentNode;
          }

          return elm;
        }

        elm = rng.item ? rng.item(0) : rng.parentElement();

        // IE 7 might return elements outside the iframe
        if (elm.ownerDocument !== self.win.document) {
          elm = root;
        }

        return elm;
      }
function () {
        var self = this, rng = self.getRng(), elm;
        var startContainer, endContainer, startOffset, endOffset, root = self.dom.getRoot();

        function skipEmptyTextNodes(node, forwards) {
          var orig = node;

          while (node && node.nodeType === 3 && node.length === 0) {
            node = forwards ? node.nextSibling : node.previousSibling;
          }

          return node || orig;
        }

        // Range maybe lost after the editor is made visible again
        if (!rng) {
          return root;
        }

        startContainer = rng.startContainer;
        endContainer = rng.endContainer;
        startOffset = rng.startOffset;
        endOffset = rng.endOffset;

        if (rng.setStart) {
          elm = rng.commonAncestorContainer;

          // Handle selection a image or other control like element such as anchors
          if (!rng.collapsed) {
            if (startContainer == endContainer) {
              if (endOffset - startOffset < 2) {
                if (startContainer.hasChildNodes()) {
                  elm = startContainer.childNodes[startOffset];
                }
              }
            }

            // If the anchor node is a element instead of a text node then return this element
            //if (tinymce.isWebKit && sel.anchorNode && sel.anchorNode.nodeType == 1)
            // return sel.anchorNode.childNodes[sel.anchorOffset];

            // Handle cases where the selection is immediately wrapped around a node and return that node instead of it's parent.
            // This happens when you double click an underlined word in FireFox.
            if (startContainer.nodeType === 3 && endContainer.nodeType === 3) {
              if (startContainer.length === startOffset) {
                startContainer = skipEmptyTextNodes(startContainer.nextSibling, true);
              } else {
                startContainer = startContainer.parentNode;
              }

              if (endOffset === 0) {
                endContainer = skipEmptyTextNodes(endContainer.previousSibling, false);
              } else {
                endContainer = endContainer.parentNode;
              }

              if (startContainer && startContainer === endContainer) {
                return startContainer;
              }
            }
          }

          if (elm && elm.nodeType == 3) {
            return elm.parentNode;
          }

          return elm;
        }

        elm = rng.item ? rng.item(0) : rng.parentElement();

        // IE 7 might return elements outside the iframe
        if (elm.ownerDocument !== self.win.document) {
          elm = root;
        }

        return elm;
      }
function ( ) { var self = this , rng = self . getRng ( ) , elm ; var startContainer , endContainer , startOffset , endOffset , root = self . dom . getRoot ( ) ; function skipEmptyTextNodes ( node , forwards ) { var orig = node ; while ( node && node . nodeType === 3 && node . length === 0 ) { node = forwards ? node . nextSibling : node . previousSibling ; } return node || orig ; } // Range maybe lost after the editor is made visible again if ( ! rng ) { return root ; } startContainer = rng . startContainer ; endContainer = rng . endContainer ; startOffset = rng . startOffset ; endOffset = rng . endOffset ; if ( rng . setStart ) { elm = rng . commonAncestorContainer ; // Handle selection a image or other control like element such as anchors if ( ! rng . collapsed ) { if ( startContainer == endContainer ) { if ( endOffset - startOffset < 2 ) { if ( startContainer . hasChildNodes ( ) ) { elm = startContainer . childNodes [ startOffset ] ; } } } // If the anchor node is a element instead of a text node then return this element //if (tinymce.isWebKit && sel.anchorNode && sel.anchorNode.nodeType == 1) // return sel.anchorNode.childNodes[sel.anchorOffset]; // Handle cases where the selection is immediately wrapped around a node and return that node instead of it's parent. // This happens when you double click an underlined word in FireFox. if ( startContainer . nodeType === 3 && endContainer . nodeType === 3 ) { if ( startContainer . length === startOffset ) { startContainer = skipEmptyTextNodes ( startContainer . nextSibling , true ) ; } else { startContainer = startContainer . parentNode ; } if ( endOffset === 0 ) { endContainer = skipEmptyTextNodes ( endContainer . previousSibling , false ) ; } else { endContainer = endContainer . parentNode ; } if ( startContainer && startContainer === endContainer ) { return startContainer ; } } } if ( elm && elm . nodeType == 3 ) { return elm . parentNode ; } return elm ; } elm = rng . item ? rng . item ( 0 ) : rng . parentElement ( ) ; // IE 7 might return elements outside the iframe if ( elm . ownerDocument !== self . win . document ) { elm = root ; } return elm ; }
Returns the currently selected element or the common ancestor element for both start and end of the selection.

@method getNode
@return {Element} Currently selected element or common ancestor element.
@example
// Alerts the currently selected elements node name
alert(tinymce.activeEditor.selection.getNode().nodeName);
Returns the currently selected element or the common ancestor element for both start and end of the selection .