<commit_before>// TODO - remove this!
var el = document.createElement('div'), style = el.style;
var set = Ember.set;

function testProp (prop) {
  var uppercaseProp = prop.charAt(0).toUpperCase() + prop.slice(1);

  var dic = {
    webkit: '-webkit-' + prop,
    moz: '-moz-' + prop,
    ms: 'ms' + uppercaseProp
  };

  var props = [
    prop,
    'webkit' + prop,
    'webkit' + uppercaseProp,
    'Moz' + uppercaseProp,
    'moz' + uppercaseProp,
    'ms' + uppercaseProp,
    'ms' + prop
  ];

  for (var i=0; i < props.length; i++) {
    var property = props[i];
    var prefix;

    if (property in style) {
      prefix = property.toLowerCase().replace(prop, '');
      if (prefix && dic[prefix]) {
        return dic[prefix];
      }
      return property;
    }
  }

  return null;
}

var transformProp = testProp('transform');
var perspectiveProp = testProp('perspective');
var supports2D = transformProp !== null;
var supports3D = perspectiveProp !== null;

export default {
  transformProp: transformProp,
  applyTransform: (function(){
    if (supports2D) {
      return function(childView, x, y){
        set(childView, 'style', transformProp + ': translate(' + x + 'px, ' + y + 'px);');
      };
    } else {
      return function(childView, x, y){
        set(childView, 'style', 'top: ' + y + 'px; left: ' + x + 'px;');
      };
    }
  })(),
  apply3DTransform: (function(){
    if (supports3D) {
      return function(childView, x, y){
        set(childView, 'style', transformProp + ': translate3d(' + x + 'px, ' + y + 'px, 0);');
      };
    } else if (supports2D) {
      return function(childView, x, y){
        set(childView, 'style', transformProp + ': translate(' + x + 'px, ' + y + 'px);');
      };
    } else {
      return function(childView, x, y){
        set(childView, 'style', 'top: ' + y + 'px; left: ' + x + 'px;');
      };
    }
  })()
};
<commit_msg>IE9 and adding browserTransform style attribute<commit_after>// TODO - remove this!
var el    = document.body || document.createElement('div');
var style = el.style;
var set   = Ember.set;

function testProp (prop) {
  var uppercaseProp = prop.charAt(0).toUpperCase() + prop.slice(1);

  var props = [
    prop,
    'webkit' + prop,
    'webkit' + uppercaseProp,
    'Moz'    + uppercaseProp,
    'moz'    + uppercaseProp,
    'ms'     + uppercaseProp,
    'ms'     + prop
  ];

  for (var i=0; i < props.length; i++) {
    var property = props[i];

    if (property in style) {
      return property;
    }
  }

  return null;
}

function browserTransform (attributeName) {
  var styleName = testProp(attributeName);
  var prefix = styleName.toLowerCase().replace(attributeName, '');

  var dic = {
    webkit: '-webkit-' + attributeName,
    moz: '-moz-' + attributeName,
    ms: '-ms-' + attributeName
  };

  if (prefix && dic[prefix]) {
    return dic[prefix];
  }

  return styleName;
}

var transformProp = browserTransform('transform');
var perspectiveProp = testProp('perspective');
var supports2D = transformProp !== null;
var supports3D = perspectiveProp !== null;

export default {
  transformProp: transformProp,
  applyTransform: (function(){
    if (supports2D) {
      return function(childView, x, y){
        set(childView, 'style', transformProp + ': translate(' + x + 'px, ' + y + 'px);');
      };
    } else {
      return function(childView, x, y){
        set(childView, 'style', 'top: ' + y + 'px; left: ' + x + 'px;');
      };
    }
  })(),
  apply3DTransform: (function(){
    if (supports3D) {
      return function(childView, x, y){
        set(childView, 'style', transformProp + ': translate3d(' + x + 'px, ' + y + 'px, 0);');
      };
    } else if (supports2D) {
      return function(childView, x, y){
        set(childView, 'style', transformProp + ': translate(' + x + 'px, ' + y + 'px);');
      };
    } else {
      return function(childView, x, y){
        set(childView, 'style', 'top: ' + y + 'px; left: ' + x + 'px;');
      };
    }
  })()
};

{'fraction_non_alphanumeric': 0.17361809045226131, 'fraction_numerical': 0.005778894472361809, 'mean_word_length': 2.7205607476635514, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6529239', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1330, 'n_words': 340}