MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements
What specific section or headline is this issue about?
The "Customized built-in elements" section.
What information was incorrect, unhelpful, or incomplete?
This section still refers to an old version of the example that did uselessly define a constructor, and harmfully override the global self.
Note that even if it wasn't the globalThis.self and instead a variable defined near the class definition, it would still be wrong since this variable would only ever refer to the latest instance created, shadowing all the previous instances.
The example's source actually got updated in mdn/web-components-examples#81.
What did you expect to see?
An article explaining how the new (more correct) example works, with no use of a self trick since this is the proper way to handle that.
Do you have any supporting links, references, or citations?
mdn/web-components-examples#81
Do you have anything more you want to share?
No response
MDN metadata
Page report details
MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements
What specific section or headline is this issue about?
The "Customized built-in elements" section.
What information was incorrect, unhelpful, or incomplete?
This section still refers to an old version of the example that did uselessly define a
constructor, and harmfully override the globalself.Note that even if it wasn't the
globalThis.selfand instead a variable defined near the class definition, it would still be wrong since this variable would only ever refer to the latest instance created, shadowing all the previous instances.The example's source actually got updated in mdn/web-components-examples#81.
What did you expect to see?
An article explaining how the new (more correct) example works, with no use of a
selftrick sincethisis the proper way to handle that.Do you have any supporting links, references, or citations?
mdn/web-components-examples#81
Do you have anything more you want to share?
No response
MDN metadata
Page report details
en-us/web/api/web_components/using_custom_elements