INNER CODE UNIT · TypeScript

leadingWhitespace

vinta/pangu.js · src/browser/index.ts:31

  private static readonly leadingWhitespace = /^\s/;

  // Pre-paint re-space stays bounded: subtrees with more text nodes than this fall back to the queue
  private static readonly maxSyncTextNodes = 256;

  private autoSpacePageObserver: MutationObserver | null = null;

  // Last data we wrote per text node: distinguishes pangu's own mutation records
  // (data still equals the entry, drop them) from page re-renders of spaced content
  // (data differs, re-space before the next paint)
  private lastWrittenData = new WeakMap<Text, string>();

  // Text nodes a late fix wrote. While such a node still holds what pangu last wrote, the rules leave its text alone and only pair its boundaries
  private lateFixedTextNodes = new WeakSet<Text>();

  public readonly taskScheduler = new TaskScheduler();
  public readonly visibilityDetector = new VisibilityDetector();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…