<commit_before>/**
 * 过滤XSS攻击
 *
 * @author 老雷<<EMAIL>>
 */

/*
 * 默认HTML标签白名单
 * 标签名=>属性列表
 */
var defaultWhiteList = {
  h1:     ['style', 'class'],
  h2:     ['style', 'class'],
  h3:     ['style', 'class'],
  h4:     ['style', 'class'],
  h5:     ['style', 'class'],
  hr:     ['style', 'class'],
  span:   ['style', 'class'],
  strong: ['style', 'class'],
  b:      ['style', 'class'],
  i:      ['style', 'class'],
  br:     [],
  p:      ['style', 'class'],
  pre:    ['style', 'class'],
  code:   ['style', 'class'],
  a:      ['style', 'class', 'target', 'href', 'title'],
  img:    ['style', 'class', 'src', 'alt', 'title'],
  div:    ['style', 'class'],
  table:  ['style', 'class', 'width', 'border'],
  tr:     ['style', 'class'],
  td:     ['style', 'class', 'width', 'colspan'],
  th:     ['style', 'class', 'width', 'colspan'],
  tbody:  ['style', 'class'],
  ul:     ['style', 'class'],
  li:     ['style', 'class'],
  em:     ['style'],    //added by jim
  cite:   ['style']     //added by jim
};

/**
 * 过滤属性值
 */
var defaultOnTagAttr = function (tag, attr, value) {<commit_msg>更新onTagAttr说明<commit_after>/**
 * 过滤XSS攻击
 *
 * @author 老雷<<EMAIL>>
 */

/*
 * 默认HTML标签白名单
 * 标签名=>属性列表
 */
var defaultWhiteList = {
  h1:     ['style', 'class'],
  h2:     ['style', 'class'],
  h3:     ['style', 'class'],
  h4:     ['style', 'class'],
  h5:     ['style', 'class'],
  hr:     ['style', 'class'],
  span:   ['style', 'class'],
  strong: ['style', 'class'],
  b:      ['style', 'class'],
  i:      ['style', 'class'],
  br:     [],
  p:      ['style', 'class'],
  pre:    ['style', 'class'],
  code:   ['style', 'class'],
  a:      ['style', 'class', 'target', 'href', 'title'],
  img:    ['style', 'class', 'src', 'alt', 'title'],
  div:    ['style', 'class'],
  table:  ['style', 'class', 'width', 'border'],
  tr:     ['style', 'class'],
  td:     ['style', 'class', 'width', 'colspan'],
  th:     ['style', 'class', 'width', 'colspan'],
  tbody:  ['style', 'class'],
  ul:     ['style', 'class'],
  li:     ['style', 'class'],
  em:     ['style'],    //added by jim
  cite:   ['style']     //added by jim
};

/**
 * 过滤属性值
 *
 * @param {string} tag
 * @param {string} attr
 * @param {string} value
 * @return {string}
 */
var defaultOnTagAttr = function (tag, attr, value) {
{'fraction_non_alphanumeric': 0.2712975098296199, 'fraction_numerical': 0.00436871996505024, 'mean_word_length': 2.778877887788779, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '3149634', 'n_tokens_mistral': 898, 'n_tokens_neox': 925, 'n_words': 225}