<commit_before>/**
 * @license
 * Copyright 2015 The Incremental DOM Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

var alignWithDOM = require('./alignment').alignWithDOM;
var updateAttribute = require('./attributes').updateAttribute;
var getShouldUpdateHook = require('./hooks').getShouldUpdateHook;
var getData = require('./node_data').getData;
var getWalker = require('./walker').getWalker;
var traversal = require('./traversal'),
    firstChild = traversal.firstChild,
    nextSibling = traversal.nextSibling,
    parentNode = traversal.parentNode;


/**
 * The offset in the virtual element declaration where the attributes are
 * specified.
 */
var ATTRIBUTES_OFFSET = 3;


var currentAttributesArray = [];


var hasChangedAttrs = function() {
  var data = getData(this);
  var attrsArr = data.attrsArr;
  var attrsChanged = false;  

  for (var i=ATTRIBUTES_OFFSET; i<arguments.length; i+=2) {
    if (attrsArr[(i - ATTRIBUTES_OFFSET) >> 1] !== arguments[i+1]) {
      attrsChanged = true;
      break;
    }
  }

  if (attrsChanged) {
    for (var i=ATTRIBUTES_OFFSET; i<arguments.length; i+=2) {
      attrsArr[(i - ATTRIBUTES_OFFSET) >> 1] = arguments[i+1];
    }
  }

  return attrsChanged;
};


var updateAttributes = function() {
  var node = this;
  var data = getData(node);
  var newAttrs = data.newAttrs;

  for (var attr in newAttrs) {
    newAttrs[attr] = undefined;
  }

  for (var i=ATTRIBUTES_OFFSET; i<arguments.length; i+=2) {
    newAttrs[arguments[i]] = arguments[i+1];
  }

  for (var attr in newAttrs) {
    updateAttribute(node, attr, newAttrs[attr]);
  }
};


/**<commit_msg>Fixed lint error due to redefined var<commit_after>/**
 * @license
 * Copyright 2015 The Incremental DOM Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS-IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

var alignWithDOM = require('./alignment').alignWithDOM;
var updateAttribute = require('./attributes').updateAttribute;
var getShouldUpdateHook = require('./hooks').getShouldUpdateHook;
var getData = require('./node_data').getData;
var getWalker = require('./walker').getWalker;
var traversal = require('./traversal'),
    firstChild = traversal.firstChild,
    nextSibling = traversal.nextSibling,
    parentNode = traversal.parentNode;


/**
 * The offset in the virtual element declaration where the attributes are
 * specified.
 */
var ATTRIBUTES_OFFSET = 3;


var currentAttributesArray = [];


var hasChangedAttrs = function() {
  var data = getData(this);
  var attrsArr = data.attrsArr;
  var attrsChanged = false;  
  var i;

  for (i=ATTRIBUTES_OFFSET; i<arguments.length; i+=2) {
    if (attrsArr[(i - ATTRIBUTES_OFFSET) >> 1] !== arguments[i+1]) {
      attrsChanged = true;
      break;
    }
  }

  if (attrsChanged) {
    for (i=ATTRIBUTES_OFFSET; i<arguments.length; i+=2) {
      attrsArr[(i - ATTRIBUTES_OFFSET) >> 1] = arguments[i+1];
    }
  }

  return attrsChanged;
};


var updateAttributes = function() {
  var node = this;
  var data = getData(node);
  var newAttrs = data.newAttrs;
  var attr;
 
  for (attr in newAttrs) {
    newAttrs[attr] = undefined;
  }

  for (var i=ATTRIBUTES_OFFSET; i<arguments.length; i+=2) {
    newAttrs[arguments[i]] = arguments[i+1];
  }

  for (attr in newAttrs) {
    updateAttribute(node, attr, newAttrs[attr]);
  }
};


/**
{'fraction_non_alphanumeric': 0.11905860636825104, 'fraction_numerical': 0.007844946931241348, 'mean_word_length': 3.7637362637362637, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, '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': '3676091', 'n_tokens_mistral': 1340, 'n_tokens_neox': 1304, 'n_words': 408}