Skip to content

Comments

Call super first in custom element constructor#31308

Merged
hamishwillee merged 1 commit intomdn:mainfrom
jbilee:patch-2
Dec 26, 2023
Merged

Call super first in custom element constructor#31308
hamishwillee merged 1 commit intomdn:mainfrom
jbilee:patch-2

Conversation

@jbilee
Copy link
Contributor

@jbilee jbilee commented Dec 26, 2023

Description

super() was not called first in the constructor of a custom element, so I fixed it.

Motivation

The current code snippet results in a reference error. I'd like to contribute to the readers' learning experience by proposing a change to the code snippet.

Additional details

Related issues and pull requests

@jbilee jbilee requested a review from a team as a code owner December 26, 2023 15:10
@jbilee jbilee requested review from sideshowbarker and removed request for a team December 26, 2023 15:10
@github-actions github-actions bot added the Content:WebAPI Web API docs label Dec 26, 2023
@github-actions
Copy link
Contributor

Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much @jbilee - our own guidance says "Always call super first in constructor" though I didn't know that this would result in a reference error.

... and welcome to MDN.

@hamishwillee hamishwillee merged commit 4e4df2e into mdn:main Dec 26, 2023
dipikabh pushed a commit to dipikabh/content that referenced this pull request Jan 17, 2024
Switch line order in custom element constructor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants