observablehq / stdlib

The Observable standard library.
https://observablehq.com/@observablehq/standard-library
ISC License
967 stars 83 forks source link

Add DOM.uid. #23

Closed mbostock closed 6 years ago

mbostock commented 6 years ago

For example:

image

Fixes two pain points:

  1. It’s tedious to generate unique identifiers currently. See the source of D3 Treemap for example, which uses Math.random.

  2. The introduction of a base URL to fix anchor links (forum post) broke local IRIs in Safari. (Firefox and Chrome seem to treat local IRIs as local-to-the-SVG regardless of a base URL.) By using absolute IRIs, we avoid this problem.