зеркало из https://github.com/mozilla/pjs.git
412660 - a=sayrer, a=schrep - Handle the adr microformat better when attempting to create a display string
This commit is contained in:
Родитель
af2e6543e2
Коммит
a0e193cb79
|
@ -987,18 +987,19 @@ adr.prototype.toString = function() {
|
|||
var start_parens = false;
|
||||
if (this["street-address"]) {
|
||||
address_text += this["street-address"][0];
|
||||
address_text += " ";
|
||||
} else if (this["extended-address"]) {
|
||||
address_text += this["extended-address"];
|
||||
}
|
||||
if (this["locality"]) {
|
||||
if (this["street-address"]) {
|
||||
address_text += "(";
|
||||
if (this["street-address"] || this["extended-address"]) {
|
||||
address_text += " (";
|
||||
start_parens = true;
|
||||
}
|
||||
address_text += this["locality"];
|
||||
}
|
||||
if (this["region"]) {
|
||||
if ((this["street-address"]) && (!start_parens)) {
|
||||
address_text += "(";
|
||||
if ((this["street-address"] || this["extended-address"]) && (!start_parens)) {
|
||||
address_text += " (";
|
||||
start_parens = true;
|
||||
} else if (this["locality"]) {
|
||||
address_text += ", ";
|
||||
|
@ -1006,8 +1007,8 @@ adr.prototype.toString = function() {
|
|||
address_text += this["region"];
|
||||
}
|
||||
if (this["country-name"]) {
|
||||
if ((this["street-address"]) && (!start_parens)) {
|
||||
address_text += "(";
|
||||
if ((this["street-address"] || this["extended-address"]) && (!start_parens)) {
|
||||
address_text += " (";
|
||||
start_parens = true;
|
||||
address_text += this["country-name"];
|
||||
} else if ((!this["locality"]) && (!this["region"])) {
|
||||
|
|
|
@ -48,6 +48,7 @@ _TEST_FILES = \
|
|||
test_Microformats_hCard.html \
|
||||
test_Microformats_geo.html \
|
||||
test_Microformats_hCalendar.html \
|
||||
test_Microformats_adr.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||
<title>Testing Microformats.js (adr)</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.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>
|
||||
<div id="content" style="display: none">
|
||||
<div class="adr" id="01-extended-address">
|
||||
<span class="extended-address">Park Bench</span>
|
||||
</div>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
test_Microformats();
|
||||
test_adr();
|
||||
|
||||
function test_Microformats() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
Components.utils.import("resource://gre/modules/Microformats.js");
|
||||
|
||||
ok(Microformats, "Check global access to Microformats");
|
||||
};
|
||||
|
||||
function test_adr() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
Components.utils.import("resource://gre/modules/Microformats.js");
|
||||
|
||||
var address;
|
||||
|
||||
address = new adr(document.getElementById("01-extended-address"));
|
||||
|
||||
is(address.toString(), "Park Bench", "01-extended-address");
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -1,7 +1,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||
<title>Testing Microformats.js</title>
|
||||
<title>Testing Microformats.js (hCard)</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
|
|
Загрузка…
Ссылка в новой задаче