<commit_before>/*
  Basis javascript library 
  http://code.google.com/p/basis-js/
 
  @copyright
  Copyright (c) 2006-2012 <NAME>.
 
  @license
  GNU General Public License v2.0 <http://www.gnu.org/licenses/gpl-2.0.html>
 
  @author
  <NAME> <<EMAIL>>
  <NAME> <<EMAIL>>
  <NAME> <<EMAIL>>
*/

  basis.require('basis.dom');
  basis.require('basis.cssom');
  basis.require('basis.dragdrop');
  basis.require('basis.ui');

  var styleRequired = Function.runOnce(function(){
    resource('templates/resizer/style.css')().startUse();
  });


 /**
  * @see ./demo/defile/resizer.html
  * @namespace basis.ui.resizer
  */

  var namespace = this.path;


  //
  // import names
  //

  var DOM = basis.dom;
  var cssom = basis.cssom;
  var classList = basis.cssom.classList;
  var DragDropElement = basis.dragdrop.DragDropElement;


  //
  // main part
  //

  var patchedComputedStyle;

  function getPixelValue(element, value) {
    if (IS_PIXEL.test(value))
      return parseInt(value) + 'px';

    // The awesome hack by Dean Edwards
    // @see http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291

    var style = element.style.left;
    var runtimeStyle = element.runtimeStyle.left;

    // set new values
    element.runtimeStyle.left = element.currentStyle.left;
    element.style.left = value || 0;

    // fetch new value
    value = element.style.pixelLeft;

    // restore values
    element.style.left = style;
    element.runtimeStyle.left = runtimeStyle;

    // return value in pixels
    return value + 'px';
  };

  if ('getComputedStyle' in global)
  {
    // Gecko's getComputedStyle returns computed values for top/bottom/left/right/height/width, but 
    // according to W3C spec getComputedStyle should returns used values.
    //
    // https://developer.mozilla.org/en/DOM/window.getComputedStyle:
    //   The returned object actually represents the CSS 2.1 used values, not the computed values.
    //   Originally, CSS 2.0 defined the computed values to be the "ready to be used" values of properties
    //   after cascading and inheritance, but CSS 2.1 redefined computed values as pre-layout, and used
    //   values as post-layout. The getComputedStyle function returns the old meaning of computed values,
    //   now called used values. There is no DOM API to get CSS 2.1 computed values.
    // 
    // This workaround helps fetch used values instead of computed. It doesn't work with some pseudo-classes
    // like :empty, :only-child, :nth-child and so on, but in general cases it should works fine.
    // The main idea that getComputedStyle returns used values for elements which not in document, because layout
    // properties can't calculated outside of document. But it still returns style according rule set that will be
    // applied to element when it in document. Based on this, we clone element's ancestor vector and get computed
    // style on cloned element. Ancestor cloning is necessary, because it influence on rule set that apply to element.
    var GETCOMPUTEDSTYLE_BUGGY = {};
    basis.ready(function(){
      var element = DOM.insert(document.body, DOM.createElement('[style="position:absolute;top:auto"]'));

      if (patchedComputedStyle(element, 'top') != 'auto')
        GETCOMPUTEDSTYLE_BUGGY = {
          top: true,
          bottom: true,
          left: true,
          right: true,
          height: true,
          width: true
        };

      DOM.remove(element);
    });

    // getComputedStyle function using W3C spec
    patchedComputedStyle = function(element, styleProp){
      if (GETCOMPUTEDSTYLE_BUGGY[styleProp])
      {
        // clone ancestor vector
        var axis = [];
        while (element && element.nodeType == 1)
        {
          axis.push(element.cloneNode(false));
          element = element.parentNode;
        }

        element = axis.pop();
        while (axis.length)
          element = element.appendChild(axis.pop());
      }

      var style = global.getComputedStyle(element, null);
      if (style)
        return style.getPropertyValue(styleProp);
    }
  }
  else
  {
    var VALUE_UNIT = /^-?(\d*\.)?\d+([a-z]+|%)?$/i;<commit_msg>bug fix for lazy loading<commit_after>/*
  Basis javascript library 
  http://code.google.com/p/basis-js/
 
  @copyright
  Copyright (c) 2006-2012 <NAME>.
 
  @license
  GNU General Public License v2.0 <http://www.gnu.org/licenses/gpl-2.0.html>
 
  @author
  <NAME> <<EMAIL>>
  <NAME> <<EMAIL>>
  <NAME> <<EMAIL>>
*/

  basis.require('basis.dom');
  basis.require('basis.cssom');
  basis.require('basis.dragdrop');
  basis.require('basis.ui');

  var styleRequired = Function.runOnce(function(){
    resource('templates/resizer/style.css')().startUse();
  });


 /**
  * @see ./demo/defile/resizer.html
  * @namespace basis.ui.resizer
  */

  var namespace = this.path;


  //
  // import names
  //

  var DOM = basis.dom;
  var cssom = basis.cssom;
  var classList = basis.cssom.classList;
  var DragDropElement = basis.dragdrop.DragDropElement;


  //
  // main part
  //

  var patchedComputedStyle;

  function getPixelValue(element, value) {
    if (IS_PIXEL.test(value))
      return parseInt(value) + 'px';

    // The awesome hack by <NAME>
    // @see http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291

    var style = element.style.left;
    var runtimeStyle = element.runtimeStyle.left;

    // set new values
    element.runtimeStyle.left = element.currentStyle.left;
    element.style.left = value || 0;

    // fetch new value
    value = element.style.pixelLeft;

    // restore values
    element.style.left = style;
    element.runtimeStyle.left = runtimeStyle;

    // return value in pixels
    return value + 'px';
  };

  if ('getComputedStyle' in global)
  {
    // Gecko's getComputedStyle returns computed values for top/bottom/left/right/height/width, but 
    // according to W3C spec getComputedStyle should returns used values.
    //
    // https://developer.mozilla.org/en/DOM/window.getComputedStyle:
    //   The returned object actually represents the CSS 2.1 used values, not the computed values.
    //   Originally, CSS 2.0 defined the computed values to be the "ready to be used" values of properties
    //   after cascading and inheritance, but CSS 2.1 redefined computed values as pre-layout, and used
    //   values as post-layout. The getComputedStyle function returns the old meaning of computed values,
    //   now called used values. There is no DOM API to get CSS 2.1 computed values.
    // 
    // This workaround helps fetch used values instead of computed. It doesn't work with some pseudo-classes
    // like :empty, :only-child, :nth-child and so on, but in general cases it should works fine.
    // The main idea that getComputedStyle returns used values for elements which not in document, because layout
    // properties can't calculated outside of document. But it still returns style according rule set that will be
    // applied to element when it in document. Based on this, we clone element's ancestor vector and get computed
    // style on cloned element. Ancestor cloning is necessary, because it influence on rule set that apply to element.
    var GETCOMPUTEDSTYLE_BUGGY = {};

    // getComputedStyle function using W3C spec
    patchedComputedStyle = function(element, styleProp){
      if (GETCOMPUTEDSTYLE_BUGGY[styleProp])
      {
        // clone ancestor vector
        var axis = [];
        while (element && element.nodeType == 1)
        {
          axis.push(element.cloneNode(false));
          element = element.parentNode;
        }

        element = axis.pop();
        while (axis.length)
          element = element.appendChild(axis.pop());
      }

      var style = global.getComputedStyle(element, null);
      if (style)
        return style.getPropertyValue(styleProp);
    }

    // test for computed style bug
    basis.ready(function(){
      var element = DOM.insert(document.body, DOM.createElement('[style="position:absolute;top:auto"]'));

      if (patchedComputedStyle(element, 'top') != 'auto')
        GETCOMPUTEDSTYLE_BUGGY = {
          top: true,
          bottom: true,
          left: true,
          right: true,
          height: true,
          width: true
        };

      DOM.remove(element);
    });
  }
  else
  {
    var VALUE_UNIT = /^-?(\d*\.)?\d+([a-z]+|%)?$/i;
{'fraction_non_alphanumeric': 0.11607036017709704, 'fraction_numerical': 0.010530094531530454, 'mean_word_length': 2.6386591205920764, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '6577442', 'n_tokens_mistral': 2595, 'n_tokens_neox': 2436, 'n_words': 735}