dom/tests/mochitest/ajax/jquery/test/data/offset/relative.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     2 	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     3 <html>
     4 	<head>
     5 		<meta http-equiv="Content-type" content="text/html; charset=utf-8">
     6 		<title>relative</title>
     7 		<style type="text/css" media="screen">
     8 			body { margin: 1px; padding: 5px; }
     9 			div.relative { position: relative; margin: 1px; border: 2px solid #000; padding: 5px; width: 100px; height: 100px; background: #fff; overflow: hidden; }
    10 			#relative-2 { top: 20px; left: 20px; }
    11 			#marker { position: absolute; border: 2px solid #000; width: 50px; height: 50px; background: #ccc; }
    12 		</style>
    13 		<script type="text/javascript" src="../../../dist/jquery.js"></script>
    14 		<script type="text/javascript" charset="utf-8">
    15 			$(function() {
    16 				$('.relative').click(function() {
    17 					$('#marker').css( $(this).offset() );
    18 					var pos = $(this).position();
    19 					$(this).css({ position: 'absolute', top: pos.top, left: pos.left });
    20 					return false;
    21 				});
    22 			});
    23 		</script>
    24 	</head>
    25 	<body>
    26 		<div id="relative-1" class="relative"><div id="relative-1-1" class="relative"><div id="relative-1-1-1" class="relative"></div></div></div>
    27 		<div id="relative-2" class="relative"></div>
    28 		<div id="marker"></div>
    29 		<p class="instructions">Click the white box to move the marker to it. Clicking the box also changes the position to absolute (if not already) and sets the position according to the position method.</p>
    30 	</body>
    31 </html>

mercurial