Re: [whatwg/webidl] Enumeration order of interface members (#432)

Nice, thanks for the links/context!

> That demo no longer seems to work in every browser.

Yep, sadly I got `TypeError: fl is not a function` in both Edge and FF nightly, but it did at least reach the code with the ordering-sensitivity, which is this: `for($ in a)a[$[0]+($[6]||$[2])]=a[$];`. We can ungolf this to...

```js
for (let originalPropertyKey in renderingContext) {
  let charA = originalPropertyKey[0];
  let charB = originalPropertyKey[6] || originalPropertyKey[2];
  let newImprovedPropertyKey = charA + charB;

  renderingContext[newImprovedPropertyKey] = renderingContext[originalPropertyKey];
}
```

This doesn’t seem to be dependent on order, per se ... it depended on no new member ever being added to CanvasRenderingContext2D whose name’s first and seventh-or-third characters were the same as those of select members which existed at the time it was written.

I’m kinda surprised that “if a property name’s first character is "a" and its third character character is "r", any new such properties will enumerate before that proper” was deemed an implicit guarantee of the web platform 😅!

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/issues/432#issuecomment-1284551725

You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/issues/432/1284551725@github.com>

Received on Wednesday, 19 October 2022 20:44:34 UTC