<commit_before>define(
  'ephox.darwin.api.TableSelection',

  [
    'ephox.darwin.selection.CellSelection',
    'ephox.snooker.api.TablePositions'
  ],

  function (CellSelection, TablePositions) {
    // Explictly calling CellSelection.retrieve so that we can see the API signature.
    var retrieve = function (container) {
      return CellSelection.retrieve(container);
    };

    var retrieveBox = function (container) {
      return CellSelection.getEdges(container).bind(function (edges) {
        return TablePositions.getBox(edges.table(), edges.first(), edges.last());
      });
    };

    var clear = function (container) {
      CellSelection.clear(container);
    };

    return {
      retrieve: retrieve,
      retrieveBox: retrieveBox,
      clear: clear
    };
  }
);<commit_msg>TBIO-4980: ensure the last and first cell ancestors in a mergable cell selection check are the same section<commit_after>define(
  'ephox.darwin.api.TableSelection',

  [
    'ephox.darwin.selection.CellSelection',
    'ephox.snooker.api.TablePositions'
  ],

  function (CellSelection, TablePositions) {
    // Explictly calling CellSelection.retrieve so that we can see the API signature.
    var retrieve = function (container) {
      return CellSelection.retrieve(container);
    };

    var retrieveBox = function (container) {
      return CellSelection.getEdges(container).bind(function (edges) {
        var firstAncestor = SelectorFind.ancestor(edges.first(), 'thead,tfoot,tbody,table');
        var lastAncestor = SelectorFind.ancestor(edges.last(), 'thead,tfoot,tbody,table');
        return firstAncestor.bind(function (fA) {
          return lastAncestor.bind(function (lA) {
            return Compare.eq(fA, lA) ? TablePositions.getBox(edges.table(), edges.first(), edges.last()) : Option.none();
          });
        });
      });
    };

    var clear = function (container) {
      CellSelection.clear(container);
    };

    return {
      retrieve: retrieve,
      retrieveBox: retrieveBox,
      clear: clear
    };
  }
);
{'fraction_non_alphanumeric': 0.11986301369863013, 'fraction_numerical': 0.0019569471624266144, 'mean_word_length': 3.106425702811245, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7478995', 'n_tokens_mistral': 615, 'n_tokens_neox': 607, 'n_words': 128}