tinymce.full.js
function moveStart(rng) {
        var container = rng.startContainer,
          offset = rng.startOffset, isAtEndOfText,
          walker, node, nodes, tmpNode;

        if (rng.startContainer == rng.endContainer) {
          if (isInlineBlock(rng.startContainer.childNodes[rng.startOffset])) {
            return;
          }
        }

        // Convert text node into index if possible
        if (container.nodeType == 3 && offset >= container.nodeValue.length) {
          // Get the parent container location and walk from there
          offset = nodeIndex(container);
          container = container.parentNode;
          isAtEndOfText = true;
        }

        // Move startContainer/startOffset in to a suitable node
        if (container.nodeType == 1) {
          nodes = container.childNodes;
          container = nodes[Math.min(offset, nodes.length - 1)];
          walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));

          // If offset is at end of the parent node walk to the next one
          if (offset > nodes.length - 1 || isAtEndOfText) {
            walker.next();
          }

          for (node = walker.current(); node; node = walker.next()) {
            if (node.nodeType == 3 && !isWhiteSpaceNode(node)) {
              // IE has a "neat" feature where it moves the start node into the closest element
              // we can avoid this by inserting an element before it and then remove it after we set the selection
              tmpNode = dom.create('a', { 'data-mce-bogus': 'all' }, INVISIBLE_CHAR);
              node.parentNode.insertBefore(tmpNode, node);

              // Set selection and remove tmpNode
              rng.setStart(node, 0);
              selection.setRng(rng);
              dom.remove(tmpNode);

              return;
            }
          }
        }
      }
function moveStart(rng) {
        var container = rng.startContainer,
          offset = rng.startOffset, isAtEndOfText,
          walker, node, nodes, tmpNode;

        if (rng.startContainer == rng.endContainer) {
          if (isInlineBlock(rng.startContainer.childNodes[rng.startOffset])) {
            return;
          }
        }

        // Convert text node into index if possible
        if (container.nodeType == 3 && offset >= container.nodeValue.length) {
          // Get the parent container location and walk from there
          offset = nodeIndex(container);
          container = container.parentNode;
          isAtEndOfText = true;
        }

        // Move startContainer/startOffset in to a suitable node
        if (container.nodeType == 1) {
          nodes = container.childNodes;
          container = nodes[Math.min(offset, nodes.length - 1)];
          walker = new TreeWalker(container, dom.getParent(container, dom.isBlock));

          // If offset is at end of the parent node walk to the next one
          if (offset > nodes.length - 1 || isAtEndOfText) {
            walker.next();
          }

          for (node = walker.current(); node; node = walker.next()) {
            if (node.nodeType == 3 && !isWhiteSpaceNode(node)) {
              // IE has a "neat" feature where it moves the start node into the closest element
              // we can avoid this by inserting an element before it and then remove it after we set the selection
              tmpNode = dom.create('a', { 'data-mce-bogus': 'all' }, INVISIBLE_CHAR);
              node.parentNode.insertBefore(tmpNode, node);

              // Set selection and remove tmpNode
              rng.setStart(node, 0);
              selection.setRng(rng);
              dom.remove(tmpNode);

              return;
            }
          }
        }
      }
function moveStart ( rng ) { var container = rng . startContainer , offset = rng . startOffset , isAtEndOfText , walker , node , nodes , tmpNode ; if ( rng . startContainer == rng . endContainer ) { if ( isInlineBlock ( rng . startContainer . childNodes [ rng . startOffset ] ) ) { return ; } } // Convert text node into index if possible if ( container . nodeType == 3 && offset >= container . nodeValue . length ) { // Get the parent container location and walk from there offset = nodeIndex ( container ) ; container = container . parentNode ; isAtEndOfText = true ; } // Move startContainer/startOffset in to a suitable node if ( container . nodeType == 1 ) { nodes = container . childNodes ; container = nodes [ Math . min ( offset , nodes . length - 1 ) ] ; walker = new TreeWalker ( container , dom . getParent ( container , dom . isBlock ) ) ; // If offset is at end of the parent node walk to the next one if ( offset > nodes . length - 1 || isAtEndOfText ) { walker . next ( ) ; } for ( node = walker . current ( ) ; node ; node = walker . next ( ) ) { if ( node . nodeType == 3 && ! isWhiteSpaceNode ( node ) ) { // IE has a "neat" feature where it moves the start node into the closest element // we can avoid this by inserting an element before it and then remove it after we set the selection tmpNode = dom . create ( 'a' , { 'data-mce-bogus' : 'all' } , INVISIBLE_CHAR ) ; node . parentNode . insertBefore ( tmpNode , node ) ; // Set selection and remove tmpNode rng . setStart ( node , 0 ) ; selection . setRng ( rng ) ; dom . remove ( tmpNode ) ; return ; } } } }
Moves the start to the first suitable text node.
Moves the start to the first suitable text node .