<commit_before>/*
 * Copyright 2013 The Toolkitchen Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style
 * license that can be found in the LICENSE file.
 */

(function() {

function reflect(element, name) {
  return {
    obj: element,
    name: name,
    value: element[name],
    meta: element.meta && element.meta.properties[name]
  };
}

function reflectProperty(element, name) {
  var v = element[name];
  if (v !== null
      && v !== undefined
      && typeof v !== 'function'
      && typeof v !== 'object'
      //&& element.propertyIsEnumerable(k)
      && !reflectProperty.blacklist[name]) {
    var prop = reflect(element, name);
  }
  return prop;
}

reflectProperty.blacklist = {isToolkitElement: 1};

function reflectProperties(element) {
  var props = [];
  if (element) {
    var found = {};
    var p = element.__proto__;
    while (p && p !== HTMLElement.prototype/*&& p.isToolkitElement*/) {
      var k = Object.keys(p);
      k.forEach(function(k) {
        if (found[k]) {
          return;
        }
        var prop = reflectProperty(element, k);
        if (prop) {
          props.push(prop);
          found[k] = true;
        }
      });
      p = p.__proto__;
    }
    //
    var more = [];
    if (!element.firstElementChild) {
      more.push('textContent');
    }
    more.push('id');
    more.forEach(function(k) {
      var v = element[k];
      if (typeof v !== 'function' && typeof v !== 'object') {
        props.push(reflect(element, k));
      }
    });
  }
  return props;
}

window.Reflection = {
  properties: reflectProperties
};

})();
<commit_msg>make named null properties appear in inspector (fixes e.g. g-animation's published null valued properties)<commit_after>/*
 * Copyright 2013 The Toolkitchen Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style
 * license that can be found in the LICENSE file.
 */

(function() {

function reflect(element, name) {
  return {
    obj: element,
    name: name,
    value: element[name],
    meta: element.meta && element.meta.properties[name]
  };
}

function reflectProperty(element, name) {
  var v = element[name];
  if ((name && v === null)
      || (v !== undefined
      && typeof v !== 'function'
      && typeof v !== 'object'
      //&& element.propertyIsEnumerable(k)
      && !reflectProperty.blacklist[name])) {
    var prop = reflect(element, name);
  }
  return prop;
}

reflectProperty.blacklist = {isToolkitElement: 1};

function reflectProperties(element) {
  var props = [];
  if (element) {
    var found = {};
    var p = element.__proto__;
    while (p && p !== HTMLElement.prototype/*&& p.isToolkitElement*/) {
      var k = Object.keys(p);
      k.forEach(function(k) {
        if (found[k]) {
          return;
        }
        var prop = reflectProperty(element, k);
        if (prop) {
          props.push(prop);
          found[k] = true;
        }
      });
      p = p.__proto__;
    }
    //
    var more = [];
    if (!element.firstElementChild) {
      more.push('textContent');
    }
    more.push('id');
    more.forEach(function(k) {
      var v = element[k];
      if (typeof v !== 'function' && typeof v !== 'object') {
        props.push(reflect(element, k));
      }
    });
  }
  return props;
}

window.Reflection = {
  properties: reflectProperties
};

})();

{'fraction_non_alphanumeric': 0.1518309020541828, 'fraction_numerical': 0.002977076510866329, 'mean_word_length': 2.4461538461538463, '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': '1275647', 'n_tokens_mistral': 1049, 'n_tokens_neox': 1037, 'n_words': 270}