All files / lib/core/renderer constants.js

100% Statements 100/100
100% Branches 5/5
100% Functions 1/1
100% Lines 100/100

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 2391x 2387x 2391x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x 778x  
/**
 * A set of known HTML boolean attributes.
 * @type {Set<string>}
 */
 
export const BOOLEAN_ATTRIBUTES = new Set([
  'checked',
  'disabled',
  'required',
  'readonly',
  'selected',
  'multiple',
  'autofocus',
  'novalidate',
  'formnovalidate',
  'hidden',
  'open',
  'reversed',
  'loop',
  'controls',
  'autoplay',
  'muted',
  'default',
  'ismap',
  'async',
  'defer',
]);
 
/**
 * Checks if a given attribute name is a standard HTML boolean attribute.
 * @param {string} name - The attribute name.
 * @returns {boolean} True if it is a boolean attribute.
 */
export function isBooleanAttribute(name) {
  if (!name || typeof name !== 'string') return false;
  return BOOLEAN_ATTRIBUTES.has(name.toLowerCase());
}
 
/**
 * The `data-ax-*` names the framework writes or reads itself, by the part
 * before any `.modifier`.
 *
 * A custom directive is any other `data-ax-*` name. Both render paths read this
 * set to tell the two apart, so a marker added elsewhere in the framework has
 * to be added here too or it will be mistaken for a directive.
 * `test/unit/reservedDirectiveNames.test.js` fails when a literal `data-ax-*`
 * name in `lib/` or `plugins/` is not listed.
 * @type {Set<string>}
 */
export const RESERVED_DIRECTIVE_NAMES = new Set([
  'as',
  'bind',
  'class',
  'comp',
  'contract',
  'deadlock',
  'deadlock-action',
  'deadlock-depth',
  'deadlock-fallback',
  'deadlock-isolated',
  'deadlock-loc',
  'deadlock-maxdepth',
  'deadlock-name',
  'defer',
  'defer-content',
  'defer-loading',
  'defer-placeholder',
  'defer-when',
  'deterministic',
  'dyn-attrs',
  'empty',
  'error-as',
  'error-boundary',
  'error-fallback',
  'event',
  'fallback',
  'for',
  'html',
  'if',
  'isolated',
  'key',
  'key-val',
  'link',
  'list-item',
  'loading',
  'memo',
  'page',
  'page-heading',
  'pure',
  'ref',
  'router-view',
  'show',
  'skip',
  'static',
  'style',
  'suspense',
  'transition',
  'validate',
  'validate-messages',
]);