gecko/toolkit/components/microformats/tests/test_framerecursion.html

64 lines
2.0 KiB
HTML
Raw Normal View History

<!-- Demonstrates that we are always counting MF's in a <frame> tag, and NEVER
counting MF's in an <iframe> regardless of what the "frame recursion" bit
is set to. -->
<html>
<head>
<title>Testing Mixed Up Microformat APIs</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"></link>
</head>
<body id="contentbody">
<pre id="test">
<script class="testbody" type="text/javascript">
// Start the test once the iFrame loads
function onLoad() {
test_MicroformatsAPI();
}
function test_MicroformatsAPI() {
var Microformats = SpecialPowers.Cu.import("resource://gre/modules/Microformats.js").Microformats;
count = Microformats.count("geo",
document.getElementById("contentbody"),
{recurseExternalFrames: false},
0);
is(count, 1, "Only one geo - we don't count external frames");
count = Microformats.count("geo",
document.getElementById("contentbody"),
{recurseExternalFrames: true});
is(count, 2, "Two Geo's - one in frame and one in iframe");
}
</script>
</pre>
<frameset>
<frame id="frame1">
<div>
<span class="notAMicroformat" id="notme">
<abbr class="foo">I am not a microformat</abbr>
<abbr class="title">Foolish title, not a format</abbr>
</span>
</div>
</frame>
<frame id="frame3">
<span class="geo" id="02-geo-abbr-latlong" >
<abbr class="latitude" title="75.77">Far Northern</abbr>
<abbr class="longitude" title="-122.41">Canada</abbr>
</span>
</frame>
<frame id="frame2">
<div class="stuff">
<span>Testing is Fun!</span>
</div>
</frame>
</frameset>
<!-- Geo -->
<iframe id="iframe" src="geo.html" onload="onLoad();">
</iframe>
</body>
</html>