safari js func define issue
seems safari defined functions even if they live in conditional blocks
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Safari JS engine test</title>
<script type="text/javascript">
if (false) {
function conditionalFunctionality() {
alert("Doing conditional functionality");
}
}
window.onload = function() {
if (typeof conditionalFunctionality === "function") {
alert("BAD. It's defined");
} else {
alert("GOOD. It's NOT defined");
}
}
</script>
</head>
<body>
<h1>Safari JS engine test</h1>
<p>
Safari 12 (iOS 12.0.1 and macOS 10.14) incorrectly/unconditionally define the conditional function.
</p>
<p>
All other browsers below pass i.e. the conditional function isn't defined.
</p>
<ul>
<li>
Chrome v70 on win64, macOS 10.14
</li>
<li>
Firefox v62 on win64, macOS 10.14, linux x64
</li>
<li>
Edge v42 Windows 10 x64
</li>
</ul>
</body>
</html>