toolkit/components/microformats/tests/test_Microformats_hCard.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <html>
michael@0 2 <head>
michael@0 3 <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
michael@0 4 <title>Testing Microformats.js (hCard)</title>
michael@0 5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
michael@0 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"></link>
michael@0 8 </head>
michael@0 9 <body>
michael@0 10 <div id="content" style="display: none">
michael@0 11
michael@0 12 From http://microformats.org/tests/hcard/
michael@0 13
michael@0 14 <div class="vcard" id="01-tantek-basic">
michael@0 15 <a class="url fn" href="http://tantek.com/">Tantek Çelik</a>
michael@0 16 <div class="org">Technorati</div>
michael@0 17 </div>
michael@0 18
michael@0 19 <div class="vcard" id="02-multiple-class-names-on-vcard.1"><span class="fn n"><span class="given-name">Ryan</span> <span class="family-name">King</span></span></div>
michael@0 20 <p><span class="attendee vcard" id="02-multiple-class-names-on-vcard.2"><span class="fn n"><span class="given-name">Ryan</span> <span class="family-name">King</span></span></span></p>
michael@0 21 <address class="vcard author" id="02-multiple-class-names-on-vcard.3"><span class="fn n"><span class="given-name">Ryan</span> <span class="family-name">King</span></span></address>
michael@0 22 <ul><li class="reviewer vcard first" id="02-multiple-class-names-on-vcard.4"><span class="fn n"><span class="given-name">Ryan</span> <span class="family-name">King</span></span></li></ul>
michael@0 23
michael@0 24 <p class="vcard" id="03-implied-n.1">
michael@0 25 <span class="fn">Ryan King</span>
michael@0 26 </p>
michael@0 27 <p class="vcard" id="03-implied-n.2">
michael@0 28 <abbr class="fn" title="Ryan King">me</abbr>
michael@0 29 </p>
michael@0 30 <p class="vcard" id="03-implied-n.3">
michael@0 31 <img src="/me.jpg" title="Brian Suda" alt="Ryan King" class="fn" />
michael@0 32 </p>
michael@0 33 <p class="vcard" id="03-implied-n.4">
michael@0 34 <a class="fn" href="http://suda.co.uk/">Brian Suda</a>
michael@0 35 </p>
michael@0 36 <p class="vcard" id="03-implied-n.5">
michael@0 37 <span class="fn">King, Ryan</span>
michael@0 38 </p>
michael@0 39 <p class="vcard" id="03-implied-n.6">
michael@0 40 <span class="fn">King, R</span>
michael@0 41 </p>
michael@0 42 <p class="vcard" id="03-implied-n.7">
michael@0 43 <span class="fn">King R</span>
michael@0 44 </p>
michael@0 45 <p class="vcard" id="03-implied-n.8">
michael@0 46 <span class="fn">King R.</span>
michael@0 47 </p>
michael@0 48 <p class="vcard" id="03-implied-n.9">
michael@0 49 <span class="fn">Jesse James Garrett</span>
michael@0 50 </p>
michael@0 51 <p class="vcard" id="03-implied-n.10">
michael@0 52 <span class="fn">Thomas Vander Wal</span>
michael@0 53 </p>
michael@0 54
michael@0 55 <p class="vcard" id="04-ignore-unknowns">
michael@0 56 <span class="ignore-me">Some text that shouldn't be in the vCard.</span>
michael@0 57 <span class="fn n">
michael@0 58 <span class="given-name">Ryan</span> <span class="family-name">King</span>
michael@0 59 </span>
michael@0 60 </p>
michael@0 61 <p class="ignore-me-too">Some more text that shouldn't be in the vCard.</p>
michael@0 62
michael@0 63 <p class="vcard" id="05-mailto-1">
michael@0 64 <!-- fn should be the text node (with implied-n-optimization) and 'email' should be the href, sans scheme -->
michael@0 65 <a class="fn email" href="mailto:ryan@technorati.com">Ryan King</a>
michael@0 66 </p>
michael@0 67
michael@0 68 <p class="vcard" id="06-mailto-2">
michael@0 69 <!-- ignore the parameters on the addr-spec -->
michael@0 70 <a class="fn email" href="mailto:brian@example.com?subject=foo">Brian Suda</a>
michael@0 71 </p>
michael@0 72
michael@0 73 <p class="vcard" id="07-relative-url">
michael@0 74 <span class="fn n"><span class="given-name">John</span> <span class="family-name">Doe</span></span>
michael@0 75 <a class="url" href="/home/blah">my website</a>
michael@0 76 </p>
michael@0 77
michael@0 78 Tests 8/9/10 involve base tags and must each be self contained
michael@0 79
michael@0 80 <p class="vcard" id="11-multiple-urls">
michael@0 81 <span class="fn n">
michael@0 82 <span class="given-name">John</span> <span class="family-name">Doe</span></span>
michael@0 83 <a class="url" href="http://example.com/foo">my website</a>
michael@0 84 <a class="url" href="http://example.com/bar">my other website</a>
michael@0 85 </p>
michael@0 86
michael@0 87 <p class="vcard" id="12-img-src-url">
michael@0 88 <span class="fn n"><span class="given-name">John</span> <span class="family-name">Doe</span></span>
michael@0 89 <!-- take the @src, ignore the @type -->
michael@0 90 <img class="url" src="http://mochi.test:8888/tests/browser/microformats/test/picture.png" type="image/png" />
michael@0 91 </p>
michael@0 92
michael@0 93 <p class="vcard" id="13-photo-logo">
michael@0 94 <span class="fn n"><span class="given-name">John</span> <span class="family-name">Doe</span></span>
michael@0 95 <!-- take the @src, ignore the @type -->
michael@0 96 <img class="photo logo" src="http://mochi.test:8888/tests/browser/microformats/test/picture.png" type="image/png" />
michael@0 97 </p>
michael@0 98
michael@0 99 <p class="vcard" id="14-img-src-data-url">
michael@0 100 <span class="fn n"><span class="given-name">John</span> <span class="family-name">Doe</span></span>
michael@0 101 <img class="photo logo" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAASUExURf///8zMzJmZmWZmZjMzMwAAAPOPemkAAAM1SURBVHjaYmBgYGBkYQUBFkYWFiCPCchixQAMCCZAACF0MAMVM4K4TFh0IGsBCCAkOxhYmBnAAKaHhZkZmxaAAGJgYIbpYGBihGgBWsTMzMwE4jIhaWGAYoAAYmCECDExYAcwGxkg5oNIgABigDqLARdgZmGB2wICrKwAAcSA3xKgIxlZ0PwCEEAMBCxhgHoWSQtAADFAAxgfYEJ1GEAAQbQw4tUCsocBYQVAADEgu4uRkREeUCwszEwwLhOKLQABhNDCBA4aSDgwwhIAJKqYUPwCEEAMUK/AUwnc9aywJMCI7DAgAAggBohZ8JTBhGIJzCoWZL8ABBCYidAB8RUjWppkYUG2BSCAGMDqEMZiswUtXgACiAHsFYixTMywGGLGpgUWYgABxAA2mQkWCMyMqFoYmdD8ACQAAogBHJHMrCxg1cyIiICmCkYWDFsAAgiihYmZCewFFpR0BfI3LLch+QUggBiQ0iQjEyMDmh54qCBlUIAAYsCRJsElADQvgWKTlRGeKwECiAF3XgGmMEYQYADZzcoA9z5AAMG9RQCAtEC9DxBADFiyFyMjVi0wABBAWLQwQdIiuhYGWJIACCBg+KKUJ9BoBRdS2LQALQMIIGDQIEmwAO1kYcVWHCDZAhBAqFqYmOAxj2YNtAwDAYAAYmDEiBYWzHKKkRERYiwAAYSphZEZwxZGZiZQVEJTJkAAMTCyokc7M5oORlC5wcoEjxeAAAJqQXU0UB6W5WFmABMtEzMi1wEEEFAbE0YyAUuzMMEsYQalMkQSBQggUDmNPU3C9IA4LCxI+QUggEBiKOU8yExgqccCL3chnkPKlQABhGo6ejHBDKmdUHMlQAAhhQvQaGZGkBIkjcAMywLmI+VKgABCSowsTJhZkhlWXiBpAQggYBqBZl9GVOdBcz0LZqEEEEAMqLULMBLg1THWog9IAwQQA0qiZcRW5aPbAhBADCg1El4tMAAQQAxoiZYZXnTh1AIQQAzo2QlYpDDjcBgrxGEAAcSAJTthswmiBUwDBBC2GpkZJTaRvQ+mAQKIAUuuxdZWQvILQABBmSxMjBj5EpcWgACCMoFOYYSpZyHQHgMIMACt2hmoVEikCQAAAABJRU5ErkJggg=="/>
michael@0 102 </p>
michael@0 103
michael@0 104 <p class="vcard" id="15-honorific-additional-single">
michael@0 105 <span class="fn n">
michael@0 106 <span class="honorific-prefix">Mr.</span>
michael@0 107 <span class="given-name">John</span>
michael@0 108 <span class="additional-name">Maurice</span>
michael@0 109 <span class="family-name">Doe</span>,
michael@0 110 <span class="honorific-suffix">Ph.D.</span>
michael@0 111 </span>
michael@0 112 </p>
michael@0 113
michael@0 114 <p class="vcard" id="16-honorific-additional-multiple">
michael@0 115 <span class="fn n">
michael@0 116 <span class="honorific-prefix">Mr.</span>
michael@0 117 <span class="honorific-prefix">Dr.</span>
michael@0 118 <span class="given-name">John</span>
michael@0 119 <span class="additional-name">Maurice</span>
michael@0 120 <span class="additional-name">Benjamin</span>
michael@0 121 <span class="family-name">Doe</span>
michael@0 122 <span class="honorific-suffix">Ph.D.</span>,
michael@0 123 <span class="honorific-suffix">J.D.</span>
michael@0 124 </span>
michael@0 125 </p>
michael@0 126
michael@0 127 <p class="vcard" id="17-email-not-uri">
michael@0 128 <span class="fn">John Doe</span>
michael@0 129 <span class="email">john@example.com</span>
michael@0 130 </p>
michael@0 131
michael@0 132 <p class="vcard" id="18-object-data-http-uri">
michael@0 133 <span class="fn">John Doe</span>
michael@0 134 <object class="url photo logo" data="http://mochi.test:8888/tests/browser/microformats/test/picture.png" type="image/png"></object>
michael@0 135 </p>
michael@0 136
michael@0 137 <p class="vcard" id="19-object-data-data-uri">
michael@0 138 <span class="fn">John Doe</span>
michael@0 139 <object class="photo logo" data="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAASUExURf///8zMzJmZmWZmZjMzMwAAAPOPemkAAAM1SURBVHjaYmBgYGBkYQUBFkYWFiCPCchixQAMCCZAACF0MAMVM4K4TFh0IGsBCCAkOxhYmBnAAKaHhZkZmxaAAGJgYIbpYGBihGgBWsTMzMwE4jIhaWGAYoAAYmCECDExYAcwGxkg5oNIgABigDqLARdgZmGB2wICrKwAAcSA3xKgIxlZ0PwCEEAMBCxhgHoWSQtAADFAAxgfYEJ1GEAAQbQw4tUCsocBYQVAADEgu4uRkREeUCwszEwwLhOKLQABhNDCBA4aSDgwwhIAJKqYUPwCEEAMUK/AUwnc9aywJMCI7DAgAAggBohZ8JTBhGIJzCoWZL8ABBCYidAB8RUjWppkYUG2BSCAGMDqEMZiswUtXgACiAHsFYixTMywGGLGpgUWYgABxAA2mQkWCMyMqFoYmdD8ACQAAogBHJHMrCxg1cyIiICmCkYWDFsAAgiihYmZCewFFpR0BfI3LLch+QUggBiQ0iQjEyMDmh54qCBlUIAAYsCRJsElADQvgWKTlRGeKwECiAF3XgGmMEYQYADZzcoA9z5AAMG9RQCAtEC9DxBADFiyFyMjVi0wABBAWLQwQdIiuhYGWJIACCBg+KKUJ9BoBRdS2LQALQMIIGDQIEmwAO1kYcVWHCDZAhBAqFqYmOAxj2YNtAwDAYAAYmDEiBYWzHKKkRERYiwAAYSphZEZwxZGZiZQVEJTJkAAMTCyokc7M5oORlC5wcoEjxeAAAJqQXU0UB6W5WFmABMtEzMi1wEEEFAbE0YyAUuzMMEsYQalMkQSBQggUDmNPU3C9IA4LCxI+QUggEBiKOU8yExgqccCL3chnkPKlQABhGo6ejHBDKmdUHMlQAAhhQvQaGZGkBIkjcAMywLmI+VKgABCSowsTJhZkhlWXiBpAQggYBqBZl9GVOdBcz0LZqEEEEAMqLULMBLg1THWog9IAwQQA0qiZcRW5aPbAhBADCg1El4tMAAQQAxoiZYZXnTh1AIQQAzo2QlYpDDjcBgrxGEAAcSAJTthswmiBUwDBBC2GpkZJTaRvQ+mAQKIAUuuxdZWQvILQABBmSxMjBj5EpcWgACCMoFOYYSpZyHQHgMIMACt2hmoVEikCQAAAABJRU5ErkJggg==" />
michael@0 140 </p>
michael@0 141
michael@0 142 <p class="vcard" id="20-image-alt">
michael@0 143 <!-- only testing 'fn' here, but you should be able to parse any text value out of the img@alt -->
michael@0 144 <!-- also note, the fn should only be used to infer n, when there's no explicit n in the hcard -->
michael@0 145 <img class="fn photo logo" src="http://mochi.test:8888/tests/browser/microformats/test/picture.png" alt="John Doe" />
michael@0 146 </p>
michael@0 147
michael@0 148 <div class="vcard" id="21-tel">
michael@0 149 <p class="fn">John Doe</p>v
michael@0 150 <p class="tel">+1.415.555.1231</p>
michael@0 151 <p class="tel">
michael@0 152 <span class="type">home</span>
michael@0 153 <span class="value">+1 415 555 1232</span>
michael@0 154 </p>
michael@0 155 <div class="tel">
michael@0 156 types:
michael@0 157 <ul>
michael@0 158 <li class="type">msg</li>
michael@0 159 <li class="type">home</li>
michael@0 160 <li class="type">work</li>
michael@0 161 <li class="type">pref</li>
michael@0 162 <li class="type">voice</li>
michael@0 163 <li class="type">fax</li>
michael@0 164 <li class="type">cell</li>
michael@0 165 <li class="type">video</li>
michael@0 166 <li class="type">pager</li>
michael@0 167 <li class="type">bbs</li>
michael@0 168 <li class="type">car</li>
michael@0 169 <li class="type">isdn</li>
michael@0 170 <li class="type">pcs</li>
michael@0 171 <li class="type">invalid</li>
michael@0 172 </ul>
michael@0 173 <span class="value">+1</span>
michael@0 174 <span class="value">415</span>
michael@0 175 <span class="value">555</span>
michael@0 176 <span class="value">1233</span>
michael@0 177 </div>
michael@0 178 <p class="tel">
michael@0 179 <abbr class="type" title="home">H</abbr>
michael@0 180 <span class="value">+1 415 555 1234</span>
michael@0 181 </p>
michael@0 182 <a class="tel" href="tel:+1.415.555.1235">call me</a>
michael@0 183 <object class="tel" data="tel:+1.415.555.1236">call me</object>
michael@0 184 <a class="tel" href="fax:+1.415.555.1238">call me</a>
michael@0 185 <object class="tel" data="fax:+1.415.555.1239">call me</object>
michael@0 186 <a class="tel" href="modem:+1.415.555.1241">call me</a>
michael@0 187 <object class="tel" data="modem:+1.415.555.1242">call me</object>
michael@0 188 </div>
michael@0 189
michael@0 190 <div class="vcard" id="21-tel.2">
michael@0 191 <span class="fn">John Doe</span>
michael@0 192 <span class="tel"><span class="type">Home</span> +1.415.555.1212</span>
michael@0 193 </div>
michael@0 194
michael@0 195 <div class="vcard" id="21-tel.3">
michael@0 196 <span class="fn">John Doe</span>
michael@0 197 <span class="tel"><span class="type">Home</span><span class="type"> Pref</span> +1.415.555.1212</span>
michael@0 198 </div>
michael@0 199
michael@0 200 <!-- TODO: add test for 'extended' -->
michael@0 201 <div class="vcard" id="22-adr">
michael@0 202 <p class="fn">John Doe</p>
michael@0 203 <p class="adr">
michael@0 204 <span class="street-address">1231 Main St.</span>
michael@0 205 <span class="locality">Beverly Hills</span>
michael@0 206 <span class="region">California</span>
michael@0 207 <span class="country-name">United States of America</span>
michael@0 208 <span class="postal-code">90210</span>
michael@0 209 </p>
michael@0 210 <!-- multiple street-addresses, should produce a comma-separated list -->
michael@0 211 <p class="adr">
michael@0 212 <span class="post-office-box">PO Box 1234</span>
michael@0 213 <span class="street-address">1232 Main St.</span>
michael@0 214 <span class="street-address">Suite 100</span>
michael@0 215 <span class="locality">Beverly Hills</span>
michael@0 216 <span class="region">California</span>
michael@0 217 <span class="country-name">United States of America</span>
michael@0 218 <span class="postal-code">90210</span>
michael@0 219 </p>
michael@0 220 <!-- one type subproperty -->
michael@0 221 <p class="adr">
michael@0 222 <span class="type">home</span>
michael@0 223 <span class="street-address">1233 Main St.</span>
michael@0 224 <span class="locality">Beverly Hills</span>
michael@0 225 <span class="region">California</span>
michael@0 226 <span class="country-name">United States of America</span>
michael@0 227 <span class="postal-code">90210</span>
michael@0 228 </p>
michael@0 229 <!-- many type subproperties, each with their own class name -->
michael@0 230 <div class="adr">
michael@0 231 <ul>
michael@0 232 <li class="type">dom</li>
michael@0 233 <li class="type">intl</li>
michael@0 234 <li class="type">postal</li>
michael@0 235 <li class="type">parcel</li>
michael@0 236 <li class="type">home</li>
michael@0 237 <li class="type">work</li>
michael@0 238 <li class="type">pref</li>
michael@0 239 </ul>
michael@0 240 <span class="street-address">1234 Main St.</span>
michael@0 241 <span class="locality">Beverly Hills</span>
michael@0 242 <span class="region">California</span>
michael@0 243 <span class="country-name">United States of America</span>
michael@0 244 <span class="postal-code">90210</span>
michael@0 245 </div>
michael@0 246 </div>
michael@0 247
michael@0 248 <p class="vcard" id="23-abbr-title-everything">
michael@0 249 <!-- perhaps the most annoying test ever -->
michael@0 250 <abbr class="fn" title="John Doe">foo</abbr>
michael@0 251 <span class="n">
michael@0 252 <abbr class="honorific-prefix" title="Mister">Mr.</abbr>
michael@0 253 <abbr class="given-name" title="Jonathan">John</abbr>
michael@0 254 <abbr class="additional-name" title="John">J</abbr>
michael@0 255 <abbr class="family-name" title="Doe-Smith">Doe</abbr>
michael@0 256 <abbr class="honorific-suffix" title="Medical Doctor">M.D</abbr>
michael@0 257 </span>
michael@0 258 <abbr class="nickname" title="JJ">jj</abbr>
michael@0 259 <abbr class="bday" title="2006-04-04">April 4, 2006</abbr>
michael@0 260 <span class="adr">
michael@0 261 <abbr class="post-office-box" title="Box 1234">B. 1234</abbr>
michael@0 262 <abbr class="extended-address" title="Suite 100">Ste. 100</abbr>
michael@0 263 <abbr class="street-address" title="123 Fake Street">123 Fake St.</abbr>
michael@0 264 <abbr class="locality" title="San Francisco">San Fran</abbr>
michael@0 265 <abbr class="region" title="California">CA</abbr>
michael@0 266 <abbr class="postal-code" title="12345-6789">12345</abbr>
michael@0 267 <abbr class="country-name" title="United States of America">USA</abbr>
michael@0 268 <abbr class="type" title="work">workplace</abbr>
michael@0 269 </span>
michael@0 270 <abbr class="tel" title="415.555.1234">1234</abbr>
michael@0 271 <abbr class="tel-type-value" title="work">workplace</abbr>
michael@0 272 <!-- mailer -->
michael@0 273 <abbr class="tz" title="-0700">Pacific Time</abbr>
michael@0 274 <span class="geo">
michael@0 275 <abbr class="latitude" title="37.77">Northern</abbr>
michael@0 276 <abbr class="longitude" title="-122.41">California</abbr>
michael@0 277 </span>
michael@0 278 <abbr class="title" title="President">pres.</abbr> and
michael@0 279 <abbr class="role" title="Chief">cat wrangler</abbr>
michael@0 280 <!-- <span class="agent"></span> -->
michael@0 281 <span class="org">
michael@0 282 <abbr class="organization-name" title="Intellicorp">foo</abbr>
michael@0 283 <abbr class="organization-unit" title="Intelligence">bar</abbr>
michael@0 284 </span>
michael@0 285 <!-- <abbr class="category" title=""></abbr> -->
michael@0 286 <abbr class="note" title="this is a note">this is not a note</abbr>
michael@0 287 <!-- <abbr class="rev" title=""></abbr> (revision datetime) -->
michael@0 288 <!-- <abbr class="sort-string" title=""></abbr> -->
michael@0 289 <abbr class="uid" title="abcdefghijklmnopqrstuvwxyz">alpha</abbr>
michael@0 290 <abbr class="class" title="public">pub</abbr>
michael@0 291 <!-- <abbr class="key" title=""></abbr> -->
michael@0 292 </p>
michael@0 293
michael@0 294 There is no 24
michael@0 295
michael@0 296 <p class="vcard" id="25-geo-abbr">
michael@0 297 <abbr class="geo" title="30.267991;-97.739568"><span class="fn org">Paradise</span></abbr>
michael@0 298 </p>
michael@0 299
michael@0 300 <!-- This test is to make sure that parsers look at ancestors, not just children.-->
michael@0 301 <div class="vcard" id="26-ancestors">
michael@0 302 <!-- perhaps the second most annoying test ever -->
michael@0 303 <div>
michael@0 304 <span class="fn"><span>John</span> <span>Doe</span></span>
michael@0 305 <span class="n">
michael@0 306 <span>
michael@0 307 <span class="honorific-prefix"><strong>Mister</strong></span>
michael@0 308 <span class="given-name"><i>Jonathan</i></span>
michael@0 309 <span class="additional-name"><b>John</b></span>
michael@0 310 <span class="family-name"><em>Doe-Smith</em></span>
michael@0 311 <span class="honorific-suffix">Medical Doctor</span>
michael@0 312 </span>
michael@0 313 </span>
michael@0 314 <span class="nickname"><span>JJ</span></span>
michael@0 315 <span class="bday">2006-04-04</span>
michael@0 316 <span class="adr">
michael@0 317 <span>
michael@0 318 <span class="post-office-box"><samp>Box 1234</samp></span>
michael@0 319 <span class="extended-address"><dfn>Suite 100</dfn></span>
michael@0 320 <span class="street-address"><span>123 Fake Street</span></span>
michael@0 321 <span class="locality"><em>San Francisco</em></span>
michael@0 322 <span class="region"><strong>California</strong></span>
michael@0 323 <span class="postal-code"><abbr>12345-6789</abbr></span>
michael@0 324 <span class="country-name"><acronym>United States of America</acronym></span>
michael@0 325 <span class="type"><span>work</span></span>
michael@0 326 </span>
michael@0 327 </span>
michael@0 328 <span class="tel"><span>415</span>.<span>555</span>.<span>1234</span></span>
michael@0 329 <span class="tel-type-value">work</span>
michael@0 330 <!-- @TODO mailer? -->
michael@0 331 <span class="tz"><span>-0700</span></span>
michael@0 332 <span class="geo">
michael@0 333 <span>
michael@0 334 <span class="latitude"><code>37.77</code></span>
michael@0 335 <span class="longitude"><tt>-122.41</tt></span>
michael@0 336 </span>
michael@0 337 </span>
michael@0 338 <span class="title"><strong>President</strong></span> and
michael@0 339 <span class="role"><em>Chief</em></span>
michael@0 340 <span class="agent vcard">
michael@0 341 <span class="fn">Bob Smith</span>
michael@0 342 <span class="title">Executive Assistant</span>
michael@0 343 </span>
michael@0 344 <!-- <span class="agent</span> @TODO -->
michael@0 345 <span class="org">
michael@0 346 <span class="organization-name"><strong>Intellicorp</strong></span>
michael@0 347 <span class="organization-unit"><em>Intelligence</em></span>
michael@0 348 </span>
michael@0 349 <!-- @TODO <span class="category"></span> -->
michael@0 350 <span class="note"><cite>this is a note</cite></span>
michael@0 351 <!-- @TODO <span class="rev"></span> (revision datetime) -->
michael@0 352 <!-- @TODO <span class="sort-string"></span> -->
michael@0 353 <span class="uid"><kbd>abcdefghijklmnopqrstuvwxyz</kbd></span>
michael@0 354 <span class="class"><samp>public</samp></span>
michael@0 355 <!-- @TODO <span class="key"></span> -->
michael@0 356 </div>
michael@0 357 </div>
michael@0 358
michael@0 359 <p class="vcard" id="27-bday-date">
michael@0 360 <span class="fn">john doe</span>,
michael@0 361 <abbr class="bday" title="2000-01-01">January 1st, 2000</abbr>
michael@0 362 </p>
michael@0 363
michael@0 364 <p class="vcard" id="28-bday-datetime">
michael@0 365 <span class="fn">john doe</span>,
michael@0 366 <abbr class="bday" title="2000-01-01T00:00:00">January 1st, 2000 at midnight</abbr>
michael@0 367 </p>
michael@0 368
michael@0 369 <p class="vcard" id="29-bday-datetime-timezone">
michael@0 370 <span class="fn">john doe</span>,
michael@0 371 <abbr class="bday" title="2000-01-01T00:00:00-0800">January 1st, 2000 at midnight on the north american west coast</abbr>
michael@0 372 </p>
michael@0 373
michael@0 374 <div class="vcard" id="30-fn-org.1">
michael@0 375 <div class="fn org">W3C</div>
michael@0 376 </div>
michael@0 377 <div class="vcard" id="30-fn-org.2">
michael@0 378 <div class="fn">Dan Connolly</div>
michael@0 379 <div class="org">W3C</div>
michael@0 380 </div>
michael@0 381 <div class="vcard" id="30-fn-org.3">
michael@0 382 <img class="fn" src="http://mochi.test:8888/tests/browser/microformats/test/picture.png" alt="W3C" />
michael@0 383 <div class="org">W3C</div>
michael@0 384 </div>
michael@0 385 <div class="vcard" id="30-fn-org.4">
michael@0 386 <img class="fn org" src="http://mochi.test:8888/tests/browser/microformats/test/picture.png"
michael@0 387 alt="World Wide Web Consortium" />
michael@0 388 </div>
michael@0 389 <div class="vcard" id="30-fn-org.5">
michael@0 390 <object data="http://mochi.test:8888/tests/browser/microformats/test/w3c_home">
michael@0 391 <abbr class="fn org" title="World Wide Web Consortium">W3C</abbr>
michael@0 392 </object>
michael@0 393 </div>
michael@0 394
michael@0 395 <p id="email1"><a href="mailto:correct@example.com" class="email">my email</a></p>
michael@0 396 <p id="email2"><a href="mailto:incorrect@example.com" class="email">my email</a></p>
michael@0 397 <div class="vcard" id="31-include.1">
michael@0 398 <a class="url fn" href="http://suda.co.uk/">Brian Suda</a>
michael@0 399 <object data="#email1" class="include" type="text/html"/>
michael@0 400 <object data="#email2" type="text/html"/>
michael@0 401 </div>
michael@0 402 <div class="vcard" id="31-include.2">
michael@0 403 <a class="url fn" href="http://suda.co.uk/">Brian Suda</a>
michael@0 404 <a href="#email1" class="include"></a>
michael@0 405 <a href="#email2"/>
michael@0 406 </div>
michael@0 407 <div class="vcard" id="31-include.3">
michael@0 408 <a class="url fn" href="http://suda.co.uk/">Brian Suda</a>
michael@0 409 <a href="#email1" class="include"/>
michael@0 410 <a href="#email2"/>
michael@0 411 </div>
michael@0 412 <div class="vcard" id="31-include.4">
michael@0 413 <a class="url fn" href="http://suda.co.uk/">Brian Suda</a>
michael@0 414 <a href="#email" class="include"/>
michael@0 415 </div>
michael@0 416
michael@0 417 <table>
michael@0 418 <tr>
michael@0 419 <th id="org" ><a class="url org" href="http://example.org/">example.org</a></th>
michael@0 420 </tr>
michael@0 421 <tr>
michael@0 422 <td class="vcard" id="32-header.1" headers="org"><span class="fn">Brian Suda</span></td>
michael@0 423 </tr>
michael@0 424 <tr>
michael@0 425 <td class="vcard" id="32-header.2" headers="org"><span class="fn">John Doe</span></td>
michael@0 426 </tr>
michael@0 427 </table>
michael@0 428
michael@0 429 <div class="vcard" id="33-area.1">
michael@0 430 <map id="mailto-test-1">
michael@0 431 <area class="fn email" href="mailto:joe@example.com" alt="Joe Public"/>
michael@0 432 <area class="url" href="http://example.com/" alt="my website!" />
michael@0 433 </map>
michael@0 434 </div>
michael@0 435 <div class="vcard" id="33-area.2">
michael@0 436 <map id="mailto-test-2">
michael@0 437 <area class="fn email" href="mailto:joe@example.com" alt="Joe Public"/>
michael@0 438 <area class="url" href="http://example.com/" alt="my website!" />
michael@0 439 <area class="org" href="http://example.com/" alt="Joe Public" />
michael@0 440 </map>
michael@0 441 </div>
michael@0 442 <div class="vcard" id="33-area.3">
michael@0 443 <map id="mailto-test-3">
michael@0 444 <area class="fn email" href="mailto:joe@example.com" alt="Joe Public"/>
michael@0 445 <area class="url" href="http://example.com/" alt="my website!" />
michael@0 446 </map>
michael@0 447 <img class="org" src="http://mochi.test:8888/tests/browser/microformats/test/picture.png" alt="Joe Public" />
michael@0 448 </div>
michael@0 449 <div class="vcard" id="33-area.4">
michael@0 450 <map id="mailto-test-4">
michael@0 451 <area class="fn email" href="mailto:joe@example.com" alt="Joe Public"/>
michael@0 452 <area class="url" href="http://example.com/" alt="my website!" />
michael@0 453 </map>
michael@0 454 <div class="org">Joe Public</div>
michael@0 455 </div>
michael@0 456 <div class="vcard" id="33-area.5">
michael@0 457 <map id="mailto-test-5">
michael@0 458 <area class="fn email" href="mailto:joe@example.com" alt="Joe Public"/>
michael@0 459 <area class="url" href="http://example.com/" alt="my website!" />
michael@0 460 </map>
michael@0 461 <abbr class="org" title="Joe Public">Joe</abbr>
michael@0 462 </div>
michael@0 463
michael@0 464 <div class="vcard" id="34-notes">
michael@0 465 <a class="fn email" href="mailto:joe@example.com">Joe Public</a>
michael@0 466 <span class="note">Note 1</span>
michael@0 467 <span class="foorbar">Note 2</span>
michael@0 468 <span class="note foorbar">Note 3</span>
michael@0 469 <span class="note foorbar">Note 4 with a ; and a , to be escaped<!-- this <strong>should</strong> be ignored--></span>
michael@0 470 </div>
michael@0 471
michael@0 472 <div class="vcard" id="35-include-pattern.1">
michael@0 473 <span class="fn n" id="j">
michael@0 474 <span class="given-name">James</span> <span class="family-name">Levine</span>
michael@0 475 </span>
michael@0 476 </div>
michael@0 477 <div class="vcard" id="35-include-pattern.2">
michael@0 478 <object data="#j" class="include" type="text/html"></object>
michael@0 479 <span class="org">SimplyHired</span>
michael@0 480 <span class="title">Microformat Brainstormer</span>
michael@0 481 </div>
michael@0 482 <div class="vcard" id="35-include-pattern.3">
michael@0 483 <span class="fn n" id="j2">
michael@0 484 <span class="given-name">James</span> <span class="family-name">Levine</span>
michael@0 485 </span>
michael@0 486 <span class="org">SimplyHired</span>
michael@0 487 <span class="title">Microformat Brainstormer</span>
michael@0 488 </div>
michael@0 489
michael@0 490 <p class="vcard" id="36-categories.1">
michael@0 491 <span class="fn">john doe</span>,
michael@0 492 <abbr class="category" title="C1">C1a</abbr>
michael@0 493 <a class="category" href="http://example.com" title="C2">C2a</a>
michael@0 494 <a class="category" href="http://example.com/C3" rel="tag" title="C3a">C3b</a>
michael@0 495 <img class="category" src="http://mochi.test:8888/tests/browser/microformats/test/picture.png" alt="C4"/>
michael@0 496 <a class="category" href="http://example.com/C5/" rel="tag" title="C5a">C5b</a>
michael@0 497 <a class="category" href="http://example.com/C6?tag=false" rel="tag" title="C6a">C6b</a>
michael@0 498 <a class="category" href="http://example.com/C7#anchor" rel="tag" title="C7a">C7b</a>
michael@0 499 <a class="category" href="http://example.com/C8?tag=trailing-slash/" rel="tag" title="C8a">C8b</a>
michael@0 500 <a class="category" href="http://example.com/C9/?tag=trailing-slash/" rel="tag" title="C9a">C9b</a>
michael@0 501 </p>
michael@0 502 <div class="vcard" id="36-categories.2">
michael@0 503 <span class="fn n">
michael@0 504 <span class="given-name">Joe</span> <span class="family-name">User</span>
michael@0 505 </span>
michael@0 506 <span class="category">User</span>
michael@0 507 <a class="category" rel="tag" href="http://example.com/luser">a big luser!</a>
michael@0 508 </div>
michael@0 509
michael@0 510 <p class="vcard" id="37-singleton">
michael@0 511 <span class="fn n"><span class="given-name">john</span> <span class="family-name"><span class="sort-string">d</span>oe</span> 1</span>
michael@0 512 <span class="fn n"><span class="given-name"><span class="sort-string">j</span>ohn</span> <span class="family-name">doe</span> 2</span>
michael@0 513 <abbr class="bday" title="20060707">today</abbr>
michael@0 514 <abbr class="bday" title="20060708">tomorrow</abbr>
michael@0 515 <abbr class="geo" title="123.45;67.89">Here</abbr>
michael@0 516 <abbr class="geo" title="98.765;43.21">There</abbr>
michael@0 517 <abbr class="rev" title="20060707">today</abbr>
michael@0 518 <abbr class="rev" title="20060708">tomorrow</abbr>
michael@0 519 <abbr class="uid" title="unique-id-1">id-1</abbr>
michael@0 520 <abbr class="uid" title="unique-id-2">id-2</abbr>
michael@0 521 <span class="tz">+0600</span>
michael@0 522 <span class="tz">+0800</span>
michael@0 523 <span class="class">public</span>
michael@0 524 <span class="class">private</span>
michael@0 525 </p>
michael@0 526
michael@0 527 <div class="vcard" id="38-uid.1">
michael@0 528 <span class="fn">Ryan King</span>
michael@0 529 <a class="url uid" href="http://theryanking.com/contact/">My other hCard</a>
michael@0 530 </div>
michael@0 531 <div class="vcard" id="38-uid.2">
michael@0 532 <span class="fn">Ryan King</span>
michael@0 533 <object class="url uid" data="http://mochi.test:8888/tests/browser/microformats/test/contact/">My other hCard</object>
michael@0 534 </div>
michael@0 535 <div class="vcard" id="38-uid.3">
michael@0 536 <span class="fn">Ryan King</span>
michael@0 537 <img class="url uid" src="http://mochi.test:8888/tests/browser/microformats/test/contact/" alt="my other hcard" />
michael@0 538 </div>
michael@0 539 <div class="vcard" id="38-uid.4">
michael@0 540 <span class="fn">Ryan King</span>
michael@0 541 <map id="foo"><area class="url uid" href="http://theryanking.com/contact/" alt="my other hcard" /></map>
michael@0 542 </div>
michael@0 543
michael@0 544 <div class="vcard" id="39-noteHTML">
michael@0 545 <a class="fn">Joe Public</a>
michael@0 546 <span class="note"><b>Note</b></span>
michael@0 547 </div>
michael@0 548
michael@0 549 <div class="vcard" id="email-type">
michael@0 550 <span class="fn">John Doe</span>
michael@0 551 <span class="email">
michael@0 552 <span class="type">internet</span>
michael@0 553 <a href="mailto:notthis@example.com">john@example.com</a>
michael@0 554 </span>
michael@0 555 </div>
michael@0 556
michael@0 557
michael@0 558 </div>
michael@0 559 <pre id="test">
michael@0 560 <script class="testbody" type="text/javascript">
michael@0 561
michael@0 562 test_Microformats();
michael@0 563 test_hCard();
michael@0 564
michael@0 565 function test_Microformats() {
michael@0 566 var Microformats = SpecialPowers.Cu.import("resource://gre/modules/Microformats.js").Microformats;
michael@0 567
michael@0 568 ok(Microformats, "Check global access to Microformats");
michael@0 569 };
michael@0 570
michael@0 571 function test_hCard() {
michael@0 572 var hCard = SpecialPowers.Cu.import("resource://gre/modules/Microformats.js").hCard;
michael@0 573
michael@0 574 var hcard;
michael@0 575
michael@0 576 hcard = new hCard(document.getElementById("01-tantek-basic"));
michael@0 577
michael@0 578 is(hcard.fn, "Tantek Çelik", "01-tantek-basic - fn");
michael@0 579 is(hcard.url, "http://tantek.com/", "01-tantek-basic - url");
michael@0 580 is(hcard.n["given-name"][0], "Tantek", "01-tantek-basic - given-name");
michael@0 581 is(hcard.n["family-name"][0], "Çelik", "01-tantek-basic - family-name");
michael@0 582 is(hcard.org[0]["organization-name"], "Technorati", "01-tantek-basic - organization-name");
michael@0 583
michael@0 584 hcard = new hCard(document.getElementById("02-multiple-class-names-on-vcard.1"));
michael@0 585
michael@0 586 is(hcard.fn, "Ryan King", "02-multiple-class-names-on-vcard.1 - fn");
michael@0 587 is(hcard.n["given-name"][0], "Ryan", "02-multiple-class-names-on-vcard.1 - given-name");
michael@0 588 is(hcard.n["family-name"][0], "King", "02-multiple-class-names-on-vcard.1 - family-name");
michael@0 589
michael@0 590 hcard = new hCard(document.getElementById("02-multiple-class-names-on-vcard.2"));
michael@0 591
michael@0 592 is(hcard.fn, "Ryan King", "02-multiple-class-names-on-vcard.2 - fn");
michael@0 593 is(hcard.n["given-name"][0], "Ryan", "02-multiple-class-names-on-vcard.2 - given-name");
michael@0 594 is(hcard.n["family-name"][0], "King", "02-multiple-class-names-on-vcard.2 - family-name");
michael@0 595
michael@0 596 hcard = new hCard(document.getElementById("02-multiple-class-names-on-vcard.3"));
michael@0 597
michael@0 598 is(hcard.fn, "Ryan King", "02-multiple-class-names-on-vcard.3 - fn");
michael@0 599 is(hcard.n["given-name"][0], "Ryan", "02-multiple-class-names-on-vcard.3 - given-name");
michael@0 600 is(hcard.n["family-name"][0], "King", "02-multiple-class-names-on-vcard.3 - family-name");
michael@0 601
michael@0 602 hcard = new hCard(document.getElementById("03-implied-n.1"));
michael@0 603
michael@0 604 is(hcard.fn, "Ryan King", "03-implied-n.1 - fn");
michael@0 605 is(hcard.n["given-name"][0], "Ryan", "03-implied-n.1 - given-name");
michael@0 606 is(hcard.n["family-name"][0], "King", "03-implied-n.1 - family-name");
michael@0 607
michael@0 608 hcard = new hCard(document.getElementById("03-implied-n.2"));
michael@0 609
michael@0 610 is(hcard.fn, "Ryan King", "03-implied-n.2 - fn");
michael@0 611 is(hcard.n["given-name"][0], "Ryan", "03-implied-n.2 - given-name");
michael@0 612 is(hcard.n["family-name"][0], "King", "03-implied-n.2 - family-name");
michael@0 613
michael@0 614 hcard = new hCard(document.getElementById("03-implied-n.3"));
michael@0 615
michael@0 616 is(hcard.fn, "Ryan King", "03-implied-n.3 - fn");
michael@0 617 is(hcard.n["given-name"][0], "Ryan", "03-implied-n.3 - given-name");
michael@0 618 is(hcard.n["family-name"][0], "King", "03-implied-n.3 - family-name");
michael@0 619
michael@0 620 hcard = new hCard(document.getElementById("03-implied-n.4"));
michael@0 621
michael@0 622 is(hcard.fn, "Brian Suda", "03-implied-n.4 - fn");
michael@0 623 is(hcard.n["given-name"][0], "Brian", "03-implied-n.4 - given-name");
michael@0 624 is(hcard.n["family-name"][0], "Suda", "03-implied-n.4 - family-name");
michael@0 625
michael@0 626 hcard = new hCard(document.getElementById("03-implied-n.5"));
michael@0 627
michael@0 628 is(hcard.fn, "King, Ryan", "03-implied-n.5 - fn");
michael@0 629 is(hcard.n["given-name"][0], "Ryan", "03-implied-n.5 - given-name");
michael@0 630 is(hcard.n["family-name"][0], "King", "03-implied-n.5 - family-name");
michael@0 631
michael@0 632 hcard = new hCard(document.getElementById("03-implied-n.6"));
michael@0 633
michael@0 634 is(hcard.fn, "King, R", "03-implied-n.6 - fn");
michael@0 635 is(hcard.n["given-name"][0], "R", "03-implied-n.6 - given-name");
michael@0 636 is(hcard.n["family-name"][0], "King", "03-implied-n.6 - family-name");
michael@0 637
michael@0 638 hcard = new hCard(document.getElementById("03-implied-n.7"));
michael@0 639
michael@0 640 is(hcard.fn, "King R", "03-implied-n.7 - fn");
michael@0 641 is(hcard.n["given-name"][0], "R", "03-implied-n.7 - given-name");
michael@0 642 is(hcard.n["family-name"][0], "King", "03-implied-n.7 - family-name");
michael@0 643
michael@0 644 hcard = new hCard(document.getElementById("03-implied-n.8"));
michael@0 645
michael@0 646 is(hcard.fn, "King R.", "03-implied-n.8 - fn");
michael@0 647 is(hcard.n["given-name"][0], "R.", "03-implied-n.8 - given-name");
michael@0 648 is(hcard.n["family-name"][0], "King", "03-implied-n.8 - family-name");
michael@0 649
michael@0 650 hcard = new hCard(document.getElementById("03-implied-n.9"));
michael@0 651
michael@0 652 is(hcard.fn, "Jesse James Garrett", "03-implied-n.9 - fn");
michael@0 653 ok(hcard.n === undefined, "03-implied-n.9 -n");
michael@0 654
michael@0 655 hcard = new hCard(document.getElementById("03-implied-n.10"));
michael@0 656
michael@0 657 is(hcard.fn, "Thomas Vander Wal", "03-implied-n.10 - fn");
michael@0 658 ok(hcard.n === undefined, "03-implied-n.10 -n");
michael@0 659
michael@0 660 hcard = new hCard(document.getElementById("04-ignore-unknowns"));
michael@0 661
michael@0 662 is(hcard.fn, "Ryan King", "04-ignore-unknowns - fn");
michael@0 663 is(hcard.n["given-name"][0], "Ryan", "04-ignore-unknowns - given-name");
michael@0 664 is(hcard.n["family-name"][0], "King", "04-ignore-unknowns - family-name");
michael@0 665
michael@0 666 hcard = new hCard(document.getElementById("05-mailto-1"));
michael@0 667
michael@0 668 is(hcard.fn, "Ryan King", "05-mailto-1 - fn");
michael@0 669 is(hcard.n["given-name"][0], "Ryan", "05-mailto-1 - given-name");
michael@0 670 is(hcard.n["family-name"][0], "King", "05-mailto-1 - family-name");
michael@0 671 is(hcard.email[0].value, "ryan@technorati.com", "05-mailto-1 - email");
michael@0 672
michael@0 673 hcard = new hCard(document.getElementById("06-mailto-2"));
michael@0 674
michael@0 675 is(hcard.fn, "Brian Suda", "06-mailto-2 - fn");
michael@0 676 is(hcard.n["given-name"][0], "Brian", "06-mailto-2 - given-name");
michael@0 677 is(hcard.n["family-name"][0], "Suda", "06-mailto-2 - family-name");
michael@0 678 is(hcard.email[0].value, "brian@example.com", "06-mailto-2 - email");
michael@0 679
michael@0 680 hcard = new hCard(document.getElementById("07-relative-url"));
michael@0 681
michael@0 682 is(hcard.fn, "John Doe", "07-relative-url - fn");
michael@0 683 is(hcard.n["given-name"][0], "John", "07-relative-url - given-name");
michael@0 684 is(hcard.n["family-name"][0], "Doe", "07-relative-url - family-name");
michael@0 685 // is(hcard.url[0], "http://microformats.org/home/blah", "07-relative-url - url");
michael@0 686 is(hcard.url, "http://mochi.test:8888/home/blah", "07-relative-url - url");
michael@0 687
michael@0 688 hcard = new hCard(document.getElementById("11-multiple-urls"));
michael@0 689
michael@0 690 is(hcard.fn, "John Doe", "11-multiple-urls - fn");
michael@0 691 is(hcard.n["given-name"][0], "John", "11-multiple-urls - given-name");
michael@0 692 is(hcard.n["family-name"][0], "Doe", "11-multiple-urls - family-name");
michael@0 693 is(hcard.url[0], "http://example.com/foo", "11-multiple-urls - url");
michael@0 694 is(hcard.url[1], "http://example.com/bar", "11-multiple-urls - url");
michael@0 695
michael@0 696 hcard = new hCard(document.getElementById("12-img-src-url"));
michael@0 697
michael@0 698 is(hcard.fn, "John Doe", "12-img-src-url - fn");
michael@0 699 is(hcard.n["given-name"][0], "John", "12-img-src-url - given-name");
michael@0 700 is(hcard.n["family-name"][0], "Doe", "12-img-src-url - family-name");
michael@0 701 is(hcard.url[0], "http://mochi.test:8888/tests/browser/microformats/test/picture.png", "12-img-src-url - url");
michael@0 702
michael@0 703 hcard = new hCard(document.getElementById("13-photo-logo"));
michael@0 704
michael@0 705 is(hcard.fn, "John Doe", "13-photo-logo - fn");
michael@0 706 is(hcard.n["given-name"][0], "John", "13-photo-logo - given-name");
michael@0 707 is(hcard.n["family-name"][0], "Doe", "13-photo-logo - family-name");
michael@0 708 is(hcard.logo, "http://mochi.test:8888/tests/browser/microformats/test/picture.png", "13-photo-logo - logo");
michael@0 709 is(hcard.photo, "http://mochi.test:8888/tests/browser/microformats/test/picture.png", "13-photo-logo - photo");
michael@0 710
michael@0 711 hcard = new hCard(document.getElementById("14-img-src-data-url"));
michael@0 712
michael@0 713 is(hcard.fn, "John Doe", "14-img-src-data-url - fn");
michael@0 714 is(hcard.n["given-name"][0], "John", "14-img-src-data-url - given-name");
michael@0 715 is(hcard.n["family-name"][0], "Doe", "14-img-src-data-url - family-name");
michael@0 716 is(hcard.logo, "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAASUExURf///8zMzJmZmWZmZjMzMwAAAPOPemkAAAM1SURBVHjaYmBgYGBkYQUBFkYWFiCPCchixQAMCCZAACF0MAMVM4K4TFh0IGsBCCAkOxhYmBnAAKaHhZkZmxaAAGJgYIbpYGBihGgBWsTMzMwE4jIhaWGAYoAAYmCECDExYAcwGxkg5oNIgABigDqLARdgZmGB2wICrKwAAcSA3xKgIxlZ0PwCEEAMBCxhgHoWSQtAADFAAxgfYEJ1GEAAQbQw4tUCsocBYQVAADEgu4uRkREeUCwszEwwLhOKLQABhNDCBA4aSDgwwhIAJKqYUPwCEEAMUK/AUwnc9aywJMCI7DAgAAggBohZ8JTBhGIJzCoWZL8ABBCYidAB8RUjWppkYUG2BSCAGMDqEMZiswUtXgACiAHsFYixTMywGGLGpgUWYgABxAA2mQkWCMyMqFoYmdD8ACQAAogBHJHMrCxg1cyIiICmCkYWDFsAAgiihYmZCewFFpR0BfI3LLch+QUggBiQ0iQjEyMDmh54qCBlUIAAYsCRJsElADQvgWKTlRGeKwECiAF3XgGmMEYQYADZzcoA9z5AAMG9RQCAtEC9DxBADFiyFyMjVi0wABBAWLQwQdIiuhYGWJIACCBg+KKUJ9BoBRdS2LQALQMIIGDQIEmwAO1kYcVWHCDZAhBAqFqYmOAxj2YNtAwDAYAAYmDEiBYWzHKKkRERYiwAAYSphZEZwxZGZiZQVEJTJkAAMTCyokc7M5oORlC5wcoEjxeAAAJqQXU0UB6W5WFmABMtEzMi1wEEEFAbE0YyAUuzMMEsYQalMkQSBQggUDmNPU3C9IA4LCxI+QUggEBiKOU8yExgqccCL3chnkPKlQABhGo6ejHBDKmdUHMlQAAhhQvQaGZGkBIkjcAMywLmI+VKgABCSowsTJhZkhlWXiBpAQggYBqBZl9GVOdBcz0LZqEEEEAMqLULMBLg1THWog9IAwQQA0qiZcRW5aPbAhBADCg1El4tMAAQQAxoiZYZXnTh1AIQQAzo2QlYpDDjcBgrxGEAAcSAJTthswmiBUwDBBC2GpkZJTaRvQ+mAQKIAUuuxdZWQvILQABBmSxMjBj5EpcWgACCMoFOYYSpZyHQHgMIMACt2hmoVEikCQAAAABJRU5ErkJggg==", "14-img-src-data-url - logo");
michael@0 717 is(hcard.photo, "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAASUExURf///8zMzJmZmWZmZjMzMwAAAPOPemkAAAM1SURBVHjaYmBgYGBkYQUBFkYWFiCPCchixQAMCCZAACF0MAMVM4K4TFh0IGsBCCAkOxhYmBnAAKaHhZkZmxaAAGJgYIbpYGBihGgBWsTMzMwE4jIhaWGAYoAAYmCECDExYAcwGxkg5oNIgABigDqLARdgZmGB2wICrKwAAcSA3xKgIxlZ0PwCEEAMBCxhgHoWSQtAADFAAxgfYEJ1GEAAQbQw4tUCsocBYQVAADEgu4uRkREeUCwszEwwLhOKLQABhNDCBA4aSDgwwhIAJKqYUPwCEEAMUK/AUwnc9aywJMCI7DAgAAggBohZ8JTBhGIJzCoWZL8ABBCYidAB8RUjWppkYUG2BSCAGMDqEMZiswUtXgACiAHsFYixTMywGGLGpgUWYgABxAA2mQkWCMyMqFoYmdD8ACQAAogBHJHMrCxg1cyIiICmCkYWDFsAAgiihYmZCewFFpR0BfI3LLch+QUggBiQ0iQjEyMDmh54qCBlUIAAYsCRJsElADQvgWKTlRGeKwECiAF3XgGmMEYQYADZzcoA9z5AAMG9RQCAtEC9DxBADFiyFyMjVi0wABBAWLQwQdIiuhYGWJIACCBg+KKUJ9BoBRdS2LQALQMIIGDQIEmwAO1kYcVWHCDZAhBAqFqYmOAxj2YNtAwDAYAAYmDEiBYWzHKKkRERYiwAAYSphZEZwxZGZiZQVEJTJkAAMTCyokc7M5oORlC5wcoEjxeAAAJqQXU0UB6W5WFmABMtEzMi1wEEEFAbE0YyAUuzMMEsYQalMkQSBQggUDmNPU3C9IA4LCxI+QUggEBiKOU8yExgqccCL3chnkPKlQABhGo6ejHBDKmdUHMlQAAhhQvQaGZGkBIkjcAMywLmI+VKgABCSowsTJhZkhlWXiBpAQggYBqBZl9GVOdBcz0LZqEEEEAMqLULMBLg1THWog9IAwQQA0qiZcRW5aPbAhBADCg1El4tMAAQQAxoiZYZXnTh1AIQQAzo2QlYpDDjcBgrxGEAAcSAJTthswmiBUwDBBC2GpkZJTaRvQ+mAQKIAUuuxdZWQvILQABBmSxMjBj5EpcWgACCMoFOYYSpZyHQHgMIMACt2hmoVEikCQAAAABJRU5ErkJggg==", "14-img-src-data-url - photo");
michael@0 718
michael@0 719 hcard = new hCard(document.getElementById("15-honorific-additional-single"));
michael@0 720
michael@0 721 is(hcard.fn, "Mr. John Maurice Doe, Ph.D.", "15-honorific-additional-single - fn");
michael@0 722 is(hcard.n["given-name"][0], "John", "15-honorific-additional-single - given-name");
michael@0 723 is(hcard.n["family-name"][0], "Doe", "15-honorific-additional-single - family-name");
michael@0 724 is(hcard.n["honorific-prefix"], "Mr.", "15-honorific-additional-single - honorific-prefix");
michael@0 725 is(hcard.n["additional-name"], "Maurice", "15-honorific-additional-single - additional-name");
michael@0 726 is(hcard.n["honorific-suffix"], "Ph.D.", "15-honorific-additional-single - honorific-suffix");
michael@0 727
michael@0 728 hcard = new hCard(document.getElementById("16-honorific-additional-multiple"));
michael@0 729
michael@0 730 is(hcard.fn, "Mr. Dr. John Maurice Benjamin Doe Ph.D., J.D.", "16-honorific-additional-multiple - fn");
michael@0 731 is(hcard.n["given-name"][0], "John", "16-honorific-additional-multiple - given-name");
michael@0 732 is(hcard.n["family-name"][0], "Doe", "16-honorific-additional-multiple - family-name");
michael@0 733 is(hcard.n["honorific-prefix"][0], "Mr.", "16-honorific-additional-multiple - honorific-prefix");
michael@0 734 is(hcard.n["honorific-prefix"][1], "Dr.", "16-honorific-additional-multiple - honorific-prefix");
michael@0 735 is(hcard.n["additional-name"][0], "Maurice", "16-honorific-additional-multiple - additional-name");
michael@0 736 is(hcard.n["additional-name"][1], "Benjamin", "16-honorific-additional-multiple - additional-name");
michael@0 737 is(hcard.n["honorific-suffix"][0], "Ph.D.", "16-honorific-additional-multiple - honorific-suffix");
michael@0 738 is(hcard.n["honorific-suffix"][1], "J.D.", "16-honorific-additional-multiple - honorific-suffix");
michael@0 739
michael@0 740 hcard = new hCard(document.getElementById("17-email-not-uri"));
michael@0 741
michael@0 742 is(hcard.fn, "John Doe", "17-email-not-uri - fn");
michael@0 743 is(hcard.n["given-name"][0], "John", "17-email-not-uri - given-name");
michael@0 744 is(hcard.n["family-name"][0], "Doe", "17-email-not-uri - family-name");
michael@0 745 is(hcard.email[0].value, "john@example.com", "17-email-not-uri - email");
michael@0 746
michael@0 747 hcard = new hCard(document.getElementById("18-object-data-http-uri"));
michael@0 748
michael@0 749 is(hcard.fn, "John Doe", "18-object-data-http-uri - fn");
michael@0 750 is(hcard.n["given-name"][0], "John", "18-object-data-http-uri - given-name");
michael@0 751 is(hcard.n["family-name"][0], "Doe", "18-object-data-http-uri - family-name");
michael@0 752 is(hcard.logo, "http://mochi.test:8888/tests/browser/microformats/test/picture.png", "18-object-data-http-uri - logo");
michael@0 753 is(hcard.photo, "http://mochi.test:8888/tests/browser/microformats/test/picture.png", "18-object-data-http-uri - photo");
michael@0 754 is(hcard.url, "http://mochi.test:8888/tests/browser/microformats/test/picture.png", "18-object-data-http-uri - url");
michael@0 755
michael@0 756 hcard = new hCard(document.getElementById("19-object-data-data-uri"));
michael@0 757
michael@0 758 is(hcard.fn, "John Doe", "19-object-data-data-uri - fn");
michael@0 759 is(hcard.n["given-name"][0], "John", "19-object-data-data-uri - given-name");
michael@0 760 is(hcard.n["family-name"][0], "Doe", "19-object-data-data-uri - family-name");
michael@0 761 is(hcard.logo, "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAASUExURf///8zMzJmZmWZmZjMzMwAAAPOPemkAAAM1SURBVHjaYmBgYGBkYQUBFkYWFiCPCchixQAMCCZAACF0MAMVM4K4TFh0IGsBCCAkOxhYmBnAAKaHhZkZmxaAAGJgYIbpYGBihGgBWsTMzMwE4jIhaWGAYoAAYmCECDExYAcwGxkg5oNIgABigDqLARdgZmGB2wICrKwAAcSA3xKgIxlZ0PwCEEAMBCxhgHoWSQtAADFAAxgfYEJ1GEAAQbQw4tUCsocBYQVAADEgu4uRkREeUCwszEwwLhOKLQABhNDCBA4aSDgwwhIAJKqYUPwCEEAMUK/AUwnc9aywJMCI7DAgAAggBohZ8JTBhGIJzCoWZL8ABBCYidAB8RUjWppkYUG2BSCAGMDqEMZiswUtXgACiAHsFYixTMywGGLGpgUWYgABxAA2mQkWCMyMqFoYmdD8ACQAAogBHJHMrCxg1cyIiICmCkYWDFsAAgiihYmZCewFFpR0BfI3LLch+QUggBiQ0iQjEyMDmh54qCBlUIAAYsCRJsElADQvgWKTlRGeKwECiAF3XgGmMEYQYADZzcoA9z5AAMG9RQCAtEC9DxBADFiyFyMjVi0wABBAWLQwQdIiuhYGWJIACCBg+KKUJ9BoBRdS2LQALQMIIGDQIEmwAO1kYcVWHCDZAhBAqFqYmOAxj2YNtAwDAYAAYmDEiBYWzHKKkRERYiwAAYSphZEZwxZGZiZQVEJTJkAAMTCyokc7M5oORlC5wcoEjxeAAAJqQXU0UB6W5WFmABMtEzMi1wEEEFAbE0YyAUuzMMEsYQalMkQSBQggUDmNPU3C9IA4LCxI+QUggEBiKOU8yExgqccCL3chnkPKlQABhGo6ejHBDKmdUHMlQAAhhQvQaGZGkBIkjcAMywLmI+VKgABCSowsTJhZkhlWXiBpAQggYBqBZl9GVOdBcz0LZqEEEEAMqLULMBLg1THWog9IAwQQA0qiZcRW5aPbAhBADCg1El4tMAAQQAxoiZYZXnTh1AIQQAzo2QlYpDDjcBgrxGEAAcSAJTthswmiBUwDBBC2GpkZJTaRvQ+mAQKIAUuuxdZWQvILQABBmSxMjBj5EpcWgACCMoFOYYSpZyHQHgMIMACt2hmoVEikCQAAAABJRU5ErkJggg==", "19-object-data-data-uri - logo");
michael@0 762 is(hcard.photo, "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAASUExURf///8zMzJmZmWZmZjMzMwAAAPOPemkAAAM1SURBVHjaYmBgYGBkYQUBFkYWFiCPCchixQAMCCZAACF0MAMVM4K4TFh0IGsBCCAkOxhYmBnAAKaHhZkZmxaAAGJgYIbpYGBihGgBWsTMzMwE4jIhaWGAYoAAYmCECDExYAcwGxkg5oNIgABigDqLARdgZmGB2wICrKwAAcSA3xKgIxlZ0PwCEEAMBCxhgHoWSQtAADFAAxgfYEJ1GEAAQbQw4tUCsocBYQVAADEgu4uRkREeUCwszEwwLhOKLQABhNDCBA4aSDgwwhIAJKqYUPwCEEAMUK/AUwnc9aywJMCI7DAgAAggBohZ8JTBhGIJzCoWZL8ABBCYidAB8RUjWppkYUG2BSCAGMDqEMZiswUtXgACiAHsFYixTMywGGLGpgUWYgABxAA2mQkWCMyMqFoYmdD8ACQAAogBHJHMrCxg1cyIiICmCkYWDFsAAgiihYmZCewFFpR0BfI3LLch+QUggBiQ0iQjEyMDmh54qCBlUIAAYsCRJsElADQvgWKTlRGeKwECiAF3XgGmMEYQYADZzcoA9z5AAMG9RQCAtEC9DxBADFiyFyMjVi0wABBAWLQwQdIiuhYGWJIACCBg+KKUJ9BoBRdS2LQALQMIIGDQIEmwAO1kYcVWHCDZAhBAqFqYmOAxj2YNtAwDAYAAYmDEiBYWzHKKkRERYiwAAYSphZEZwxZGZiZQVEJTJkAAMTCyokc7M5oORlC5wcoEjxeAAAJqQXU0UB6W5WFmABMtEzMi1wEEEFAbE0YyAUuzMMEsYQalMkQSBQggUDmNPU3C9IA4LCxI+QUggEBiKOU8yExgqccCL3chnkPKlQABhGo6ejHBDKmdUHMlQAAhhQvQaGZGkBIkjcAMywLmI+VKgABCSowsTJhZkhlWXiBpAQggYBqBZl9GVOdBcz0LZqEEEEAMqLULMBLg1THWog9IAwQQA0qiZcRW5aPbAhBADCg1El4tMAAQQAxoiZYZXnTh1AIQQAzo2QlYpDDjcBgrxGEAAcSAJTthswmiBUwDBBC2GpkZJTaRvQ+mAQKIAUuuxdZWQvILQABBmSxMjBj5EpcWgACCMoFOYYSpZyHQHgMIMACt2hmoVEikCQAAAABJRU5ErkJggg==", "19-object-data-data-uri - photo");
michael@0 763
michael@0 764
michael@0 765 hcard = new hCard(document.getElementById("20-image-alt"));
michael@0 766
michael@0 767 is(hcard.fn, "John Doe", "20-image-alt - fn");
michael@0 768 is(hcard.n["given-name"][0], "John", "20-image-alt - given-name");
michael@0 769 is(hcard.n["family-name"][0], "Doe", "20-image-alt - family-name");
michael@0 770 is(hcard.logo, "http://mochi.test:8888/tests/browser/microformats/test/picture.png", "20-image-alt - logo");
michael@0 771 is(hcard.photo, "http://mochi.test:8888/tests/browser/microformats/test/picture.png", "20-image-alt - photo");
michael@0 772
michael@0 773 hcard = new hCard(document.getElementById("21-tel"));
michael@0 774
michael@0 775 is(hcard.fn, "John Doe", "21-tel - fn");
michael@0 776 is(hcard.n["given-name"][0], "John", "21-tel - given-name");
michael@0 777 is(hcard.n["family-name"][0], "Doe", "21-tel - family-name");
michael@0 778 is(hcard.tel[0].value, "+1.415.555.1231", "21-tel - tel");
michael@0 779 is(hcard.tel[1].value, "+1 415 555 1232", "21-tel - tel");
michael@0 780 is(hcard.tel[1].type[0], "home", "21-tel - type");
michael@0 781 is(hcard.tel[2].value, "+14155551233", "21-tel - tel");
michael@0 782 is(hcard.tel[2].type[0], "msg", "21-tel - type");
michael@0 783 is(hcard.tel[2].type[1], "home", "21-tel - type");
michael@0 784 is(hcard.tel[2].type[2], "work", "21-tel - type");
michael@0 785 is(hcard.tel[2].type[3], "pref", "21-tel - type");
michael@0 786 is(hcard.tel[2].type[4], "voice", "21-tel - type");
michael@0 787 is(hcard.tel[2].type[5], "fax", "21-tel - type");
michael@0 788 is(hcard.tel[2].type[6], "cell", "21-tel - type");
michael@0 789 is(hcard.tel[2].type[7], "video", "21-tel - type");
michael@0 790 is(hcard.tel[2].type[8], "pager", "21-tel - type");
michael@0 791 is(hcard.tel[2].type[9], "bbs", "21-tel - type");
michael@0 792 is(hcard.tel[2].type[10], "car", "21-tel - type");
michael@0 793 is(hcard.tel[2].type[11], "isdn", "21-tel - type");
michael@0 794 is(hcard.tel[2].type[12], "pcs", "21-tel - type");
michael@0 795 isnot(hcard.tel[2].type[13], "invalid", "21-tel - type");
michael@0 796 is(hcard.tel[3].value, "+1 415 555 1234", "21-tel - tel");
michael@0 797 is(hcard.tel[3].type[0], "home", "21-tel - type");
michael@0 798 is(hcard.tel[4].value, "+1.415.555.1235", "21-tel - tel");
michael@0 799 is(hcard.tel[5].value, "+1.415.555.1236", "21-tel - tel");
michael@0 800 is(hcard.tel[6].value, "+1.415.555.1238", "21-tel - tel");
michael@0 801 is(hcard.tel[7].value, "+1.415.555.1239", "21-tel - tel");
michael@0 802 is(hcard.tel[8].value, "+1.415.555.1241", "21-tel - tel");
michael@0 803 is(hcard.tel[9].value, "+1.415.555.1242", "21-tel - tel");
michael@0 804
michael@0 805 hcard = new hCard(document.getElementById("21-tel.2"));
michael@0 806
michael@0 807 is(hcard.tel[0].type[0], "home", "21-tel.2 - type");
michael@0 808 is(hcard.tel[0].value, "+1.415.555.1212", "21-tel.2 - tel");
michael@0 809
michael@0 810 hcard = new hCard(document.getElementById("21-tel.3"));
michael@0 811
michael@0 812 is(hcard.tel[0].type[0], "home", "21-tel.3 - type (home)");
michael@0 813 is(hcard.tel[0].type[1], "pref", "21-tel.3 - type (pref)");
michael@0 814 is(hcard.tel[0].value, "+1.415.555.1212", "21-tel.3 - tel");
michael@0 815
michael@0 816 hcard = new hCard(document.getElementById("22-adr"));
michael@0 817
michael@0 818 is(hcard.fn, "John Doe", "22-adr - fn");
michael@0 819 is(hcard.n["given-name"][0], "John", "22-adr - given-name");
michael@0 820 is(hcard.n["family-name"][0], "Doe", "22-adr - family-name");
michael@0 821 is(hcard.adr[0]["street-address"][0], "1231 Main St.", "22-adr - street-address");
michael@0 822 is(hcard.adr[0].locality, "Beverly Hills", "22-adr - locality");
michael@0 823 is(hcard.adr[0].region, "California", "22-adr - region");
michael@0 824 is(hcard.adr[0]["postal-code"], "90210", "22-adr - postal-code");
michael@0 825 is(hcard.adr[0]["country-name"], "United States of America", "22-adr - country-name");
michael@0 826 is(hcard.adr[1]["post-office-box"], "PO Box 1234", "22-adr - post-office-box");
michael@0 827 is(hcard.adr[1]["street-address"][0], "1232 Main St.", "22-adr - street-address");
michael@0 828 is(hcard.adr[1]["street-address"][1], "Suite 100", "22-adr - street-address");
michael@0 829 is(hcard.adr[1].locality, "Beverly Hills", "22-adr - locality");
michael@0 830 is(hcard.adr[1].region, "California", "22-adr - region");
michael@0 831 is(hcard.adr[1]["postal-code"], "90210", "22-adr - postal-code");
michael@0 832 is(hcard.adr[1]["country-name"], "United States of America", "22-adr - country-name");
michael@0 833 is(hcard.adr[2]["type"][0], "home", "22-adr - type");
michael@0 834 is(hcard.adr[2]["street-address"][0], "1233 Main St.", "22-adr - street-address");
michael@0 835 is(hcard.adr[2].locality, "Beverly Hills", "22-adr - locality");
michael@0 836 is(hcard.adr[2].region, "California", "22-adr - region");
michael@0 837 is(hcard.adr[2]["postal-code"], "90210", "22-adr - postal-code");
michael@0 838 is(hcard.adr[2]["country-name"], "United States of America", "22-adr - country-name");
michael@0 839 is(hcard.adr[3]["type"][0], "dom", "22-adr - type");
michael@0 840 is(hcard.adr[3]["type"][1], "intl", "22-adr - type");
michael@0 841 is(hcard.adr[3]["type"][2], "postal", "22-adr - type");
michael@0 842 is(hcard.adr[3]["type"][3], "parcel", "22-adr - type");
michael@0 843 is(hcard.adr[3]["type"][4], "home", "22-adr - type");
michael@0 844 is(hcard.adr[3]["type"][5], "work", "22-adr - type");
michael@0 845 is(hcard.adr[3]["type"][6], "pref", "22-adr - type");
michael@0 846 is(hcard.adr[3]["street-address"][0], "1234 Main St.", "22-adr - street-address");
michael@0 847 is(hcard.adr[3].locality, "Beverly Hills", "22-adr - locality");
michael@0 848 is(hcard.adr[3].region, "California", "22-adr - region");
michael@0 849 is(hcard.adr[3]["postal-code"], "90210", "22-adr - postal-code");
michael@0 850 is(hcard.adr[3]["country-name"], "United States of America", "22-adr - country-name");
michael@0 851
michael@0 852 hcard = new hCard(document.getElementById("23-abbr-title-everything"));
michael@0 853
michael@0 854 is(hcard.fn, "John Doe", "23-abbr-title-everything - fn");
michael@0 855 is(hcard.n["given-name"][0], "Jonathan", "23-abbr-title-everything - given-name");
michael@0 856 is(hcard.n["family-name"][0], "Doe-Smith", "23-abbr-title-everything - family-name");
michael@0 857 is(hcard.n["additional-name"], "John", "23-abbr-title-everything - additional-name");
michael@0 858 is(hcard.n["honorific-prefix"], "Mister", "23-abbr-title-everything - honorific-prefix");
michael@0 859 is(hcard.n["honorific-suffix"], "Medical Doctor", "23-abbr-title-everything - honorific-suffix");
michael@0 860 is(hcard["class"], "public", "23-abbr-title-everything - class");
michael@0 861 is(hcard.geo.latitude, "37.77", "23-abbr-title-everything - geo.latitude");
michael@0 862 is(hcard.geo.longitude, "-122.41", "23-abbr-title-everything - geo.longitude");
michael@0 863 is(hcard.bday, "2006-04-04", "23-abbr-title-everything - bday");
michael@0 864 is(hcard.nickname[0], "JJ", "23-abbr-title-everything - nickname");
michael@0 865 is(hcard.note[0], "this is a note", "23-abbr-title-everything - note");
michael@0 866 isnot(hcard.note[0], "this is not a note", "23-abbr-title-everything - note");
michael@0 867 is(hcard.org[0]["organization-name"], "Intellicorp", "23-abbr-title-everything - organization-name");
michael@0 868 is(hcard.org[0]["organization-unit"][0], "Intelligence", "23-abbr-title-everything - organization-unit");
michael@0 869 is(hcard.role, "Chief", "23-abbr-title-everything - role");
michael@0 870 is(hcard.tel[0].value, "415.555.1234", "23-abbr-title-everything - tel");
michael@0 871 is(hcard.title[0], "President", "23-abbr-title-everything - title");
michael@0 872 is(hcard.tz, "-0700", "23-abbr-title-everything - tz");
michael@0 873 is(hcard.uid, "abcdefghijklmnopqrstuvwxyz", "23-abbr-title-everything - uid");
michael@0 874 is(hcard.adr[0]["post-office-box"], "Box 1234", "23-abbr-title-everything - post-office-box");
michael@0 875 is(hcard.adr[0]["street-address"][0], "123 Fake Street", "23-abbr-title-everything - street-address");
michael@0 876 is(hcard.adr[0]["extended-address"], "Suite 100", "23-abbr-title-everything - street-address");
michael@0 877 is(hcard.adr[0].locality, "San Francisco", "23-abbr-title-everything - locality");
michael@0 878 is(hcard.adr[0].region, "California", "23-abbr-title-everything - region");
michael@0 879 is(hcard.adr[0]["postal-code"], "12345-6789", "23-abbr-title-everything - postal-code");
michael@0 880 is(hcard.adr[0]["country-name"], "United States of America", "23-abbr-title-everything - country-name");
michael@0 881
michael@0 882 hcard = new hCard(document.getElementById("25-geo-abbr"));
michael@0 883
michael@0 884 is(hcard.fn, "Paradise", "25-geo-abbr - fn");
michael@0 885 is(hcard.geo.latitude, "30.267991", "25-geo-abbr - geo.latitude");
michael@0 886 is(hcard.geo.longitude, "-97.739568", "25-geo-abbr - geo.longitude");
michael@0 887
michael@0 888 hcard = new hCard(document.getElementById("26-ancestors"));
michael@0 889
michael@0 890 is(hcard.fn, "John Doe", "26-ancestors - fn");
michael@0 891 is(hcard.n["given-name"][0], "Jonathan", "26-ancestors - given-name");
michael@0 892 is(hcard.n["family-name"][0], "Doe-Smith", "26-ancestors - family-name");
michael@0 893 is(hcard.n["additional-name"], "John", "26-ancestors - additional-name");
michael@0 894 is(hcard.n["honorific-prefix"], "Mister", "26-ancestors - honorific-prefix");
michael@0 895 is(hcard.n["honorific-suffix"], "Medical Doctor", "26-ancestors - honorific-suffix");
michael@0 896 is(hcard["class"], "public", "26-ancestors - class");
michael@0 897 is(hcard.geo.latitude, "37.77", "26-ancestors - geo.latitude");
michael@0 898 is(hcard.geo.longitude, "-122.41", "26-ancestors - geo.longitude");
michael@0 899 is(hcard.bday, "2006-04-04", "26-ancestors - bday");
michael@0 900 is(hcard.nickname[0], "JJ", "26-ancestors - nickname");
michael@0 901 is(hcard.note[0], "this is a note", "26-ancestors - note");
michael@0 902 isnot(hcard.note[0], "this is not a note", "26-ancestors - note");
michael@0 903 is(hcard.org[0]["organization-name"], "Intellicorp", "26-ancestors - organization-name");
michael@0 904 is(hcard.org[0]["organization-unit"][0], "Intelligence", "26-ancestors - organization-unit");
michael@0 905 is(hcard.role, "Chief", "26-ancestors - role");
michael@0 906 is(hcard.agent[0].fn, "Bob Smith", "26-ancestors - agent.fn");
michael@0 907 is(hcard.agent[0].title, "Executive Assistant", "26-ancestors - agent.title");
michael@0 908 is(hcard.tel[0].value, "415.555.1234", "26-ancestors - tel");
michael@0 909 is(hcard.title[0], "President", "26-ancestors - title");
michael@0 910 is(hcard.tz, "-0700", "26-ancestors - tz");
michael@0 911 is(hcard.uid, "abcdefghijklmnopqrstuvwxyz", "26-ancestors - uid");
michael@0 912 is(hcard.adr[0]["post-office-box"], "Box 1234", "26-ancestors - post-office-box");
michael@0 913 is(hcard.adr[0]["street-address"][0], "123 Fake Street", "26-ancestors - street-address");
michael@0 914 is(hcard.adr[0]["extended-address"], "Suite 100", "26-ancestors - street-address");
michael@0 915 is(hcard.adr[0].locality, "San Francisco", "26-ancestors - locality");
michael@0 916 is(hcard.adr[0].region, "California", "26-ancestors - region");
michael@0 917 is(hcard.adr[0]["postal-code"], "12345-6789", "26-ancestors - postal-code");
michael@0 918 is(hcard.adr[0]["country-name"], "United States of America", "26-ancestors - country-name");
michael@0 919
michael@0 920 hcard = new hCard(document.getElementById("27-bday-date"));
michael@0 921
michael@0 922 is(hcard.fn, "john doe", "27-bday-date - fn");
michael@0 923 is(hcard.n["given-name"][0], "john", "27-bday-date - given-name");
michael@0 924 is(hcard.n["family-name"][0], "doe", "27-bday-date - family-name");
michael@0 925 is(hcard.bday, "2000-01-01", "27-bday-date - bday");
michael@0 926
michael@0 927 hcard = new hCard(document.getElementById("28-bday-datetime"));
michael@0 928
michael@0 929 is(hcard.fn, "john doe", "28-bday-datetime - fn");
michael@0 930 is(hcard.n["given-name"][0], "john", "28-bday-datetime - given-name");
michael@0 931 is(hcard.n["family-name"][0], "doe", "28-bday-datetime - family-name");
michael@0 932 is(hcard.bday, "2000-01-01T00:00:00", "28-bday-datetime - bday");
michael@0 933
michael@0 934 hcard = new hCard(document.getElementById("29-bday-datetime-timezone"));
michael@0 935
michael@0 936 is(hcard.fn, "john doe", "29-bday-datetime-timezone - fn");
michael@0 937 is(hcard.n["given-name"][0], "john", "29-bday-datetime-timezone - given-name");
michael@0 938 is(hcard.n["family-name"][0], "doe", "29-bday-datetime-timezone - family-name");
michael@0 939 is(hcard.bday, "2000-01-01T00:00:00-0800", "29-bday-datetime-timezone - bday");
michael@0 940
michael@0 941 hcard = new hCard(document.getElementById("30-fn-org.1"));
michael@0 942
michael@0 943 is(hcard.fn, "W3C", "30-fn-org.1 - fn");
michael@0 944 is(hcard.org[0]["organization-name"], "W3C", "30-fn-org.1 - organization-name");
michael@0 945
michael@0 946
michael@0 947 hcard = new hCard(document.getElementById("30-fn-org.2"));
michael@0 948
michael@0 949 is(hcard.fn, "Dan Connolly", "30-fn-org.2 - fn");
michael@0 950 is(hcard.n["given-name"][0], "Dan", "30-fn-org.2 - given-name");
michael@0 951 is(hcard.n["family-name"][0], "Connolly", "30-fn-org.2 - family-name");
michael@0 952 is(hcard.org[0]["organization-name"], "W3C", "30-fn-org.2 - organization-name");
michael@0 953
michael@0 954 hcard = new hCard(document.getElementById("30-fn-org.3"));
michael@0 955
michael@0 956 is(hcard.fn, "W3C", "30-fn-org.3 - fn");
michael@0 957 is(hcard.org[0]["organization-name"], "W3C", "30-fn-org.3 - organization-name");
michael@0 958
michael@0 959 hcard = new hCard(document.getElementById("30-fn-org.4"));
michael@0 960
michael@0 961 is(hcard.fn, "World Wide Web Consortium", "30-fn-org.4 - fn");
michael@0 962 is(hcard.org[0]["organization-name"], "World Wide Web Consortium", "30-fn-org.4 - organization-name");
michael@0 963
michael@0 964 hcard = new hCard(document.getElementById("30-fn-org.5"));
michael@0 965
michael@0 966 is(hcard.fn, "World Wide Web Consortium", "30-fn-org.5 - fn");
michael@0 967 is(hcard.org[0]["organization-name"], "World Wide Web Consortium", "30-fn-org.5 - organization-name");
michael@0 968
michael@0 969 hcard = new hCard(document.getElementById("31-include.1"));
michael@0 970
michael@0 971 is(hcard.fn, "Brian Suda", "31-include.1 - fn");
michael@0 972 is(hcard.n["given-name"][0], "Brian", "31-include.1 - given-name");
michael@0 973 is(hcard.n["family-name"][0], "Suda", "31-include.1 - family-name");
michael@0 974 is(hcard.url, "http://suda.co.uk/", "31-include.1 - url");
michael@0 975 is(hcard.email[0].value, "correct@example.com", "31-include.1 - email");
michael@0 976 isnot(hcard.email[0].value, "incorrect@example.com", "31-include.1 - email");
michael@0 977
michael@0 978 hcard = new hCard(document.getElementById("31-include.2"));
michael@0 979
michael@0 980 is(hcard.fn, "Brian Suda", "31-include.2 - fn");
michael@0 981 is(hcard.n["given-name"][0], "Brian", "31-include.2 - given-name");
michael@0 982 is(hcard.n["family-name"][0], "Suda", "31-include.2 - family-name");
michael@0 983 is(hcard.url, "http://suda.co.uk/", "31-include.2 - url");
michael@0 984 is(hcard.email[0].value, "correct@example.com", "31-include.2 - email");
michael@0 985 isnot(hcard.email[0].value, "incorrect@example.com", "31-include.2 - email");
michael@0 986
michael@0 987 hcard = new hCard(document.getElementById("31-include.3"));
michael@0 988
michael@0 989 is(hcard.fn, "Brian Suda", "31-include.3 - fn");
michael@0 990 is(hcard.n["given-name"][0], "Brian", "31-include.3 - given-name");
michael@0 991 is(hcard.n["family-name"][0], "Suda", "31-include.3 - family-name");
michael@0 992 is(hcard.url, "http://suda.co.uk/", "31-include.3 - url");
michael@0 993 is(hcard.email[0].value, "correct@example.com", "31-include.3 - email");
michael@0 994 isnot(hcard.email[0].value, "incorrect@example.com", "31-include.3 - email");
michael@0 995
michael@0 996 hcard = new hCard(document.getElementById("31-include.4"));
michael@0 997
michael@0 998 is(hcard.fn, "Brian Suda", "31-include.3 - fn");
michael@0 999 is(hcard.n["given-name"][0], "Brian", "31-include.3 - given-name");
michael@0 1000 is(hcard.n["family-name"][0], "Suda", "31-include.3 - family-name");
michael@0 1001 is(hcard.url, "http://suda.co.uk/", "31-include.3 - url");
michael@0 1002
michael@0 1003 hcard = new hCard(document.getElementById("32-header.1"));
michael@0 1004
michael@0 1005 is(hcard.fn, "Brian Suda", "32-header.1 - fn");
michael@0 1006 is(hcard.n["given-name"][0], "Brian", "32-header.1 - given-name");
michael@0 1007 is(hcard.n["family-name"][0], "Suda", "32-header.1 - family-name");
michael@0 1008 is(hcard.org[0]["organization-name"], "example.org", "32-header.1 - organization-name");
michael@0 1009 is(hcard.url, "http://example.org/", "32-header.1 - url");
michael@0 1010
michael@0 1011 hcard = new hCard(document.getElementById("32-header.2"));
michael@0 1012
michael@0 1013 is(hcard.fn, "John Doe", "32-header.2 - fn");
michael@0 1014 is(hcard.n["given-name"][0], "John", "32-header.2 - given-name");
michael@0 1015 is(hcard.n["family-name"][0], "Doe", "32-header.2 - family-name");
michael@0 1016 is(hcard.org[0]["organization-name"], "example.org", "32-header.2 - organization-name");
michael@0 1017 is(hcard.url, "http://example.org/", "32-header.2 - url");
michael@0 1018
michael@0 1019 hcard = new hCard(document.getElementById("33-area.1"));
michael@0 1020
michael@0 1021 is(hcard.fn, "Joe Public", "33-area.1 - fn");
michael@0 1022 is(hcard.n["given-name"][0], "Joe", "33-area.1 - given-name");
michael@0 1023 is(hcard.n["family-name"][0], "Public", "33-area.1 - family-name");
michael@0 1024 is(hcard.url, "http://example.com/", "33-area.1 - url");
michael@0 1025 is(hcard.email[0].value, "joe@example.com", "33-area.1 - email");
michael@0 1026
michael@0 1027 hcard = new hCard(document.getElementById("33-area.2"));
michael@0 1028
michael@0 1029 is(hcard.fn, "Joe Public", "33-area.2 - fn");
michael@0 1030 is(hcard.url, "http://example.com/", "33-area.2 - url");
michael@0 1031 is(hcard.email[0].value, "joe@example.com", "33-area.2 - email");
michael@0 1032 is(hcard.org[0]["organization-name"], "Joe Public", "33-area.2 - organization-name");
michael@0 1033
michael@0 1034 hcard = new hCard(document.getElementById("33-area.3"));
michael@0 1035
michael@0 1036 is(hcard.fn, "Joe Public", "33-area.3 - fn");
michael@0 1037 is(hcard.url, "http://example.com/", "33-area.3 - url");
michael@0 1038 is(hcard.email[0].value, "joe@example.com", "33-area.3 - email");
michael@0 1039 is(hcard.org[0]["organization-name"], "Joe Public", "33-area.3 - organization-name");
michael@0 1040
michael@0 1041 hcard = new hCard(document.getElementById("33-area.4"));
michael@0 1042
michael@0 1043 is(hcard.fn, "Joe Public", "33-area.4 - fn");
michael@0 1044 is(hcard.url, "http://example.com/", "33-area.4 - url");
michael@0 1045 is(hcard.email[0].value, "joe@example.com", "33-area.4 - email");
michael@0 1046 is(hcard.org[0]["organization-name"], "Joe Public", "33-area.4 - organization-name");
michael@0 1047
michael@0 1048 hcard = new hCard(document.getElementById("33-area.5"));
michael@0 1049
michael@0 1050 is(hcard.fn, "Joe Public", "33-area.5 - fn");
michael@0 1051 is(hcard.url, "http://example.com/", "33-area.5 - url");
michael@0 1052 is(hcard.email[0].value, "joe@example.com", "33-area.5 - email");
michael@0 1053 is(hcard.org[0]["organization-name"], "Joe Public", "33-area.5 - organization-name");
michael@0 1054
michael@0 1055 hcard = new hCard(document.getElementById("34-notes"));
michael@0 1056
michael@0 1057 is(hcard.fn, "Joe Public", "34-notes - fn");
michael@0 1058 is(hcard.n["given-name"][0], "Joe", "34-notes - given-name");
michael@0 1059 is(hcard.n["family-name"][0], "Public", "34-notes - family-name");
michael@0 1060 is(hcard.note[0], "Note 1", "34-notes - note");
michael@0 1061 isnot(hcard.note[1], "Note 2", "34-notes - note");
michael@0 1062 is(hcard.note[1], "Note 3", "34-notes - note");
michael@0 1063 is(hcard.note[2], "Note 4 with a ; and a , to be escaped", "34-notes - note");
michael@0 1064
michael@0 1065 hcard = new hCard(document.getElementById("35-include-pattern.1"));
michael@0 1066
michael@0 1067 is(hcard.fn, "James Levine", "35-include-pattern.1 - fn");
michael@0 1068 is(hcard.n["given-name"][0], "James", "35-include-pattern.1 - given-name");
michael@0 1069 is(hcard.n["family-name"][0], "Levine", "35-include-pattern.1 - family-name");
michael@0 1070
michael@0 1071 hcard = new hCard(document.getElementById("35-include-pattern.2"));
michael@0 1072
michael@0 1073 is(hcard.fn, "James Levine", "35-include-pattern.2 - fn");
michael@0 1074 is(hcard.n["given-name"][0], "James", "35-include-pattern.2 - given-name");
michael@0 1075 is(hcard.n["family-name"][0], "Levine", "35-include-pattern.2 - family-name");
michael@0 1076 is(hcard.org[0]["organization-name"], "SimplyHired", "35-include-pattern.2 - organization-name");
michael@0 1077 is(hcard.title[0], "Microformat Brainstormer", "35-include-pattern.2 - title");
michael@0 1078
michael@0 1079 hcard = new hCard(document.getElementById("35-include-pattern.3"));
michael@0 1080
michael@0 1081 is(hcard.fn, "James Levine", "35-include-pattern.3 - fn");
michael@0 1082 is(hcard.n["given-name"][0], "James", "35-include-pattern.3 - given-name");
michael@0 1083 is(hcard.n["family-name"][0], "Levine", "35-include-pattern.3 - family-name");
michael@0 1084 is(hcard.org[0]["organization-name"], "SimplyHired", "35-include-pattern.3 - organization-name");
michael@0 1085 is(hcard.title[0], "Microformat Brainstormer", "35-include-pattern.3 - title");
michael@0 1086
michael@0 1087 hcard = new hCard(document.getElementById("36-categories.1"));
michael@0 1088
michael@0 1089 is(hcard.fn, "john doe", "36-categories.1 - fn");
michael@0 1090 is(hcard.n["given-name"][0], "john", "36-categories.1 - given-name");
michael@0 1091 is(hcard.n["family-name"][0], "doe", "36-categories.1 - family-name");
michael@0 1092 is(hcard.category[0], "C1", "36-categories.1 - category");
michael@0 1093 isnot(hcard.category[0], "C1a", "36-categories.1 - category");
michael@0 1094 is(hcard.category[1], "C2a", "36-categories.1 - category");
michael@0 1095 isnot(hcard.category[1], "C2", "36-categories.1 - category");
michael@0 1096 is(hcard.category[2], "C3", "36-categories.1 - category");
michael@0 1097 isnot(hcard.category[2], "C3a", "36-categories.1 - category");
michael@0 1098 isnot(hcard.category[2], "C3b", "36-categories.1 - category");
michael@0 1099 is(hcard.category[3], "C4", "36-categories.1 - category");
michael@0 1100 is(hcard.category[4], "C5", "36-categories.1 - category");
michael@0 1101 isnot(hcard.category[4], "C5a", "36-categories.1 - category");
michael@0 1102 isnot(hcard.category[4], "C5b", "36-categories.1 - category");
michael@0 1103 is(hcard.category[5], "C6", "36-categories.1 - category");
michael@0 1104 isnot(hcard.category[4], "C6a", "36-categories.1 - category");
michael@0 1105 isnot(hcard.category[4], "C6b", "36-categories.1 - category");
michael@0 1106 is(hcard.category[6], "C7", "36-categories.1 - category");
michael@0 1107 isnot(hcard.category[4], "C7a", "36-categories.1 - category");
michael@0 1108 isnot(hcard.category[4], "C7b", "36-categories.1 - category");
michael@0 1109 is(hcard.category[7], "C8", "36-categories.1 - category");
michael@0 1110 isnot(hcard.category[4], "C8a", "36-categories.1 - category");
michael@0 1111 isnot(hcard.category[4], "C8b", "36-categories.1 - category");
michael@0 1112 is(hcard.category[8], "C9", "36-categories.1 - category");
michael@0 1113 isnot(hcard.category[4], "C9a", "36-categories.1 - category");
michael@0 1114 isnot(hcard.category[4], "C9b", "36-categories.1 - category");
michael@0 1115
michael@0 1116 hcard = new hCard(document.getElementById("37-singleton"));
michael@0 1117
michael@0 1118 is(hcard.fn, "john doe 1", "37-singleton - fn");
michael@0 1119 is(hcard.n["given-name"][0], "john", "37-singleton - given-name");
michael@0 1120 is(hcard.n["family-name"][0], "doe", "37-singleton - family-name");
michael@0 1121 is(hcard.uid, "unique-id-1", "37-singleton - uid");
michael@0 1122 is(hcard.tz, "+0600", "37-singleton - tz");
michael@0 1123 is(hcard["sort-string"], "d", "37-singleton - sort-string");
michael@0 1124 is(hcard.geo.latitude, "123.45", "37-singleton - geo.latitude");
michael@0 1125 is(hcard.geo.longitude, "67.89", "37-singleton - geo.longitude");
michael@0 1126 is(hcard["class"], "public", "37-singleton - class");
michael@0 1127 is(hcard.bday, "2006-07-07", "37-singleton - bday");
michael@0 1128 is(hcard.rev, "2006-07-07", "37-singleton - rev");
michael@0 1129
michael@0 1130 hcard = new hCard(document.getElementById("38-uid.1"));
michael@0 1131
michael@0 1132 is(hcard.fn, "Ryan King", "38-uid.1 - fn");
michael@0 1133 is(hcard.n["given-name"][0], "Ryan", "38-uid.1 - given-name");
michael@0 1134 is(hcard.n["family-name"][0], "King", "38-uid.1 - family-name");
michael@0 1135 is(hcard.uid, "http://theryanking.com/contact/", "38-uid.1 - uid");
michael@0 1136 is(hcard.url[0], "http://theryanking.com/contact/", "38-uid.1 - url");
michael@0 1137
michael@0 1138 hcard = new hCard(document.getElementById("38-uid.2"));
michael@0 1139
michael@0 1140 is(hcard.fn, "Ryan King", "38-uid.2 - fn");
michael@0 1141 is(hcard.n["given-name"][0], "Ryan", "38-uid.2 - given-name");
michael@0 1142 is(hcard.n["family-name"][0], "King", "38-uid.2 - family-name");
michael@0 1143 is(hcard.uid, "http://mochi.test:8888/tests/browser/microformats/test/contact/", "38-uid.2 - uid");
michael@0 1144 is(hcard.url[0], "http://mochi.test:8888/tests/browser/microformats/test/contact/", "38-uid.2 - url");
michael@0 1145
michael@0 1146 hcard = new hCard(document.getElementById("38-uid.3"));
michael@0 1147
michael@0 1148 is(hcard.fn, "Ryan King", "38-uid.3 - fn");
michael@0 1149 is(hcard.n["given-name"][0], "Ryan", "38-uid.3 - given-name");
michael@0 1150 is(hcard.n["family-name"][0], "King", "38-uid.3 - family-name");
michael@0 1151 is(hcard.uid, "http://mochi.test:8888/tests/browser/microformats/test/contact/", "38-uid.3 - uid");
michael@0 1152 is(hcard.url[0], "http://mochi.test:8888/tests/browser/microformats/test/contact/", "38-uid.3 - url");
michael@0 1153
michael@0 1154 hcard = new hCard(document.getElementById("38-uid.4"));
michael@0 1155
michael@0 1156 is(hcard.fn, "Ryan King", "38-uid.4 - fn");
michael@0 1157 is(hcard.n["given-name"][0], "Ryan", "38-uid.4 - given-name");
michael@0 1158 is(hcard.n["family-name"][0], "King", "38-uid.4 - family-name");
michael@0 1159 is(hcard.uid, "http://theryanking.com/contact/", "38-uid.4 - uid");
michael@0 1160 is(hcard.url[0], "http://theryanking.com/contact/", "38-uid.4 - url");
michael@0 1161
michael@0 1162 hcard = new hCard(document.getElementById("39-noteHTML"));
michael@0 1163
michael@0 1164 is(hcard.note[0], "Note", "39-noteHTML - note");
michael@0 1165 is(hcard.note[0].toHTML(), "<b>Note</b>", "39-noteHTML - note as HTML");
michael@0 1166 is(hcard.note[0].match("Note"), "Note", "39-noteHTML - match in note");
michael@0 1167
michael@0 1168 hcard = new hCard(document.getElementById("email-type"));
michael@0 1169 is(hcard.email[0].type, "internet", "email - type no value (type)");
michael@0 1170 is(hcard.email[0].value, "john@example.com", "email - type no value (value)");
michael@0 1171 }
michael@0 1172
michael@0 1173 </script>
michael@0 1174 </pre>
michael@0 1175 </body>
michael@0 1176 </html>

mercurial