For my web page I just added a static property for the first time. It works just fine on Google Chrome and its variants. However, when I try it on iOS/iPadOS 14.3 Safari, I can't get it to work.
I've checked on MDN, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static, and it states that Safari supports the static keyword. Any idea what the problem is?
Here is a simple HTML document that I used to test this...
<html lang="en">
<head>
<meta charset="UTF-8">
<title>iOS Static Bug</title>
</head>
<body>
<h1>iOS Static Bug</h1>
<script>
document.writeln("Before class");
class McClass
{
constructor()
{
this._mcVar = 0;
}
static mcStatic = 123;
}
document.writeln("<p>mcStatic = " + McClass.mcStatic++ + "</p>"); // displays 123
document.writeln("<p>mcStatic = " + McClass.mcStatic++ + "</p>"); // displays 124
</script>
</body>
</html>
Mike
I've checked on MDN, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static, and it states that Safari supports the static keyword. Any idea what the problem is?
Here is a simple HTML document that I used to test this...
-- begin HTML document
<html lang="en">
<head>
<meta charset="UTF-8">
<title>iOS Static Bug</title>
</head>
<body>
<h1>iOS Static Bug</h1>
<script>
document.writeln("Before class");
class McClass
{
constructor()
{
this._mcVar = 0;
}
static mcStatic = 123;
}
document.writeln("<p>mcStatic = " + McClass.mcStatic++ + "</p>"); // displays 123
document.writeln("<p>mcStatic = " + McClass.mcStatic++ + "</p>"); // displays 124
</script>
</body>
</html>
-- end HTML document
Mike