diff --git a/toolkit/components/microformats/src/Microformats.js b/toolkit/components/microformats/src/Microformats.js index aab258b8a42..812991d8a61 100644 --- a/toolkit/components/microformats/src/Microformats.js +++ b/toolkit/components/microformats/src/Microformats.js @@ -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"])) { diff --git a/toolkit/components/microformats/tests/Makefile.in b/toolkit/components/microformats/tests/Makefile.in index 8612cdf11e6..fcbc190518e 100644 --- a/toolkit/components/microformats/tests/Makefile.in +++ b/toolkit/components/microformats/tests/Makefile.in @@ -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) diff --git a/toolkit/components/microformats/tests/test_Microformats_adr.html b/toolkit/components/microformats/tests/test_Microformats_adr.html new file mode 100644 index 00000000000..18b80ada7d3 --- /dev/null +++ b/toolkit/components/microformats/tests/test_Microformats_adr.html @@ -0,0 +1,45 @@ + +
+ ++ ++ + diff --git a/toolkit/components/microformats/tests/test_Microformats_hCard.html b/toolkit/components/microformats/tests/test_Microformats_hCard.html index 56847874491..67337b34804 100644 --- a/toolkit/components/microformats/tests/test_Microformats_hCard.html +++ b/toolkit/components/microformats/tests/test_Microformats_hCard.html @@ -1,7 +1,7 @@ -