forked from dorey/JavaScript-Equality-Table
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunified.html
More file actions
62 lines (55 loc) · 1.97 KB
/
unified.html
File metadata and controls
62 lines (55 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>JS Comparison Table</title>
<link rel="stylesheet" href="simple.css" type="text/css" media="all" title="simple" charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="js/comparison_table.js"></script>
<!-- Inspired by this post:
http://blog.codekills.net/archives/89-Equality-in-JavaScript.html
2013-Nov-11. Correcting issue where "[]===[]" was incorrectly marked as true.
-->
<style>
.highlight div{
border: 2px solid red !important;
}
</style>
</head>
<body>
<div id="content">
<h3>Equality in JavaScript</h3>
<div id="table"></div>
<div id="key"></div>
<br style="clear:both">
</div>
<script type="text/javascript" charset="utf-8">
/*
Strings in backticks (`) are evaluated.
*/
var values = [true, false, 1, 0, -1, "`'true'`", "`'false'`", "`'1'`", "`'0'`", "`'-1'`",
"", "`null`", "`undefined`", "`[]`", "`{}`", [[]], [0], [1], "`parseFloat('nan')`"];
buildUnifiedComparisonTable(values).appendTo("#table")
buildKeyTable().appendTo("#key")
$('td.cell').hover(function(e){
if (e.type == "mouseenter") {
var $item = $(e.target);
if ($item[0].nodeName == 'DIV') {
$item = $item.parent('td.cell');
}
var x = $item.attr('x');
var y = $item.attr('y');
console.log(x, y, e.type);
console.log($('td[x='+x+']'));
$('td[x='+x+']').addClass('highlight');
$('td[y='+y+']').addClass('highlight');
} else if (e.type == "mouseleave") {
//remove highlight class
$('.highlight').removeClass('highlight');
}
});
</script>
</body>
</html>