Created
January 2, 2022 00:57
-
-
Save MiggieNRG/c7c85eeea0aa462da245ee1b1c2f83d2 to your computer and use it in GitHub Desktop.
Repro property set before custom element upgrade
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
customElements.define('hello-world', class extends HTMLElement { | |
constructor() { | |
super() | |
this.innerHTML = '<div>Hello world!</div>' | |
} | |
set mode (mode) { | |
this.querySelector('div') | |
.setAttribute('style', mode === 'light' | |
? 'background: white; color: black;' | |
: 'background: black; color: white;' | |
) | |
} | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Repro property set before custom element upgrade</title> | |
</head> | |
<body> | |
<h1>Repro property set before custom element upgrade</h1> | |
<hello-world></hello-world> | |
<script src="./hello.js" type="module"></script> | |
<script> | |
document.querySelector('hello-world').mode = 'dark' | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment