Created
February 27, 2012 04:21
-
-
Save desandro/1921370 to your computer and use it in GitHub Desktop.
Safari 5 3D overflow bug
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> | |
<head> | |
<meta charset="utf-8"> | |
<title>backface visibility bug</title> | |
<style> | |
body { | |
font-family: sans-serif; | |
} | |
#card { | |
width: 200px; | |
height: 200px; | |
-webkit-transform: perspective(500px) rotateY(135deg); | |
-webkit-transform-style: preserve-3d; | |
position: relative; | |
float: left; | |
margin: 20px; | |
} | |
#card.is-overflow-hidden { | |
overflow: hidden; | |
} | |
.face { | |
width: 100%; | |
height: 100%; | |
position: absolute; | |
left: 0; | |
top: 0; | |
text-align: center; | |
line-height: 100px; | |
color: white; | |
font-size: 30px; | |
font-weight: bold; | |
-webkit-backface-visibility: hidden; | |
} | |
.front { background: red; } | |
.back { background: blue; -webkit-transform: rotateY(180deg); } | |
#copy { | |
width: 400px; | |
margin: 20px; | |
float: left; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="card"> | |
<div class="face front">Front</div> | |
<div class="face back">Back</div> | |
</div> | |
<div id="copy"> | |
<h1>backface visibility bug</h1> | |
<p><a href="https://bugs.webkit.org/show_bug.cgi?id=79661">WebKit bug #79661</a></p> | |
<h2>Test instructions</h2> | |
<ol> | |
<li><button id="overflow-toggler">Toggle overflow: hidden</button></li> | |
</ol> | |
<h2>Expected result</h2> | |
<ul> | |
<li>Blue "Back" face should still be visible</li> | |
</ul> | |
<h2>Observed result</h2> | |
<ul> | |
<li>Reversed red "Front" face is revealed.</li> | |
</ul> | |
</div> | |
<script> | |
window.onload = function() { | |
var overflowToggler = document.getElementById('overflow-toggler'); | |
var card = document.getElementById('card'); | |
var isOverflowHidden = false; | |
function onOverflowTogglerClick() { | |
isOverflowHidden = !isOverflowHidden; | |
card.className = isOverflowHidden ? 'is-overflow-hidden' : ''; | |
} | |
overflowToggler.addEventListener( 'click', onOverflowTogglerClick, false ); | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment