Created
August 2, 2021 16:11
-
-
Save nolanlawson/ae9ff8d7b9a2aa70b85c0f955e6c90b3 to your computer and use it in GitHub Desktop.
Repro property set before custom elemet upgrade
This file contains 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 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