Re: [csswg-drafts] [css-values] random() function (#2826)

> How exactly does per-element work? Is it tied to something that has the same lifetime as a JS reference to a Node, or is it more about the location of the element in the DOM? I.e if script removes a node, then creates a new one in the same location in the tree, with all the same properties, does the new element get the same random values?

I intended it to be a JS lifetime reference, essentially. It's definitely not about DOM location; that's a whole different can of worms on its own, and wouldn't satisfy a use-case I think is reasonable, which is a stable random value across, say, a sorted list.

> If the JS reference like identify is used, then we would have to keep each identifier that ever matched each element in every document the element has ever been because an element could move back to any one of those documents in the future until documents themselves are dead.

Not necessarily. First, moving between documents is already a rare operation that I don't think we need to particularly worry about, so I'm fine if we want to explicitly call that out as "forgetting" the element's value so it gets a new value when re-inserted into the original document.

That said, generating a unique (or likely-unique random) value as the element's "personal identifier" and attaching it to the underlying Node object in a way that carries between documents should also work.

-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2826#issuecomment-1233261437 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 31 August 2022 18:13:50 UTC