<commit_before>// Copyright 2013-2016, University of Colorado Boulder
/* eslint-disable bad-sim-text */

/**
 * Utility functions for scenery that are specifically useful for Accessibility.
 * These generally pertain to DOM traversal and manipulation.
 *
 * For the most part this file's methods are public in a scenery-internal context. Some exceptions apply. Please
 * consult @jessegreenberg and/or @zepumph before using this outside of scenery.
 *
 * @author <NAME>
 */

define( function( require ) {
  'use strict';

  // modules
  var Random = require( 'DOT/Random' );
  var scenery = require( 'SCENERY/scenery' );

  // constants
  var NEXT = 'NEXT';
  var PREVIOUS = 'PREVIOUS';

  // HTML tag names
  var INPUT_TAG = 'INPUT';
  var LABEL_TAG = 'LABEL';
  var BUTTON_TAG = 'BUTTON';
  var TEXTAREA_TAG = 'TEXTAREA';
  var SELECT_TAG = 'SELECT';
  var OPTGROUP_TAG = 'OPTGROUP';
  var DATALIST_TAG = 'DATALIST';
  var OUTPUT_TAG = 'OUTPUT';
  var DIV_TAG = 'DIV';
  var A_TAG = 'A';
  var AREA_TAG = 'AREA';
  var P_TAG = 'P';
  var IFRAME_TAG = 'IFRAME';

  // tag names with special behavior
  var BOLD_TAG = 'B';
  var STRONG_TAG = 'STRONG';
  var I_TAG = 'I';
  var EM_TAG = 'EM';
  var MARK_TAG = 'MARK';
  var SMALL_TAG = 'SMALL';
  var DEL_TAG = 'DEL';
  var INS_TAG = 'INS';
  var SUB_TAG = 'SUB';
  var SUP_TAG = 'SUP';

  // These browser tags are a definition of default focusable elements, converted from Javascript types,
  // see https://stackoverflow.com/questions/1599660/which-html-elements-can-receive-focus
  var DEFAULT_FOCUSABLE_TAGS = [ A_TAG, AREA_TAG, INPUT_TAG, SELECT_TAG, TEXTAREA_TAG, BUTTON_TAG, IFRAME_TAG ];

  // collection of tags that are used for formatting text
  var FORMATTING_TAGS = [ BOLD_TAG, STRONG_TAG, I_TAG, EM_TAG, MARK_TAG, SMALL_TAG, DEL_TAG, INS_TAG, SUB_TAG, SUP_TAG ];

  // these elements do not have a closing tag, so they won't support features like innerHTML. This is how PhET treats
  // these elements, not necessary what is legal html.
  var ELEMENTS_WITHOUT_CLOSING_TAG = [ INPUT_TAG ];

  // valid DOM events that the display adds listeners to. For a list of scenery events that support a11y features
  // see Input.A11Y_EVENT_TYPES
  var DOM_EVENTS = [ 'focusin', 'focusout', 'input', 'change', 'click', 'keydown', 'keyup' ];

  // these elements require a minimum width to be visible in Safari, see https://github.com/phetsims/john-travoltage/issues/204
  var ELEMENTS_REQUIRE_WIDTH = [ INPUT_TAG, A_TAG ];

  var ARIA_LABELLEDBY = 'aria-labelledby';
  var ARIA_DESCRIBEDBY = 'aria-describedby';
  var ARIA_ACTIVE_DESCENDANT = 'aria-activedescendant';

  // data attribute to flag whether an element is focusable - cannot check tabindex because IE11 and Edge assign
  // tabIndex=0 internally for all HTML elements, including those that should not receive focus
  var DATA_FOCUSABLE = 'data-focusable';

  // {Array.<String>} attributes that put an ID of another attribute as the value, see https://github.com/phetsims/scenery/issues/819
  var ASSOCIATION_ATTRIBUTES = [ ARIA_LABELLEDBY, ARIA_DESCRIBEDBY, ARIA_ACTIVE_DESCENDANT ];

  /**
   * Get all 'element' nodes off the parent element, placing them in an array for easy traversal.  Note that this<commit_msg>support setting <br> in the PDOM as innerHTML, https://github.com/phetsims/friction/issues/158<commit_after>// Copyright 2013-2016, University of Colorado Boulder
/* eslint-disable bad-sim-text */

/**
 * Utility functions for scenery that are specifically useful for Accessibility.
 * These generally pertain to DOM traversal and manipulation.
 *
 * For the most part this file's methods are public in a scenery-internal context. Some exceptions apply. Please
 * consult @jessegreenberg and/or @zepumph before using this outside of scenery.
 *
 * @author <NAME>
 */

define( function( require ) {
  'use strict';

  // modules
  var Random = require( 'DOT/Random' );
  var scenery = require( 'SCENERY/scenery' );

  // constants
  var NEXT = 'NEXT';
  var PREVIOUS = 'PREVIOUS';

  // HTML tag names
  var INPUT_TAG = 'INPUT';
  var LABEL_TAG = 'LABEL';
  var BUTTON_TAG = 'BUTTON';
  var TEXTAREA_TAG = 'TEXTAREA';
  var SELECT_TAG = 'SELECT';
  var OPTGROUP_TAG = 'OPTGROUP';
  var DATALIST_TAG = 'DATALIST';
  var OUTPUT_TAG = 'OUTPUT';
  var DIV_TAG = 'DIV';
  var A_TAG = 'A';
  var AREA_TAG = 'AREA';
  var P_TAG = 'P';
  var IFRAME_TAG = 'IFRAME';

  // tag names with special behavior
  var BOLD_TAG = 'B';
  var STRONG_TAG = 'STRONG';
  var I_TAG = 'I';
  var EM_TAG = 'EM';
  var MARK_TAG = 'MARK';
  var SMALL_TAG = 'SMALL';
  var DEL_TAG = 'DEL';
  var INS_TAG = 'INS';
  var SUB_TAG = 'SUB';
  var SUP_TAG = 'SUP';
  var BR_TAG = 'BR';

  // These browser tags are a definition of default focusable elements, converted from Javascript types,
  // see https://stackoverflow.com/questions/1599660/which-html-elements-can-receive-focus
  var DEFAULT_FOCUSABLE_TAGS = [ A_TAG, AREA_TAG, INPUT_TAG, SELECT_TAG, TEXTAREA_TAG, BUTTON_TAG, IFRAME_TAG ];

  // collection of tags that are used for formatting text
  var FORMATTING_TAGS = [ BOLD_TAG, STRONG_TAG, I_TAG, EM_TAG, MARK_TAG, SMALL_TAG, DEL_TAG, INS_TAG, SUB_TAG,
    SUP_TAG, BR_TAG ];

  // these elements do not have a closing tag, so they won't support features like innerHTML. This is how PhET treats
  // these elements, not necessary what is legal html.
  var ELEMENTS_WITHOUT_CLOSING_TAG = [ INPUT_TAG ];

  // valid DOM events that the display adds listeners to. For a list of scenery events that support a11y features
  // see Input.A11Y_EVENT_TYPES
  var DOM_EVENTS = [ 'focusin', 'focusout', 'input', 'change', 'click', 'keydown', 'keyup' ];

  // these elements require a minimum width to be visible in Safari, see https://github.com/phetsims/john-travoltage/issues/204
  var ELEMENTS_REQUIRE_WIDTH = [ INPUT_TAG, A_TAG ];

  var ARIA_LABELLEDBY = 'aria-labelledby';
  var ARIA_DESCRIBEDBY = 'aria-describedby';
  var ARIA_ACTIVE_DESCENDANT = 'aria-activedescendant';

  // data attribute to flag whether an element is focusable - cannot check tabindex because IE11 and Edge assign
  // tabIndex=0 internally for all HTML elements, including those that should not receive focus
  var DATA_FOCUSABLE = 'data-focusable';

  // {Array.<String>} attributes that put an ID of another attribute as the value, see https://github.com/phetsims/scenery/issues/819
  var ASSOCIATION_ATTRIBUTES = [ ARIA_LABELLEDBY, ARIA_DESCRIBEDBY, ARIA_ACTIVE_DESCENDANT ];

  /**
   * Get all 'element' nodes off the parent element, placing them in an array for easy traversal.  Note that this
{'fraction_non_alphanumeric': 0.10212765957446808, 'fraction_numerical': 0.008966565349544073, 'mean_word_length': 3.878428465530022, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 7, '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': '233467', 'n_tokens_mistral': 2290, 'n_tokens_neox': 2154, 'n_words': 729}