<commit_before>var get = Ember.get, set = Ember.set;

// extract into positiongDelegate
var applyTransform = (function(){
  var element = document.createElement('div');

  if ('webkitTransform' in element.style){
    return function(element, position){
      var x = position.x,
          y = position.y;

      element.style.webkitTransform = 'translate3d(' + x + 'px, ' + y + 'px, 0)';
    };
  }else{
    return function(element, position){
      var x = position.x,
          y = position.y;

      element.style.top =  y + 'px';
      element.style.left = x + 'px';
    };
  }
})();

function samePosition(a, b) {
  return a && b && a.x === b.x && a.y === b.y;
}

Ember.ListItemView = Ember.View.extend({
  classNames: ['ember-list-item-view'],
  _position: null,

  _updateStyle: function() {
    var element, position;

    element = get(this, 'element');
    position = get(this, 'position');

    if (!element) { return; }

    applyTransform(element, position);

    this._position = position;
  },

  positionDidChange: Ember.observer(function(){
    var position, _position;

    position = get('position');
    _position = this._position;

    if (samePosition(position, _position)) { return; }

    this._updateStyle();
  }, 'position'),

  didInsertElement: function() {
    this._updateStyle();
  },

  _contextDidChange: Ember.observer(function() {
    var element, buffer;

    element = get(this, 'element');
    if (!element) { return; }

    buffer = Ember.RenderBuffer();
    buffer = this.renderToBuffer(buffer);

    element.innerHTML = buffer.innerString ? buffer.innerString() : buffer.childBuffers.join('');

    set(this, 'element', element);

    this._updateStyle();
  }, 'context'),

  prepareForReuse: function() {
    this._position = null;
  }
});
<commit_msg>prevent extra transforms on context changes<commit_after>var get = Ember.get, set = Ember.set;

// extract into positiongDelegate
var applyTransform = (function(){
  var element = document.createElement('div');

  if ('webkitTransform' in element.style){
    return function(element, position){
      var x = position.x,
          y = position.y;

      element.style.webkitTransform = 'translate3d(' + x + 'px, ' + y + 'px, 0)';
    };
  }else{
    return function(element, position){
      var x = position.x,
          y = position.y;

      element.style.top =  y + 'px';
      element.style.left = x + 'px';
    };
  }
})();

function samePosition(a, b) {
  return a && b && a.x === b.x && a.y === b.y;
}

Ember.ListItemView = Ember.View.extend({
  classNames: ['ember-list-item-view'],
  _position: null,

  _updateStyle: function() {
    var element, position, _position;

    element = get(this, 'element');
    position = get(this, 'position');
    _position = this._position;

    if (!element) { return; }
    if (samePosition(position, _position)) { return; }

    applyTransform(element, position);

    this._position = position;
  },

  positionDidChange: Ember.observer(function(){
    this._updateStyle();
  }, 'position'),

  didInsertElement: function() {
    this._updateStyle();
  },

  _contextDidChange: Ember.observer(function() {
    var element, buffer;

    element = get(this, 'element');
    if (!element) { return; }

    buffer = Ember.RenderBuffer();
    buffer = this.renderToBuffer(buffer);

    element.innerHTML = buffer.innerString ? buffer.innerString() : buffer.childBuffers.join('');

    this._position = null;
    set(this, 'element', element);

    this._updateStyle({ force: true });
  }, 'context'),

  prepareForReuse: function() {
    this._position = null;
  }
});

{'fraction_non_alphanumeric': 0.15830329914056002, 'fraction_numerical': 0.0011089548100914888, 'mean_word_length': 3.1328751431844215, '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': '4028938', 'n_tokens_mistral': 1161, 'n_tokens_neox': 1112, 'n_words': 261}