mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
157 lines
6.5 KiB
HTML
157 lines
6.5 KiB
HTML
<html>
|
|
<head>
|
|
<title>Testing Mixed Up Microformat APIs</title>
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
|
<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">
|
|
<!-- hCard -->
|
|
<p class="vcard" id="23-abbr-title-everything">
|
|
<!-- perhaps the most annoying test ever -->
|
|
<abbr class="fn" title="John Doe">foo</abbr>
|
|
<span class="n">
|
|
<abbr class="honorific-prefix" title="Mister">Mr.</abbr>
|
|
<abbr class="given-name" title="Jonathan">John</abbr>
|
|
<abbr class="additional-name" title="John">J</abbr>
|
|
<abbr class="family-name" title="Doe-Smith">Doe</abbr>
|
|
<abbr class="honorific-suffix" title="Medical Doctor">M.D</abbr>
|
|
</span>
|
|
<abbr class="nickname" title="JJ">jj</abbr>
|
|
<abbr class="bday" title="2006-04-04">April 4, 2006</abbr>
|
|
<span class="adr">
|
|
<abbr class="post-office-box" title="Box 1234">B. 1234</abbr>
|
|
<abbr class="extended-address" title="Suite 100">Ste. 100</abbr>
|
|
<abbr class="street-address" title="123 Fake Street">123 Fake St.</abbr>
|
|
<abbr class="locality" title="San Francisco">San Fran</abbr>
|
|
<abbr class="region" title="California">CA</abbr>
|
|
<abbr class="postal-code" title="12345-6789">12345</abbr>
|
|
<abbr class="country-name" title="United States of America">USA</abbr>
|
|
<abbr class="type" title="work">workplace</abbr>
|
|
</span>
|
|
<abbr class="tel" title="415.555.1234">1234</abbr>
|
|
<abbr class="tel-type-value" title="work">workplace</abbr>
|
|
<!-- mailer -->
|
|
<abbr class="tz" title="-0700">Pacific Time</abbr>
|
|
<span class="geo">
|
|
<abbr class="latitude" title="37.77">Northern</abbr>
|
|
<abbr class="longitude" title="-122.41">California</abbr>
|
|
</span>
|
|
<abbr class="title" title="President">pres.</abbr> and
|
|
<abbr class="role" title="Chief">cat wrangler</abbr>
|
|
<!-- <span class="agent"></span> -->
|
|
<span class="org">
|
|
<abbr class="organization-name" title="Intellicorp">foo</abbr>
|
|
<abbr class="organization-unit" title="Intelligence">bar</abbr>
|
|
</span>
|
|
<!-- <abbr class="category" title=""></abbr> -->
|
|
<abbr class="note" title="this is a note">this is not a note</abbr>
|
|
<!-- <abbr class="rev" title=""></abbr> (revision datetime) -->
|
|
<!-- <abbr class="sort-string" title=""></abbr> -->
|
|
<abbr class="uid" title="abcdefghijklmnopqrstuvwxyz">alpha</abbr>
|
|
<abbr class="class" title="public">pub</abbr>
|
|
<!-- <abbr class="key" title=""></abbr> -->
|
|
</p>
|
|
|
|
<!-- hCalendar -->
|
|
<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 id="frame2">
|
|
<div class="vcalendar">
|
|
<span class="vevent" id="15-calendar-xml-lang">
|
|
<a class="url" href="http://www.web2con.com/">
|
|
<span class="summary">Web 2.0 Conference</span>:
|
|
<abbr class="dtstart" title="2005-10-05">October 5</abbr>-
|
|
<abbr class="dtend" title="2005-10-08">7</abbr>,
|
|
at the <span class="location">Argent Hotel, San Francisco, CA</span>
|
|
</a>
|
|
</span>
|
|
</div>
|
|
</frame>
|
|
</frameset>
|
|
|
|
<!-- Put the test code before the iframe just to be
|
|
extra-sure it's been evaluated before the iframe onload fires -->
|
|
<script class="testbody" type="text/javascript">
|
|
// Called from the onload of the iframe
|
|
function test_MicroformatsAPI() {
|
|
// I'm going to try to do this without getting XPConnect priv's, make sure
|
|
// we throw
|
|
try {
|
|
Components.utils.import("resource://gre/modules/Microformats.js");
|
|
ok(false, "Should not execute this code");
|
|
} catch(ex) {
|
|
ok(true, "Expected exception");
|
|
}
|
|
|
|
// Gonna do things the right way
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
Components.utils.import("resource://gre/modules/Microformats.js");
|
|
|
|
// Test Microformat frame recursion - start with counting
|
|
var count = Microformats.count("adr",
|
|
document.getElementById("contentbody"),
|
|
{recurseExternalFrames: false}, // do not recurse frames
|
|
0); // current count
|
|
is(count, 2, "No frame recursion, finds 2 adr's (none in frames)");
|
|
|
|
// Try it with frame recursion
|
|
count = Microformats.count("adr",
|
|
document.getElementById("contentbody"),
|
|
{recurseExternalFrames: true},
|
|
count);
|
|
// Should still find 2
|
|
is(count, 2, "Only 2 adr nodes, even when recursing frames");
|
|
|
|
// Since "recurseExternalFrames" only affects the external frames, the microformat
|
|
// in the <frameset> will always be counted.
|
|
count = Microformats.count("geo",
|
|
document.getElementById("contentbody"),
|
|
{recurseExternalFrames: false},
|
|
0);
|
|
is(count, 2, "Should find two geo if we don't recurse external frames");
|
|
|
|
count = Microformats.count("geo",
|
|
document.getElementById("contentbody"),
|
|
{recurseExternalFrames: true},
|
|
0);
|
|
is(count, 3, "Three geos,one outside, one in a frameset, and one in iframe");
|
|
|
|
count = Microformats.count("hCalendar",
|
|
document.getElementById("contentbody"),
|
|
{recurseExternalFrames: true},
|
|
0);
|
|
is(count, 1, "One hCalendar");
|
|
|
|
count = Microformats.count("hCard",
|
|
document.getElementById("contentbody"),
|
|
{recurseExternalFrames: true});
|
|
is(count, 1, "One hCard");
|
|
}
|
|
</script>
|
|
|
|
<!-- Geo Fire the test from here so we know this is loaded at the outset -->
|
|
<iframe src="geo.html" onload="test_MicroformatsAPI();">
|
|
</iframe>
|
|
|
|
<!-- adr -->
|
|
<div class="adr" id="01-extended-address">
|
|
<span class="extended-address">Park Bench</span>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|