index.html 149 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981
<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html lang="en" dir="ltr">
<head>
    <title>Contacts API</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
    
    
    
    <style type="text/css">
      /* ReSpec.js CSS optimizations (Richard Tibbett) */
      div.example {
          border-top: 1px solid #ff4500;
          border-bottom: 1px solid #ff4500;
          background: #fff;
          padding:    1em;
          font-size: 0.9em;
          margin-top: 1em;
      }
      div.example::before {
          content:    "Example";
          display:    block;
          width:      150px;
          background: #ff4500;
          color:  #fff;
          font-family:    initial;
          padding:    3px;
          padding-left: 5px;
          font-weight:    bold;
          margin: -1em 0 1em -1em;
      }

      /* Clean up pre.idl */
      pre.idl::before {
          font-size:0.9em;
      }

      /* Add better spacing to sections */
      section, .section {
          margin-bottom: 2em;
      }

      /* Reduce note & issue render size */
      .note, .issue {
          font-size:0.8em;
      }

      /* Add addition spacing to <ol> and <ul> for rule definition */
      ol.rule li, ul.rule li {
          padding:0.2em;
      }
      /*
      IDL wrapping fix
      http://perishablepress.com/press/2010/06/01/wrapping-content/

      [RB] This isn't a fix, it kills indentation!

      pre.idl {
          white-space: pre;
          white-space: pre-wrap;
          white-space: pre-line;
          white-space: -pre-wrap;
          white-space: -o-pre-wrap;
          white-space: -moz-pre-wrap;
          white-space: -hp-pre-wrap;
          word-wrap: break-word;
      }
      */
    </style>
  <style type="text/css">
/*****************************************************************
 * ReSpec CSS
 * Robin Berjon (robin at berjon dot com)
 * v0.05 - 2009-07-31
 *****************************************************************/


/* --- INLINES --- */
em.rfc2119 { 
    text-transform:     lowercase;
    font-variant:       small-caps;
    font-style:         normal;
    color:              #900;
}

h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
    border: none;
}

dfn {
    font-weight:    bold;
}

a.internalDFN {
    color:  inherit;
    border-bottom:  1px solid #99c;
    text-decoration:    none;
}

a.externalDFN {
    color:  inherit;
    border-bottom:  medium dotted #ccc;
    text-decoration:    none;
}

a.bibref {
    text-decoration:    none;
}

code {
    color:  #ff4500;
}


/* --- WEB IDL --- */
pre.idl {
    border-top: 1px solid #90b8de;
    border-bottom: 1px solid #90b8de;
    padding:    1em;
    line-height:    120%;
}

pre.idl::before {
    content:    "WebIDL";
    display:    block;
    width:      150px;
    background: #90b8de;
    color:  #fff;
    font-family:    initial;
    padding:    3px;
    font-weight:    bold;
    margin: -1em 0 1em -1em;
}

.idlType {
    color:  #ff4500;
    font-weight:    bold;
    text-decoration:    none;
}

/*.idlModule*/
/*.idlModuleID*/
/*.idlInterface*/
.idlInterfaceID {
    font-weight:    bold;
    color:  #005a9c;
}

.idlSuperclass {
    font-style: italic;
    color:  #005a9c;
}

/*.idlAttribute*/
.idlAttrType, .idlFieldType {
    color:  #005a9c;
}
.idlAttrName, .idlFieldName {
    color:  #ff4500;
}
.idlAttrName a, .idlFieldName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlMethod*/
.idlMethType {
    color:  #005a9c;
}
.idlMethName {
    color:  #ff4500;
}
.idlMethName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlParam*/
.idlParamType {
    color:  #005a9c;
}
.idlParamName {
    font-style: italic;
}

.extAttr {
    color:  #666;
}

/*.idlConst*/
.idlConstType {
    color:  #005a9c;
}
.idlConstName {
    color:  #ff4500;
}
.idlConstName a {
    color:  #ff4500;
    border-bottom:  1px dotted #ff4500;
    text-decoration: none;
}

/*.idlException*/
.idlExceptionID {
    font-weight:    bold;
    color:  #c00;
}

.idlTypedefID, .idlTypedefType {
    color:  #005a9c;
}

.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
    color:  #c00;
    font-weight:    normal;
}

.excName a {
    font-family:    monospace;
}

.idlRaises a.idlType, .excName a.idlType {
    border-bottom:  1px dotted #c00;
}

.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
    width:  45px;
    text-align: center;
}
.excGetSetTrue, .prmNullTrue, .prmOptTrue { color:  #0c0; }
.excGetSetFalse, .prmNullFalse, .prmOptFalse { color:  #c00; }

.idlImplements a {
    font-weight:    bold;
}

dl.attributes, dl.methods, dl.constants, dl.fields {
    margin-left:    2em;
}

.attributes dt, .methods dt, .constants dt, .fields dt {
    font-weight:    normal;
}

.attributes dt code, .methods dt code, .constants dt code, .fields dt code {
    font-weight:    bold;
    color:  #000;
    font-family:    monospace;
}

.attributes dt code, .fields dt code {
    background:  #ffffd2;
}

.attributes dt .idlAttrType code, .fields dt .idlFieldType code {
    color:  #005a9c;
    background:  transparent;
    font-family:    inherit;
    font-weight:    normal;
    font-style: italic;
}

.methods dt code {
    background:  #d9e6f8;
}

.constants dt code {
    background:  #ddffd2;
}

.attributes dd, .methods dd, .constants dd, .fields dd {
    margin-bottom:  1em;
}

table.parameters, table.exceptions {
    border-spacing: 0;
    border-collapse:    collapse;
    margin: 0.5em 0;
    width:  100%;
}
table.parameters { border-bottom:  1px solid #90b8de; }
table.exceptions { border-bottom:  1px solid #deb890; }

.parameters th, .exceptions th {
    color:  #fff;
    padding:    3px 5px;
    text-align: left;
    font-family:    initial;
    font-weight:    normal;
    text-shadow:    #666 1px 1px 0;
}
.parameters th { background: #90b8de; }
.exceptions th { background: #deb890; }

.parameters td, .exceptions td {
    padding:    3px 10px;
    border-top: 1px solid #ddd;
    vertical-align: top;
}

.parameters tr:first-child td, .exceptions tr:first-child td {
    border-top: none;
}

.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
    width:  100px;
}

.parameters td.prmType {
    width:  120px;
}

table.exceptions table {
    border-spacing: 0;
    border-collapse:    collapse;
    width:  100%;
}

/* --- TOC --- */
.toc a {
    text-decoration:    none;
}

a .secno {
    color:  #000;
}

/* --- TABLE --- */
table.simple {
    border-spacing: 0;
    border-collapse:    collapse;
    border-bottom:  3px solid #005a9c;
}

.simple th {
    background: #005a9c;
    color:  #fff;
    padding:    3px 5px;
    text-align: left;
}

.simple th[scope="row"] {
    background: inherit;
    color:  inherit;
    border-top: 1px solid #ddd;
}

.simple td {
    padding:    3px 10px;
    border-top: 1px solid #ddd;
}

.simple tr:nth-child(even) {
    background: #f0f6ff;
}

/* --- DL --- */
.section dd > p:first-child {
    margin-top: 0;
}

.section dd > p:last-child {
    margin-bottom: 0;
}

.section dd {
    margin-bottom:  1em;
}

.section dl.attrs dd, .section dl.eldef dd {
    margin-bottom:  0;
}

/* --- EXAMPLES --- */
pre.example {
    border-top: 1px solid #ff4500;
    border-bottom: 1px solid #ff4500;
    padding:    1em;
    margin-top: 1em;
}

pre.example::before {
    content:    "Example";
    display:    block;
    width:      150px;
    background: #ff4500;
    color:  #fff;
    font-family:    initial;
    padding:    3px;
    font-weight:    bold;
    margin: -1em 0 1em -1em;
}

/* --- EDITORIAL NOTES --- */
.issue {
    padding:    1em;
    margin: 1em 0em 0em;
    border: 1px solid #f00;
    background: #ffc;
}

.issue::before {
    content:    "Issue";
    display:    block;
    width:  150px;
    margin: -1.5em 0 0.5em 0;
    font-weight:    bold;
    border: 1px solid #f00;
    background: #fff;
    padding:    3px 1em;
}

.note {
    margin: 1em 0em 0em;
    padding:    1em;
    border: 2px solid #cff6d9;
    background: #e2fff0;
}

.note::before {
    content:    "Note";
    display:    block;
    width:  150px;
    margin: -1.5em 0 0.5em 0;
    font-weight:    bold;
    border: 1px solid #cff6d9;
    background: #fff;
    padding:    3px 1em;
}

/* --- Best Practices --- */
div.practice {
    border: solid #bebebe 1px;
    margin: 2em 1em 1em 2em;
}

span.practicelab {
    margin: 1.5em 0.5em 1em 1em;
    font-weight: bold;
    font-style: italic;
}

span.practicelab   { background: #dfffff; }

span.practicelab {
    position: relative;
    padding: 0 0.5em;
    top: -1.5em;
}

p.practicedesc {
    margin: 1.5em 0.5em 1em 1em;
}

@media screen {
    p.practicedesc {
        position: relative;
        top: -2em;
        padding: 0;
        margin: 1.5em 0.5em -1em 1em;
}

/* --- SYNTAX HIGHLIGHTING --- */
pre.sh_sourceCode {
  background-color: white;
  color: black;
  font-style: normal;
  font-weight: normal;
}

pre.sh_sourceCode .sh_keyword { color: #005a9c; font-weight: bold; }           /* language keywords */
pre.sh_sourceCode .sh_type { color: #666; }                            /* basic types */
pre.sh_sourceCode .sh_usertype { color: teal; }                             /* user defined types */
pre.sh_sourceCode .sh_string { color: red; font-family: monospace; }        /* strings and chars */
pre.sh_sourceCode .sh_regexp { color: orange; font-family: monospace; }     /* regular expressions */
pre.sh_sourceCode .sh_specialchar { color: 	#ffc0cb; font-family: monospace; }  /* e.g., \n, \t, \\ */
pre.sh_sourceCode .sh_comment { color: #A52A2A; font-style: italic; }         /* comments */
pre.sh_sourceCode .sh_number { color: purple; }                             /* literal numbers */
pre.sh_sourceCode .sh_preproc { color: #00008B; font-weight: bold; }       /* e.g., #include, import */
pre.sh_sourceCode .sh_symbol { color: blue; }                            /* e.g., *, + */
pre.sh_sourceCode .sh_function { color: black; font-weight: bold; }         /* function calls and declarations */
pre.sh_sourceCode .sh_cbracket { color: red; }                              /* block brackets (e.g., {, }) */
pre.sh_sourceCode .sh_todo { font-weight: bold; background-color: #00FFFF; }   /* TODO and FIXME */

/* Predefined variables and functions (for instance glsl) */
pre.sh_sourceCode .sh_predef_var { color: #00008B; }
pre.sh_sourceCode .sh_predef_func { color: #00008B; font-weight: bold; }

/* for OOP */
pre.sh_sourceCode .sh_classname { color: teal; }

/* line numbers (not yet implemented) */
pre.sh_sourceCode .sh_linenum { display: none; }

/* Internet related */
pre.sh_sourceCode .sh_url { color: blue; text-decoration: underline; font-family: monospace; }

/* for ChangeLog and Log files */
pre.sh_sourceCode .sh_date { color: blue; font-weight: bold; }
pre.sh_sourceCode .sh_time, pre.sh_sourceCode .sh_file { color: #00008B; font-weight: bold; }
pre.sh_sourceCode .sh_ip, pre.sh_sourceCode .sh_name { color: #006400; }

/* for Prolog, Perl... */
pre.sh_sourceCode .sh_variable { color: #006400; }

/* for LaTeX */
pre.sh_sourceCode .sh_italics { color: #006400; font-style: italic; }
pre.sh_sourceCode .sh_bold { color: #006400; font-weight: bold; }
pre.sh_sourceCode .sh_underline { color: #006400; text-decoration: underline; }
pre.sh_sourceCode .sh_fixed { color: green; font-family: monospace; }
pre.sh_sourceCode .sh_argument { color: #006400; }
pre.sh_sourceCode .sh_optionalargument { color: purple; }
pre.sh_sourceCode .sh_math { color: orange; }
pre.sh_sourceCode .sh_bibtex { color: blue; }

/* for diffs */
pre.sh_sourceCode .sh_oldfile { color: orange; }
pre.sh_sourceCode .sh_newfile { color: #006400; }
pre.sh_sourceCode .sh_difflines { color: blue; }

/* for css */
pre.sh_sourceCode .sh_selector { color: purple; }
pre.sh_sourceCode .sh_property { color: blue; }
pre.sh_sourceCode .sh_value { color: #006400; font-style: italic; }

/* other */
pre.sh_sourceCode .sh_section { color: black; font-weight: bold; }
pre.sh_sourceCode .sh_paren { color: red; }
pre.sh_sourceCode .sh_attribute { color: #006400; }

</style><link charset="utf-8" type="text/css" rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-WD"></head>

  <body style="display: inherit;"><div class="head"><p><a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72"></a></p><h1 class="title" id="title">Contacts API</h1><h2 id="w3c-working-draft-16-june-2011">W3C Working Draft 16 June 2011</h2><dl><dt>This version:</dt><dd><a href="http://www.w3.org/TR/2011/WD-contacts-api-20110616/">http://www.w3.org/TR/2011/WD-contacts-api-20110616/</a></dd><dt>Latest published version:</dt><dd><a href="http://www.w3.org/TR/contacts-api/">http://www.w3.org/TR/contacts-api/</a></dd><dt>Latest editor's draft:</dt><dd><a href="http://dev.w3.org/2009/dap/contacts/">http://dev.w3.org/2009/dap/contacts/</a></dd><dt>Previous version:</dt><dd><a href="http://www.w3.org/TR/2010/WD-contacts-api-20101209/">http://www.w3.org/TR/2010/WD-contacts-api-20101209/</a></dd><dt>Editor:</dt><dd><a href="http://richt.me">Richard Tibbett</a>, <a href="http://www.opera.com">Opera Software ASA</a></dd>
</dl><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2011 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p><hr></div>
    <div class="introductory section" id="abstract"><h2>Abstract</h2>
      <p>
        The Contacts API defines the high-level interfaces required to obtain read access to a user's unified
        address book.
      </p>
      <p>
        This API includes the following key interfaces:
      </p>
      <ul>
        <li>A <a class="idlType" href="#idl-def-Contacts"><code>Contacts</code></a> interface, which provides the method
        needed to access a user's unified address book.</li>
        <li>A <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> interface, which captures the individual
        contact information that can be returned following a successful read operation.</li>
      </ul>
    </div><div id="sotd" class="introductory section"><h2>Status of This Document</h2><p><em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a> at http://www.w3.org/TR/.</em></p>
      <p>
        This document represents the early consensus of the group on the scope and features of the proposed
        Contacts API. Issues and editors note in the document highlight some of the points on which the group is
        still working and would particularly like to get feedback.
      </p>
    <p>This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs and Policy Working Group</a> as a Last Call Working Draft. This document is intended to become a W3C Recommendation. If you wish to make comments regarding this document, please send them to <a href="mailto:public-device-apis@w3.org">public-device-apis@w3.org</a> (<a href="mailto:public-device-apis-request@w3.org?subject=subscribe">subscribe</a>, <a href="http://lists.w3.org/Archives/Public/public-device-apis/">archives</a>). The Last Call period ends 14 July 2011. All feedback is welcome.</p><p>Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.</p><p>This is a Last Call Working Draft and thus the Working Group has determined that this document has satisfied the relevant technical requirements and is sufficiently stable to advance through the Technical Recommendation process.</p><p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>. W3C maintains a <a href="http://www.w3.org/2004/01/pp-impl/43696/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.</p></div><div class="section" id="toc"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a class="tocxref" href="#introduction"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a class="tocxref" href="#conformance"><span class="secno">2. </span>Conformance</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#terminology"><span class="secno">2.1 </span>Terminology</a></li></ul></li><li class="tocline"><a class="tocxref" href="#security-and-privacy-considerations"><span class="secno">3. </span>Security and Privacy Considerations</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#privacy-considerations-for-implementors-of-the-contacts-api"><span class="secno">3.1 </span>Privacy considerations for implementors of the Contacts API</a></li><li class="tocline"><a class="tocxref" href="#privacy-considerations-for-recipients-of-contact-information"><span class="secno">3.2 </span>Privacy considerations for recipients of contact information</a></li><li class="tocline"><a class="tocxref" href="#additional-implementation-considerations"><span class="secno">3.3 </span>Additional implementation considerations</a></li></ul></li><li class="tocline"><a class="tocxref" href="#api-description"><span class="secno">4. </span>API Description</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#servicecontacts-interface"><span class="secno">4.1 </span><span class="idlType formerLink idlType"><code>ServiceContacts</code></span> interface</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes"><span class="secno">4.1.1 </span>Attributes</a></li></ul></li><li class="tocline"><a class="tocxref" href="#contacts-interface"><span class="secno">4.2 </span><span class="idlType formerLink idlType"><code>Contacts</code></span> interface</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#methods"><span class="secno">4.2.1 </span>Methods</a></li></ul></li><li class="tocline"><a class="tocxref" href="#contact-interface"><span class="secno">4.3 </span><span class="idlType formerLink idlType"><code>Contact</code></span> interface</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes-1"><span class="secno">4.3.1 </span>Attributes</a></li></ul></li><li class="tocline"><a class="tocxref" href="#contactname-interface"><span class="secno">4.4 </span><span class="idlType formerLink idlType"><code>ContactName</code></span> interface</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes-2"><span class="secno">4.4.1 </span>Attributes</a></li></ul></li><li class="tocline"><a class="tocxref" href="#contactfield-interface"><span class="secno">4.5 </span><span class="idlType formerLink idlType"><code>ContactField</code></span> interface</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes-3"><span class="secno">4.5.1 </span>Attributes</a></li></ul></li><li class="tocline"><a class="tocxref" href="#contactaddress-interface"><span class="secno">4.6 </span><span class="idlType formerLink idlType"><code>ContactAddress</code></span> interface</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes-4"><span class="secno">4.6.1 </span>Attributes</a></li></ul></li><li class="tocline"><a class="tocxref" href="#contactorganization-interface"><span class="secno">4.7 </span><span class="idlType formerLink idlType"><code>ContactOrganization</code></span> interface</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes-5"><span class="secno">4.7.1 </span>Attributes</a></li></ul></li><li class="tocline"><a class="tocxref" href="#contactfindoptions-interface"><span class="secno">4.8 </span><span class="idlType formerLink idlType"><code>ContactFindOptions</code></span> interface</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes-6"><span class="secno">4.8.1 </span>Attributes</a></li></ul></li><li class="tocline"><a class="tocxref" href="#contactfindcb-interface"><span class="secno">4.9 </span><span class="idlType formerLink idlType"><code>ContactFindCB</code></span> interface</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#methods-1"><span class="secno">4.9.1 </span>Methods</a></li><li class="tocline"><a class="tocxref" href="#event-handler-attributes"><span class="secno">4.9.2 </span>Event Handler Attributes</a></li></ul></li><li class="tocline"><a class="tocxref" href="#contacterrorcb-interface"><span class="secno">4.10 </span><span class="idlType formerLink idlType"><code>ContactErrorCB</code></span> interface</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#methods-2"><span class="secno">4.10.1 </span>Methods</a></li><li class="tocline"><a class="tocxref" href="#event-handler-attributes-1"><span class="secno">4.10.2 </span>Event Handler Attributes</a></li></ul></li><li class="tocline"><a class="tocxref" href="#contacterror-interface"><span class="secno">4.11 </span><span class="idlType formerLink idlType"><code>ContactError</code></span> interface</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#attributes-7"><span class="secno">4.11.1 </span>Attributes</a></li><li class="tocline"><a class="tocxref" href="#constants"><span class="secno">4.11.2 </span>Constants</a></li></ul></li></ul></li><li class="tocline"><a class="tocxref" href="#contact-search-processing"><span class="secno">5. </span><span class="formerLink">Contact Search Processing</span></a><ul class="toc"><li class="tocline"><a class="tocxref" href="#search-qualifiers"><span class="secno">5.1 </span>Search Qualifiers</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#advanced-search-qualifiers"><span class="secno">5.1.1 </span>Advanced Search Qualifiers</a></li></ul></li><li class="tocline"><a class="tocxref" href="#options-processing"><span class="secno">5.2 </span>Options Processing</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#search-cardinality"><span class="secno">5.2.1 </span>Search Cardinality</a></li><li class="tocline"><a class="tocxref" href="#search-filters"><span class="secno">5.2.2 </span>Search Filters</a></li></ul></li></ul></li><li class="tocline"><a class="tocxref" href="#extended-contact-properties-and-parameters"><span class="secno">6. </span>Extended Contact Properties and Parameters</a></li><li class="tocline"><a class="tocxref" href="#api-invocation-via-dom-events"><span class="secno">7. </span>API Invocation via DOM Events</a></li><li class="tocline"><a class="tocxref" href="#user-interaction-guidelines"><span class="secno">A. </span>User Interaction Guidelines</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#accessing-contact-information---example--1"><span class="secno">A.1 </span>Accessing Contact Information - Example #1</a></li><li class="tocline"><a class="tocxref" href="#accessing-contact-information---example--2"><span class="secno">A.2 </span>Accessing Contact Information - Example #2</a></li></ul></li><li class="tocline"><a class="tocxref" href="#adding-and-updating-contacts"><span class="secno">B. </span>Adding and Updating Contacts</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#adding-a-new-contact"><span class="secno">B.1 </span>Adding a new Contact</a></li><li class="tocline"><a class="tocxref" href="#updating-an-existing-contact"><span class="secno">B.2 </span>Updating an existing Contact</a></li></ul></li><li class="tocline"><a class="tocxref" href="#references"><span class="secno">C. </span>References</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#normative-references"><span class="secno">C.1 </span>Normative references</a></li><li class="tocline"><a class="tocxref" href="#informative-references"><span class="secno">C.2 </span>Informative references</a></li></ul></li></ul></div>

    

    <div id="introduction" class="informative section">
      <!--OddPage--><h2><span class="secno">1. </span>Introduction</h2><p><em>This section is non-normative.</em></p>
      <p>
        Every operating system and a large number of web-based service providers have different ways of
        representing address book information. Most users are required to maintain a plurality of contact lists
        which leads to multiple copies of address book data. This in turn
        often leads to disjointed and inconsistent information being stored across a user's
        address book providers.
      </p>
      <p>
        When sharing contact data with third parties users are, more often than not, required to hand over access to
        their whole address book. Users are implicitly required to trust third parties with all of their data
        when, in reality, the user may only wish, or need, to share a subset of their address book information so
        that an application can fulfil its purpose.
      </p>
      <p>
        This specification defines the concept of a user's unified address book - where address book data may
        be sourced from a plurality of sources - both online and locally. It then defines the
        interfaces through which third party applications can access a user's unified address book, with explicit user
        permission and filtering. The focus of this data sharing is on making the user aware of the data that
        they will share and putting them at the centre of the data sharing process; free to select both the
        extent to which they share their address book information and the ability to restrict which pieces of
        information related to which contact gets shared.
      </p>
      <p>
        A set of <a href="#security-and-privacy-considerations">Security and Privacy Considerations</a> are
        presented for the discretion of both implementors of the Contacts API and recipients of contact
        information (i.e. web pages). This specification provides a set of non-normative 
        <a href="#user-interaction-guidelines">User Interaction Guidelines</a> demonstrating an example user experience
        that is compliant with the Security and Privacy Considerations described herein.
      </p>
      <p>
        This specification also provides informative examples illustrating how to 
        <a href="#adding-and-updating-contacts">add and update contact information</a>, utilising existing web platform
        APIs.
      </p>
      <p>
        The following code illustrates how to obtain contact information from a user's address book:
      </p>
      <pre class="example sh_javascript_dom sh_sourceCode"><span class="sh_keyword">function</span> <span class="sh_function">success</span> <span class="sh_symbol">(</span>contacts<span class="sh_symbol">)</span> <span class="sh_cbracket">{</span>
    <span class="sh_comment">// do something with resulting contact objects</span>
    <span class="sh_keyword">for</span> <span class="sh_symbol">(</span><span class="sh_keyword">var</span> i <span class="sh_keyword">in</span> contacts<span class="sh_symbol">)</span> <span class="sh_predef_func">alert</span><span class="sh_symbol">(</span>contacts<span class="sh_symbol">[</span>i<span class="sh_symbol">].</span><span class="sh_predef_var">name</span><span class="sh_symbol">);</span>
    <span class="sh_comment">// ...</span>
<span class="sh_cbracket">}</span>

<span class="sh_keyword">function</span> <span class="sh_function">error</span> <span class="sh_symbol">(</span>err<span class="sh_symbol">)</span> <span class="sh_cbracket">{</span>
    <span class="sh_comment">// do something with resulting error</span>
    <span class="sh_predef_func">alert</span><span class="sh_symbol">(</span>err<span class="sh_symbol">.</span>code<span class="sh_symbol">);</span>
    <span class="sh_comment">// ...</span>
<span class="sh_cbracket">}</span>

<span class="sh_comment">// Perform an address book search. Obtain the 'name' and 'emails' properties </span>
<span class="sh_comment">// and initially filter the list to Contact records containing 'Bob':</span>
<span class="sh_predef_var">navigator</span><span class="sh_symbol">.</span>contacts<span class="sh_symbol">.</span><span class="sh_predef_func">find</span><span class="sh_symbol">(</span>  <span class="sh_symbol">[</span><span class="sh_string">'name'</span><span class="sh_symbol">,</span> <span class="sh_string">'emails'</span><span class="sh_symbol">],</span> success<span class="sh_symbol">,</span> error<span class="sh_symbol">,</span> <span class="sh_cbracket">{</span>filter<span class="sh_symbol">:</span> <span class="sh_string">'Bob'</span><span class="sh_cbracket">}</span> <span class="sh_symbol">);</span>
<span class="sh_comment">// ..is equivalent to: navigator.contacts(/* parameters */)</span></pre>
    </div>

    <div class="section" id="conformance"><!--OddPage--><h2><span class="secno">2. </span>Conformance</h2><p>As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.</p>
<p>The key words <em title="must" class="rfc2119">must</em>, <em title="must not" class="rfc2119">must not</em>, <em title="required" class="rfc2119">required</em>, <em title="should" class="rfc2119">should</em>, <em title="should not" class="rfc2119">should not</em>, <em title="recommended" class="rfc2119">recommended</em>, <em title="may" class="rfc2119">may</em>, and <em title="optional" class="rfc2119">optional</em> in this specification are to be interpreted as described in [<cite><a href="#bib-RFC2119" rel="biblioentry" class="bibref">RFC2119</a></cite>].</p>

      <p>
        This specification defines conformance criteria that apply to a single product: the 
        <dfn id="ua">user agent</dfn> that implements the interfaces that it contains.
      </p>
      <p>
        Implementations that use ECMAScript to implement the APIs defined in this specification must implement
        them in a manner consistent with the ECMAScript Bindings defined in the Web IDL specification
        [<cite><a href="#bib-WEBIDL" rel="biblioentry" class="bibref">WEBIDL</a></cite>], as this specification uses that specification and terminology.
      </p>
      <p>
        A conforming implementation is required to implement all fields defined in this specification.
      </p>

      <div class="section" id="terminology">
        <h3><span class="secno">2.1 </span>Terminology</h3>
        <p>
          The terms <dfn id="dfn-document-base-url">document base URL</dfn>, <dfn id="dfn-browsing-context">browsing context</dfn>, <dfn id="dfn-event-handler-attribute">event handler attribute</dfn>, 
          <dfn id="dfn-event-handler-event-type">event handler event type</dfn>, <dfn id="dfn-task">task</dfn>, <dfn id="dfn-task-source">task source</dfn> and <dfn id="dfn-task-queues">task queues</dfn> 
          are defined by the HTML5 specification [<cite><a href="#bib-HTML5" rel="biblioentry" class="bibref">HTML5</a></cite>].
        </p>
        <p>
          The <a class="internalDFN" href="#dfn-task-source">task source</a> used by this specification is the <dfn id="dfn-device-task-source">device task source</dfn>.
        </p>
        <p>
          To <dfn id="dfn-dispatch-a-success-event">dispatch a <code>success</code> event</dfn> means that an event with the name
          <code>success</code>, which does not bubble and is not cancellable, and which uses the
          <code>Event</code> interface, is to be dispatched at the <a class="idlType" href="#idl-def-ContactFindCB"><code>ContactFindCB</code></a> object.
        </p>
        <p>
          To <dfn id="dfn-dispatch-an-error-event">dispatch an <code>error</code> event</dfn> means that an event with the name
          <code>error</code>, which does not bubble and is not cancellable, and which uses the <code>Event</code>
          interface, is to be dispatched at the <a class="idlType" href="#idl-def-ContactErrorCB"><code>ContactErrorCB</code></a> object.
        </p>
      </div>
    </div>

    <div class="section" id="security-and-privacy-considerations">
      <!--OddPage--><h2><span class="secno">3. </span>Security and Privacy Considerations</h2>
      <p>
        The API defined in this specification can be used to find contact information from a user's address
        books. This discloses information related to a user's contacts such as their phone numbers, email
        addresses and other personally identifying information. The distribution of this information could
        potentially compromise the user's privacy, or the user's contacts' privacy. A conforming implementation
        of this specification <em title="must" class="rfc2119">must</em> provide a mechanism that protects the user's privacy and this mechanism should
        ensure that no contact information is retrievable without the user's express permission.
      </p>
      <div class="section" id="privacy-considerations-for-implementors-of-the-contacts-api">
        <h3><span class="secno">3.1 </span>Privacy considerations for implementors of the Contacts API</h3>
        <p>
          A <a class="product-ua" href="#ua">user agent</a> <em title="must not" class="rfc2119">must not</em> provide contact information to Web sites without the express
          permission of the user. A <a class="internalDFN" href="#ua">user agent</a> <em title="must" class="rfc2119">must</em> acquire permission through a user interface, unless
          they have prearranged trust relationships with users, as described below. The user interface <em title="must" class="rfc2119">must</em>
          include the <a class="internalDFN" href="#dfn-document-base-url">document base URL</a>. Those permissions that are acquired through the user interface
          and that are preserved beyond the current browsing session (i.e. beyond the time when the <a class="internalDFN" href="#dfn-browsing-context">browsing
          context</a> is navigated to another URL) <em title="must" class="rfc2119">must</em> be revocable and a <a class="internalDFN" href="#ua">user agent</a> <em title="must" class="rfc2119">must</em> respect revoked
          permissions.
        </p>
        <p>
          Obtaining the user's express permission to access one API method does not imply the user has granted
          permission for the same Web site to access other methods provided by this API, or to access the same
          method with a different set of arguments, as part of the same permission context. If a user has
          expressed permission for an implementation to, e.g. find a set of existing contacts, the implementation
          <em title="must" class="rfc2119">must</em> seek the user's express permission if and when any additional <code>find</code> function is called
          on this API.
        </p>
        <p>
          A <a class="internalDFN" href="#ua">user agent</a> may have prearranged trust relationships that do not require such user
          interfaces. For example, while a Web browser will present a user interface when a Web site performs an
          address book request, a Widget [<cite><a href="#bib-WIDGETS" rel="biblioentry" class="bibref">WIDGETS</a></cite>] runtime <em title="may" class="rfc2119">may</em> have a prearranged, delegated security
          relationship with the user and, as such, a suitable alternative security and privacy mechanism with
          which to authorise the retrieval of contact information.
        </p>
      </div>

      <div id="privacy-considerations-for-recipients-of-contact-information" class="informative section">
        <h3><span class="secno">3.2 </span>Privacy considerations for recipients of contact information</h3><p><em>This section is non-normative.</em></p>
        <p>
          Web sites operators that retrieve contacts information using this API are denoted as recipients
          below.
        </p>
        <p>
          Recipients should only request contact information when necessary, and only use the contact
          information for the task for which it was provided to them.
        </p>
        <p>
          Recipients should dispose of contact information once that task is completed, unless expressly
          permitted to retain it by the user. Recipients should also take measures to protect this information
          against unauthorised access. If contact information is stored, users should be allowed to update and
          delete this information.
        </p>
        <p>
          The recipient of contact information should not retransmit the contact information without the
          user's express permission. Care should be taken when retransmitting and use of encryption is
          encouraged.
        </p>
        <p>
          Recipients should clearly and conspicuously disclose the fact that they are collecting contact data,
          the purpose for the collection, how long the data is retained, how the data is secured, how the data is
          shared if it is shared, how users can access, update and delete the data, and any other choices that
          users have with respect to the data. This disclosure should include an explanation of any exceptions to
          the guidelines listed above.
        </p>
        <p>
          Note that even if a user gives permission to share their contact information this can have serious
          privacy implications for those parties whose contacts are shared, as they may not wish such sharing to
          occur. This should be considered by web services when requesting and using such information.
        </p>
      </div>
      <div id="additional-implementation-considerations" class="informative section">
        <h3><span class="secno">3.3 </span>Additional implementation considerations</h3><p><em>This section is non-normative.</em></p>
        <p>
          Further to the requirements listed in the previous section, implementors of the Contacts API are
          also advised to consider the following aspects that can negatively affect the privacy of their users:
          in certain cases, users can inadvertently grant permission to the <a class="internalDFN" href="#ua">user agent</a> to disclose their contacts
          to Web sites. In other cases, the content hosted at a certain URL changes in such a way that the
          previously granted contact permissions no longer apply as far as the user is concerned. Or the users
          might simply change their minds.
        </p>
        <p>
          Predicting or preventing these situations is inherently difficult. Mitigation and in-depth defensive
          measures are an implementation responsibility and not prescribed by this specification. However, in
          designing these measures, implementers are advised to enable user awareness of contact sharing, and to
          provide easy access to interfaces that enable revocation of permissions that web applications have to
          access this API.
        </p>
      </div>
    </div>

    <div class="section" id="api-description">
      <!--OddPage--><h2><span class="secno">4. </span>API Description</h2>

      <div class="section" id="servicecontacts-interface">
        <h3><span class="secno">4.1 </span><a class="idlType" href="#idl-def-ServiceContacts"><code>ServiceContacts</code></a> interface</h3>
        <p id="ta-aa" class="product-ua">
          The <a class="idlType" href="#idl-def-ServiceContacts"><code>ServiceContacts</code></a> interface is exposed on the <a class="externalDFN">Navigator</a> 
          object [<cite><a href="#bib-NAVIGATOR" rel="biblioentry" class="bibref">NAVIGATOR</a></cite>]. Its goal is to provide an access point to the functionality in this
          specification.
        </p>
        <pre class="idl"><span class="idlInterface" id="idl-def-ServiceContacts">[<span class="extAttr">NoInterfaceObject</span>]
interface <span class="idlInterfaceID">ServiceContacts</span> {
<span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a class="idlType" href="#idl-def-Contacts"><code>Contacts</code></a></span> <span class="idlAttrName"><a href="#widl-ServiceContacts-contacts">contacts</a></span>;</span>
};</span>
</pre><div class="section" id="attributes"><h4><span class="secno">4.1.1 </span>Attributes</h4><dl class="attributes"><dt id="widl-ServiceContacts-contacts"><code>contacts</code> of type <span class="idlAttrType"><a class="idlType" href="#idl-def-Contacts"><code>Contacts</code></a></span>, readonly</dt><dd>The object through which the contacts functionality can be accessed.<div><em>No exceptions.</em></div></dd></dl></div>
        <pre class="idl"><span class="idlImplements"><a>Navigator</a> implements <a class="idlType" href="#idl-def-ServiceContacts"><code>ServiceContacts</code></a>;</span></pre><div class="idlImplementsDesc"><p>All instances of the <code><a>Navigator</a></code> type are defined to also implement the <a class="idlType" href="#idl-def-ServiceContacts"><code>ServiceContacts</code></a> interface.</p></div>
      </div>

      <div class="section" id="contacts-interface">
        <h3><span class="secno">4.2 </span><a class="idlType" href="#idl-def-Contacts"><code>Contacts</code></a> interface</h3>
        <p>
          The <a class="idlType" href="#idl-def-Contacts"><code>Contacts</code></a> interface exposes a database of contact information that may be retrieved.
        </p>
        <p>
          Multiple contact groups can be represented within this unified address book by specifying consistent
          <a href="#widl-Contact-categories"><code>categories</code></a> values as part of individual 
          <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> objects. Multiple contact groups can be displayed by filtering on the required 
          <a href="#widl-Contact-categories"><code>categories</code></a> values via
          the <a class="idlType" href="#idl-def-Contacts"><code>Contacts</code></a> <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation.
        </p>

        <pre class="idl"><span class="idlInterface" id="idl-def-Contacts">[<span class="extAttr">NoInterfaceObject</span>]
interface <span class="idlInterfaceID">Contacts</span> {
<span class="idlMethod">    <span class="idlMethType"><a>caller void</a></span> <span class="idlMethName"><a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find</a></span> (<span class="idlParam"><span class="idlParamType"><a>DOMString</a>[]</span> <span class="idlParamName">fields</span></span>, <span class="idlParam"><span class="idlParamType"><a class="idlType" href="#idl-def-ContactFindCB"><code>ContactFindCB</code></a></span> <span class="idlParamName">successCB</span></span>, <span class="idlParam">optional <span class="idlParamType"><a class="idlType" href="#idl-def-ContactErrorCB"><code>ContactErrorCB</code></a></span> <span class="idlParamName">errorCB</span></span>, <span class="idlParam">optional <span class="idlParamType"><a class="idlType" href="#idl-def-ContactFindOptions"><code>ContactFindOptions</code></a></span> <span class="idlParamName">options</span></span>);</span>
};</span>
</pre><div class="section" id="methods"><h4><span class="secno">4.2.1 </span>Methods</h4><dl class="methods"><dt id="widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options"><code>find</code></dt><dd>
            <p>
              Find contacts in the address book according to the <a class="internalDFN" href="#dfn-find-contacts-process">find contacts process</a> detailed
              below.
            </p>
            <p>
              This method takes two, three or four arguments. When called, it  starts the following 
              <dfn id="dfn-find-contacts-process">find contacts process</dfn>:
            </p>
            <ol class="rule">
              <li>
                Let <var>successCallback</var> be the callback indicated by the method's second argument.
              </li>
              <li>
                Let <var>errorCallback</var> be the callback indicated by the method's third argument, if any, or null otherwise.
              </li>
              <li id="ta-ai" class="product-ua">If <var>successCallback</var> is null, then throw a TypeError (as defined in [<cite><a href="#bib-WEBIDL" rel="biblioentry" class="bibref">WEBIDL</a></cite>]).</li>
              <li class="product-ua" id="ta-ag">
                If there is a <a class="internalDFN" href="#dfn-task">task</a> from the <a class="internalDFN" href="#dfn-device-task-source">device task source</a> in one of the <a class="internalDFN" href="#dfn-task-queues">task
                queues</a> (e.g. an existing <code>find()</code> operation is still pending a response), run these
                substeps:
                <ol>
                  <li>
                    If <var>errorCallback</var> is not null, let <var>error</var> be a <a class="idlType" href="#idl-def-ContactError"><code>ContactError</code></a>
                    object whose code attribute has the value <code>PENDING_OPERATION_ERROR</code> and
                    queue a task to invoke <var>errorCallback</var> with <var>error</var> as its argument.
                  </li>
                  <li>Abort this operation.</li>
                </ol>
              </li>
              <li>
                Return, and run the remaining steps asynchronously.
              </li>
              <li>
                Let <var>results</var> be the array of <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> objects obtained by searching contacts in the address book
                according to the rules defined in  <a href="#contact-search-processing">Contact Search Processing</a>,
                or null if the search has failed.
              </li>
              <li>
                If <var>results</var> is null, run these substeps:
                <ol>
                  <li>
                    If <var>errorCallback</var> is not null, let <var>error</var> be a <a class="idlType" href="#idl-def-ContactError"><code>ContactError</code></a>
                    object whose code attribute has its value set according to the type of failure that occurred and
                    queue a task to invoke <var>errorCallback</var> with <var>error</var> as its argument.
                  </li>
                  <li>Abort this operation.</li>
                </ol>
              </li>
              <li>Queue a task to invoke <var>successCallback</var> with <var>results</var> as its argument.</li>
            </ol>

            
          <table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">fields</td><td class="prmType"><code><a>DOMString</a>[]</code></td><td class="prmNullFalse"></td><td class="prmOptFalse"></td><td class="prmDesc">The <a class="internalDFN" href="#dfn-search-qualifier">search qualifier</a>.</td></tr><tr><td class="prmName">successCB</td><td class="prmType"><code><a class="idlType" href="#idl-def-ContactFindCB"><code>ContactFindCB</code></a></code></td><td class="prmNullFalse"></td><td class="prmOptFalse"></td><td class="prmDesc">Function to call when the asynchronous operation completes successfully.</td></tr><tr><td class="prmName">errorCB</td><td class="prmType"><code><a class="idlType" href="#idl-def-ContactErrorCB"><code>ContactErrorCB</code></a></code></td><td class="prmNullFalse"></td><td class="prmOptTrue"></td><td class="prmDesc">Function to call when the asynchronous operation fails.</td></tr><tr><td class="prmName">options</td><td class="prmType"><code><a class="idlType" href="#idl-def-ContactFindOptions"><code>ContactFindOptions</code></a></code></td><td class="prmNullFalse"></td><td class="prmOptTrue"></td><td class="prmDesc">The options to apply to the output of this method.</td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>caller void</a></code></div></dd></dl></div>
      </div>

      <div class="section" id="contact-interface">
        <h3><span class="secno">4.3 </span><a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> interface</h3>
        <p>
          The <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> interface captures the properties of a contact object. All properties included in this 
          interface have a corresponding definition in [<cite><a href="#bib-POCO-SCHEMA" rel="biblioentry" class="bibref">POCO-SCHEMA</a></cite>], [<cite><a href="#bib-RFC2426" rel="biblioentry" class="bibref">RFC2426</a></cite>] (aka vCard), and [<cite><a href="#bib-OMA-CAB" rel="biblioentry" class="bibref">OMA-CAB</a></cite>], thereby
          allowing the API to be supported across implementations supporting these various contact formats.
        </p>
        <p id="ta-ac" class="product-ua">
          All <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> objects <em title="must" class="rfc2119">must</em> include all attributes supported by the implementation, regardless 
          of whether these attributes have been assigned a <code>null</code> value or not. If a supported attribute has not been
          assigned a value by the user or the implementation, then this attribute <em title="must" class="rfc2119">must</em> still be present in the
          resulting <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> object and <em title="must" class="rfc2119">must</em> have a value of <code>null</code>.
        </p>
        <p>
          Additional attributes <em title="may" class="rfc2119">may</em> be included according to the provisions detailed in 
          <a href="#extended-contact-properties-and-parameters">Extended Contact Properties and Parameters</a>. If an
          extended attribute is supported by the current implementation and has not been assigned a value by the
          user or the implementation, then this extended attribute <em title="must" class="rfc2119">must</em> still be present in the resulting
          <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> object and <em title="must" class="rfc2119">must</em> have a value of <code>null</code>.
        </p>

        <pre class="idl"><span class="idlInterface" id="idl-def-Contact">[<span class="extAttr">NoInterfaceObject</span>]
interface <span class="idlInterfaceID">Contact</span> {
<span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>DOMString</a></span>              <span class="idlAttrName"><a href="#widl-Contact-id">id</a></span>;</span>
<span class="idlAttribute">             attribute <span class="idlAttrType"><a>DOMString</a>?</span>             <span class="idlAttrName"><a href="#widl-Contact-displayName">displayName</a></span>;</span>
<span class="idlAttribute">             attribute <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactName"><code>ContactName</code></a>?</span>           <span class="idlAttrName"><a href="#widl-Contact-name">name</a></span>;</span>
<span class="idlAttribute">             attribute <span class="idlAttrType"><a>DOMString</a>?</span>             <span class="idlAttrName"><a href="#widl-Contact-nickname">nickname</a></span>;</span>
<span class="idlAttribute">             attribute <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a>[]?</span>        <span class="idlAttrName"><a href="#widl-Contact-phoneNumbers">phoneNumbers</a></span>;</span>
<span class="idlAttribute">             attribute <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a>[]?</span>        <span class="idlAttrName"><a href="#widl-Contact-emails">emails</a></span>;</span>
<span class="idlAttribute">             attribute <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactAddress"><code>ContactAddress</code></a>[]?</span>      <span class="idlAttrName"><a href="#widl-Contact-addresses">addresses</a></span>;</span>
<span class="idlAttribute">             attribute <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a>[]?</span>        <span class="idlAttrName"><a href="#widl-Contact-ims">ims</a></span>;</span>
<span class="idlAttribute">             attribute <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactOrganization"><code>ContactOrganization</code></a>[]?</span> <span class="idlAttrName"><a href="#widl-Contact-organizations">organizations</a></span>;</span>
<span class="idlAttribute">             attribute <span class="idlAttrType"><a>Date</a>?</span>                  <span class="idlAttrName"><a href="#widl-Contact-birthday">birthday</a></span>;</span>
<span class="idlAttribute">             attribute <span class="idlAttrType"><a>DOMString</a>?</span>             <span class="idlAttrName"><a href="#widl-Contact-note">note</a></span>;</span>
<span class="idlAttribute">             attribute <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a>[]?</span>        <span class="idlAttrName"><a href="#widl-Contact-photos">photos</a></span>;</span>
<span class="idlAttribute">             attribute <span class="idlAttrType"><a>DOMString</a>[]?</span>           <span class="idlAttrName"><a href="#widl-Contact-categories">categories</a></span>;</span>
<span class="idlAttribute">             attribute <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a>[]?</span>        <span class="idlAttrName"><a href="#widl-Contact-urls">urls</a></span>;</span>
};</span>
</pre><div class="section" id="attributes-1"><h4><span class="secno">4.3.1 </span>Attributes</h4><dl class="attributes"><dt id="widl-Contact-addresses"><code>addresses</code> of type array of <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactAddress"><code>ContactAddress</code></a></span>, nullable</dt><dd>
            <p>
              This attribute represents one or more physical addresses associated with this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-Contact-birthday"><code>birthday</code> of type <span class="idlAttrType"><a>Date</a></span>, nullable</dt><dd>
            <p>
              This attribute contains birthday of this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>.
            </p>
            <p>
              The year value <em title="may" class="rfc2119">may</em> be set to 0000 when the age of the <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> is private or the year is not
              available.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-Contact-categories"><code>categories</code> of type array of <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains one or more user-defined categories/tags/labels associated with this
              <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>. e.g. "family", "favourite", "cryptozoologists".
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-Contact-displayName"><code>displayName</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the name of this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> in a form that is suitable for display 
              to the user.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-Contact-emails"><code>emails</code> of type array of <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a></span>, nullable</dt><dd>
            <p>
              This attribute represents one or more email addresses associated with this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-Contact-id"><code>id</code> of type <span class="idlAttrType"><a>DOMString</a></span>, readonly</dt><dd>
            <p>
              A globally unique identifier for the given <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> object. 
            </p>
            <p>
              An implementation <em title="must" class="rfc2119">must</em> maintain this globally unique identifier when a <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> is added
              to an address book.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-Contact-ims"><code>ims</code> of type array of <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a></span>, nullable</dt><dd>
            <p>
              This attribute represents one or more instant messaging identifiers associated with this
              <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-Contact-name"><code>name</code> of type <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactName"><code>ContactName</code></a></span>, nullable</dt><dd>
            <p>
              This attribute represents the full name of this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> indicated by the name components 
              associated with the <a class="idlType" href="#idl-def-ContactName"><code>ContactName</code></a> object.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-Contact-nickname"><code>nickname</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the nickname (or a casual name) for this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-Contact-note"><code>note</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the personal notes (free-text) for this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> that is managed by the
              user of the address book.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-Contact-organizations"><code>organizations</code> of type array of <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactOrganization"><code>ContactOrganization</code></a></span>, nullable</dt><dd>
            <p>
              This attribute represents one or more organizations associated with this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-Contact-phoneNumbers"><code>phoneNumbers</code> of type array of <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a></span>, nullable</dt><dd>
            <p>
              This attribute captures one or more phone numbers associated with this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-Contact-photos"><code>photos</code> of type array of <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a></span>, nullable</dt><dd>
            <p>
              This attribute represents one or more photos associated with this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>.
            </p>
            <p>
              The photos <em title="must" class="rfc2119">must</em> be specified in the <code>value</code> attribute of the <a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a> object 
              by using a URL pointing to an image resource. The <code>data:</code> URI scheme may be used in order
              to provide inline data.
            </p>
            <p class="note">
              This attribute <em title="should not" class="rfc2119">should not</em> be used to send down arbitrary photos taken by this user,
              but specifically profile photos of the contact suitable for display when describing the
              contact.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-Contact-urls"><code>urls</code> of type array of <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a></span>, nullable</dt><dd>
            <p>
              This attribute represents one or more URLs associated with this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> e.g. personal web page, 
              blog.
            </p>
            <p>
              The web resources <em title="must" class="rfc2119">must</em> be specified using the <code>value</code> attribute of the
              <code>ContactField</code> object, and its <code>type</code> field may be set to "blog" or
              "profile".
            </p>
          <div><em>No exceptions.</em></div></dd></dl></div>
      </div>

      <div class="section" id="contactname-interface">
        <h3><span class="secno">4.4 </span><a class="idlType" href="#idl-def-ContactName"><code>ContactName</code></a> interface</h3>

        <p>
          The <a class="idlType" href="#idl-def-ContactName"><code>ContactName</code></a> interface describes a contact's name.
        </p>

        <pre class="idl"><span class="idlInterface" id="idl-def-ContactName">[<span class="extAttr">NoInterfaceObject</span>]
interface <span class="idlInterfaceID">ContactName</span> {
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactName-formatted">formatted</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactName-familyName">familyName</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactName-givenName">givenName</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactName-middleName">middleName</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactName-honorificPrefix">honorificPrefix</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactName-honorificSuffix">honorificSuffix</a></span>;</span>
};</span>
</pre><div class="section" id="attributes-2"><h4><span class="secno">4.4.1 </span>Attributes</h4><dl class="attributes"><dt id="widl-ContactName-familyName"><code>familyName</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the family name (also referred to as the last name) of this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactName-formatted"><code>formatted</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the full name, including all the individual components such as
              <code>givenName</code>, <code>middleName</code>, <code>familyName</code>, <code>prefix</code>,
              <code>suffix</code> as appropriate for the user's culture, and formatted for display (e.g. <code>Mr. Joe Smith
              Jr</code>).
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactName-givenName"><code>givenName</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the given name (also referred to as the first name) of this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactName-honorificPrefix"><code>honorificPrefix</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the honorific prefix (or title) of this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>. E.g. Mr., Dr., Ms.,
              Mrs.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactName-honorificSuffix"><code>honorificSuffix</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the honorific suffix of this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>. E.g. Jr, III, Sr.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactName-middleName"><code>middleName</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the middle name of this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>.
            </p>
          <div><em>No exceptions.</em></div></dd></dl></div>
      </div>

      <div class="section" id="contactfield-interface">
        <h3><span class="secno">4.5 </span><a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a> interface</h3>

        <p>
          The <a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a> interface is a reusable component that is used to capture contact fields of the
          <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> interface that have some modicum of structure.
        </p>

        <pre class="idl"><span class="idlInterface" id="idl-def-ContactField">[<span class="extAttr">NoInterfaceObject</span>]
interface <span class="idlInterfaceID">ContactField</span> {
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a></span>  <span class="idlAttrName"><a href="#widl-ContactField-type">type</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactField-value">value</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>boolean</a></span>    <span class="idlAttrName"><a href="#widl-ContactField-pref">pref</a></span>;</span>
};</span>
</pre><div class="section" id="attributes-3"><h4><span class="secno">4.5.1 </span>Attributes</h4><dl class="attributes"><dt id="widl-ContactField-pref"><code>pref</code> of type <span class="idlAttrType"><a>boolean</a></span></dt><dd>
            <p>
              This attribute indicates whether this instance of the <a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a> is the
              preferred, or primary, value for the contact property this <a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a> is
              representing in the <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> interface. By default, the value is <code>false</code>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactField-type"><code>type</code> of type <span class="idlAttrType"><a>DOMString</a></span></dt><dd>
            <p>
              This attribute contains the type information for this <a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a> and its content varies subject
              to the contact property this <a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a> is representing. For example, if the <a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a> 
              is representing a <code>phoneNumber</code> property, the <code>type</code> attribute can be set to 
              <code>home</code>, <code>mobile</code>; if the <a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a> is representing the <code>ims</code> 
              property, the type attribute could be set to <code>xmpp</code>, <code>irc</code>, <code>bbm</code>, etc.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactField-value"><code>value</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the value for this <a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a> and its content varies subject to the
              contact property this <a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a> is representing. For example, if the <a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a> is 
              representing an <code>email</code>, the value attribute could be set to <code>JoeSmith@example.com</code>, 
              and if the <a class="idlType" href="#idl-def-ContactField"><code>ContactField</code></a> is representing a <code>url</code>, the value attribute can be set to    
              <code>http://www.example.org/joesmith</code>, etc.
            </p>
          <div><em>No exceptions.</em></div></dd></dl></div>
      </div>

      <div class="section" id="contactaddress-interface">
        <h3><span class="secno">4.6 </span><a class="idlType" href="#idl-def-ContactAddress"><code>ContactAddress</code></a> interface</h3>

        <p>
          The <a class="idlType" href="#idl-def-ContactAddress"><code>ContactAddress</code></a> interface is a reusable component that is used to capture addresses
          within the <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> interface.
        </p>
        <pre class="idl"><span class="idlInterface" id="idl-def-ContactAddress">[<span class="extAttr">NoInterfaceObject</span>]
interface <span class="idlInterfaceID">ContactAddress</span> {
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>boolean</a></span>    <span class="idlAttrName"><a href="#widl-ContactAddress-pref">pref</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactAddress-type">type</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactAddress-formatted">formatted</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactAddress-streetAddress">streetAddress</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactAddress-locality">locality</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactAddress-region">region</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactAddress-postalCode">postalCode</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactAddress-country">country</a></span>;</span>
};</span>
</pre><div class="section" id="attributes-4"><h4><span class="secno">4.6.1 </span>Attributes</h4><dl class="attributes"><dt id="widl-ContactAddress-country"><code>country</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the country name corresponding to this <a class="idlType" href="#idl-def-ContactAddress"><code>ContactAddress</code></a>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactAddress-formatted"><code>formatted</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the full physical address including <code>street</code>, <code>locality</code>, 
              <code>region</code>, <code>postalCode</code>, and <code>country</code> as appropriate, and formatted for
              display.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactAddress-locality"><code>locality</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the locality (or city) name corresponding to this <a class="idlType" href="#idl-def-ContactAddress"><code>ContactAddress</code></a>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactAddress-postalCode"><code>postalCode</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the postal code (or zip) corresponding to this <a class="idlType" href="#idl-def-ContactAddress"><code>ContactAddress</code></a>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactAddress-pref"><code>pref</code> of type <span class="idlAttrType"><a>boolean</a></span></dt><dd>
            <p>
              This attribute indicates whether this instance of the <code>ContactAddress</code> is the preferred, or primary, value for the contact. 
              By default, the value is <code>false</code>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactAddress-region"><code>region</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the region (or state/province) name corresponding to this <a class="idlType" href="#idl-def-ContactAddress"><code>ContactAddress</code></a>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactAddress-streetAddress"><code>streetAddress</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the street address corresponding to this <a class="idlType" href="#idl-def-ContactAddress"><code>ContactAddress</code></a>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactAddress-type"><code>type</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the type of address this object is representing (e.g. <code>work</code>, <code>home</code>, <code>premises</code>, etc).
            </p>
          <div><em>No exceptions.</em></div></dd></dl></div>
      </div>

      <div class="section" id="contactorganization-interface">
        <h3><span class="secno">4.7 </span><a class="idlType" href="#idl-def-ContactOrganization"><code>ContactOrganization</code></a> interface</h3>

        <p>
          The <a class="idlType" href="#idl-def-ContactOrganization"><code>ContactOrganization</code></a> interface is a reusable component that is used to support contact
          organisations within the <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> interface.
        </p>

        <pre class="idl"><span class="idlInterface" id="idl-def-ContactOrganization">[<span class="extAttr">NoInterfaceObject</span>]
interface <span class="idlInterfaceID">ContactOrganization</span> {
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>boolean</a></span>    <span class="idlAttrName"><a href="#widl-ContactOrganization-pref">pref</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactOrganization-type">type</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactOrganization-name">name</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactOrganization-department">department</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactOrganization-title">title</a></span>;</span>
};</span>
</pre><div class="section" id="attributes-5"><h4><span class="secno">4.7.1 </span>Attributes</h4><dl class="attributes"><dt id="widl-ContactOrganization-department"><code>department</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              The department within which this <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> works.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactOrganization-name"><code>name</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              The name of the organisation.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactOrganization-pref"><code>pref</code> of type <span class="idlAttrType"><a>boolean</a></span></dt><dd>
            <p>
              This attribute indicates whether this instance of the <code>ContactOrganization</code> is the preferred, or 
              primary, value for the contact. By default, the value is <code>false</code>.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactOrganization-title"><code>title</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              The job title that the <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> holds inside this organisation.
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactOrganization-type"><code>type</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            <p>
              This attribute contains the type of organization this object is representing. 
            </p>
          <div><em>No exceptions.</em></div></dd></dl></div>
      </div>

      <div class="section" id="contactfindoptions-interface">
        <h3><span class="secno">4.8 </span><a class="idlType" href="#idl-def-ContactFindOptions"><code>ContactFindOptions</code></a> interface</h3>
        <p>
          The <a class="idlType" href="#idl-def-ContactFindOptions"><code>ContactFindOptions</code></a> interface describes the options that can be applied to contact searching. 
          When a <a class="idlType" href="#idl-def-ContactFindOptions"><code>ContactFindOptions</code></a> parameter is provided to the <a class="idlType" href="#idl-def-Contacts"><code>Contacts</code></a> <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a>
          operation, it should be processed according to the provisions detailed in 
          <a href="#options-processing">Options Processing</a>.
        </p>
        <pre class="idl"><span class="idlInterface" id="idl-def-ContactFindOptions">[<span class="extAttr">NoInterfaceObject</span>]
interface <span class="idlInterfaceID">ContactFindOptions</span> {
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a>?</span> <span class="idlAttrName"><a href="#widl-ContactFindOptions-filter">filter</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>boolean</a>?</span>   <span class="idlAttrName"><a href="#widl-ContactFindOptions-multiple">multiple</a></span>;</span>
};</span>
</pre><div class="section" id="attributes-6"><h4><span class="secno">4.8.1 </span>Attributes</h4><dl class="attributes"><dt id="widl-ContactFindOptions-filter"><code>filter</code> of type <span class="idlAttrType"><a>DOMString</a></span>, nullable</dt><dd>
            A string-based <a class="internalDFN" href="#dfn-search-filter">search filter</a> which provides a hint to the user agent to facilitate contacts selection by the user.
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactFindOptions-multiple"><code>multiple</code> of type <span class="idlAttrType"><a>boolean</a></span>, nullable</dt><dd>
            A boolean value to indicate whether multiple Contact objects are wanted as part of the
            <a class="idlType" href="#idl-def-Contacts"><code>Contacts</code></a> <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation.
            By default this option is set to <code>false</code>.
          <div><em>No exceptions.</em></div></dd></dl></div>
      </div>

      <div class="section" id="contactfindcb-interface">
        <h3><span class="secno">4.9 </span><a class="idlType" href="#idl-def-ContactFindCB"><code>ContactFindCB</code></a> interface</h3>
        <p>
          This is the wrapper interface for callbacks indicating success of the <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> 
          operation.
        </p>

        <pre class="idl"><span class="idlInterface" id="idl-def-ContactFindCB">[<span class="extAttr">Callback=FunctionOnly, NoInterfaceObject</span>]
interface <span class="idlInterfaceID">ContactFindCB</span> {
<span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-ContactFindCB-onsuccess-void-ContactArray-contactObjs">onsuccess</a></span> (<span class="idlParam"><span class="idlParamType"><a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>[]</span> <span class="idlParamName">contactObjs</span></span>);</span>
};</span>
</pre><div class="section" id="methods-1"><h4><span class="secno">4.9.1 </span>Methods</h4><dl class="methods"><dt id="widl-ContactFindCB-onsuccess-void-ContactArray-contactObjs"><code>onsuccess</code></dt><dd>
            
          <table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">contactObjs</td><td class="prmType"><code><a class="idlType" href="#idl-def-Contact"><code>Contact</code></a>[]</code></td><td class="prmNullFalse"></td><td class="prmOptFalse"></td><td class="prmDesc">
                An array of <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> objects resulting from the given <a class="idlType" href="#idl-def-Contacts"><code>Contacts</code></a> 
                <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation.
              </td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd></dl></div>

        <div class="section" id="event-handler-attributes">
          <h4><span class="secno">4.9.2 </span>Event Handler Attributes</h4>
          <p>
            The following is the <a class="internalDFN" href="#dfn-event-handler-attribute">event handler attribute</a> (and its corresponding <a class="internalDFN" href="#dfn-event-handler-event-type">event handler event
            type</a>) that <em title="must" class="rfc2119">must</em> be supported as a DOM attribute by the <a class="idlType" href="#idl-def-ContactFindCB"><code>ContactFindCB</code></a> object.
          </p>
          <table class="simple">
            <thead>
              <tr>
                <th><a class="internalDFN" href="#dfn-event-handler-attribute">event handler attribute</a></th>
                <th><a class="internalDFN" href="#dfn-event-handler-event-type">event handler event type</a></th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td><strong><code>onsuccess</code></strong></td>
                <td><code>success</code></td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>

      <div class="section" id="contacterrorcb-interface">
        <h3><span class="secno">4.10 </span><a class="idlType" href="#idl-def-ContactErrorCB"><code>ContactErrorCB</code></a> interface</h3>
        <p>
          This is the wrapper interface for callbacks indicating failure of the <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> 
          operation.
        </p>

        <pre class="idl"><span class="idlInterface" id="idl-def-ContactErrorCB">[<span class="extAttr">Callback=FunctionOnly, NoInterfaceObject</span>]
interface <span class="idlInterfaceID">ContactErrorCB</span> {
<span class="idlMethod">    <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-ContactErrorCB-onerror-void-ContactError-error">onerror</a></span> (<span class="idlParam"><span class="idlParamType"><a class="idlType" href="#idl-def-ContactError"><code>ContactError</code></a></span> <span class="idlParamName">error</span></span>);</span>
};</span>
</pre><div class="section" id="methods-2"><h4><span class="secno">4.10.1 </span>Methods</h4><dl class="methods"><dt id="widl-ContactErrorCB-onerror-void-ContactError-error"><code>onerror</code></dt><dd>
            
          <table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">error</td><td class="prmType"><code><a class="idlType" href="#idl-def-ContactError"><code>ContactError</code></a></code></td><td class="prmNullFalse"></td><td class="prmOptFalse"></td><td class="prmDesc">The <a class="idlType" href="#idl-def-ContactError"><code>ContactError</code></a> object capturing the type of the error.</td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd></dl></div>

        <div class="section" id="event-handler-attributes-1">
          <h4><span class="secno">4.10.2 </span>Event Handler Attributes</h4>
          <p>
            The following is the <a class="internalDFN" href="#dfn-event-handler-attribute">event handler attribute</a> (and its corresponding <a class="internalDFN" href="#dfn-event-handler-event-type">event handler event
            type</a>) that <em title="must" class="rfc2119">must</em> be supported as a DOM attribute by the <a class="idlType" href="#idl-def-ContactErrorCB"><code>ContactErrorCB</code></a> object.
          </p>

          <table class="simple">
            <thead>
              <tr>
                <th><a class="internalDFN" href="#dfn-event-handler-attribute">event handler attribute</a></th>
                <th><a class="internalDFN" href="#dfn-event-handler-event-type">event handler event type</a></th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td><strong><code><strong>onerror</strong></code></strong></td>
                <td><code>error</code></td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>

      <div class="section" id="contacterror-interface">
        <h3><span class="secno">4.11 </span><a class="idlType" href="#idl-def-ContactError"><code>ContactError</code></a> interface</h3>
        <p>
          The <a class="idlType" href="#idl-def-ContactError"><code>ContactError</code></a> interface encapsulates all errors in the manipulation of 
          <a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> objects.
        </p>

        <pre class="idl"><span class="idlInterface" id="idl-def-ContactError">[<span class="extAttr">NoInterfaceObject</span>]
interface <span class="idlInterfaceID">ContactError</span> {
<span class="idlConst">    const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-ContactError-UNKNOWN_ERROR">UNKNOWN_ERROR</a></span> = <span class="idlConstValue">0</span>;</span>
<span class="idlConst">    const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-ContactError-INVALID_ARGUMENT_ERROR">INVALID_ARGUMENT_ERROR</a></span> = <span class="idlConstValue">1</span>;</span>
<span class="idlConst">    const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-ContactError-TIMEOUT_ERROR">TIMEOUT_ERROR</a></span> = <span class="idlConstValue">2</span>;</span>
<span class="idlConst">    const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-ContactError-PENDING_OPERATION_ERROR">PENDING_OPERATION_ERROR</a></span> = <span class="idlConstValue">3</span>;</span>
<span class="idlConst">    const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-ContactError-IO_ERROR">IO_ERROR</a></span> = <span class="idlConstValue">4</span>;</span>
<span class="idlConst">    const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-ContactError-NOT_SUPPORTED_ERROR">NOT_SUPPORTED_ERROR</a></span> = <span class="idlConstValue">5</span>;</span>
<span class="idlConst">    const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-ContactError-PERMISSION_DENIED_ERROR">PERMISSION_DENIED_ERROR</a></span> = <span class="idlConstValue">20</span>;</span>
<span class="idlAttribute">    readonly attribute <span class="idlAttrType"><a>unsigned short</a></span> <span class="idlAttrName"><a href="#widl-ContactError-code">code</a></span>;</span>
};</span>
</pre><div class="section" id="attributes-7"><h4><span class="secno">4.11.1 </span>Attributes</h4><dl class="attributes"><dt id="widl-ContactError-code"><code>code</code> of type <span class="idlAttrType"><a>unsigned short</a></span>, readonly</dt><dd>An error code assigned by an implementation when an error has occurred in Contacts API
          processing.<div><em>No exceptions.</em></div></dd></dl></div><div class="section" id="constants"><h4><span class="secno">4.11.2 </span>Constants</h4><dl class="constants"><dt id="widl-ContactError-INVALID_ARGUMENT_ERROR"><code>INVALID_ARGUMENT_ERROR</code> of type <span class="idlConstType"><a>unsigned short</a></span></dt><dd>An invalid parameter was provided when the requested method was invoked.</dd><dt id="widl-ContactError-IO_ERROR"><code>IO_ERROR</code> of type <span class="idlConstType"><a>unsigned short</a></span></dt><dd>An error occurred in communication with the underlying implementation that meant the requested
          method could not complete.</dd><dt id="widl-ContactError-NOT_SUPPORTED_ERROR"><code>NOT_SUPPORTED_ERROR</code> of type <span class="idlConstType"><a>unsigned short</a></span></dt><dd>The requested method is not supported by the current implementation.</dd><dt id="widl-ContactError-PENDING_OPERATION_ERROR"><code>PENDING_OPERATION_ERROR</code> of type <span class="idlConstType"><a>unsigned short</a></span></dt><dd>There is already a <a class="internalDFN" href="#dfn-task">task</a> in the <a class="internalDFN" href="#dfn-device-task-source">device task source</a>.</dd><dt id="widl-ContactError-PERMISSION_DENIED_ERROR"><code>PERMISSION_DENIED_ERROR</code> of type <span class="idlConstType"><a>unsigned short</a></span></dt><dd>Access to the requested information was denied by the implementation or by the user.</dd><dt id="widl-ContactError-TIMEOUT_ERROR"><code>TIMEOUT_ERROR</code> of type <span class="idlConstType"><a>unsigned short</a></span></dt><dd>The requested method timed out before it could be completed.</dd><dt id="widl-ContactError-UNKNOWN_ERROR"><code>UNKNOWN_ERROR</code> of type <span class="idlConstType"><a>unsigned short</a></span></dt><dd>An unknown error occurred.</dd></dl></div>
      </div>
    </div>

    <div class="section" id="contact-search-processing">
      <!--OddPage--><h2><span class="secno">5. </span><a>Contact Search Processing</a></h2>

      <p>
      The <a href="#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a>
      method provides an operation to search for one of more <a href="#contact-interface"><code>Contact</code></a> objects within the <a href="#contacts-interface"><code>Contacts</code></a> database.
      </p>

      <div class="section" id="search-qualifiers">
        <h3><span class="secno">5.1 </span>Search Qualifiers</h3>

        <p>
        The <dfn id="dfn-search-qualifier">search qualifier</dfn> provides an application with a way to request the specific subset of
        <a href="#contact-interface"><code>Contact</code></a> properties it wishes to obtain in any resulting
        successful callback. The <a class="internalDFN" href="#dfn-search-qualifier">search qualifier</a> is deployed to minimize the data that needs to be
        shared with an application in order to let that application fulfill its function on behalf of the user.
        The <a class="internalDFN" href="#dfn-search-qualifier">search qualifier</a> is included within a <a href="#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation as
        the <code>fields</code> parameter.
        </p>

        <p id="ta-aj" class="product-ua">
        A <a class="internalDFN" href="#dfn-search-qualifier">search qualifier</a> <em title="must" class="rfc2119">must</em> be specified from a requesting application as a part of any <a href="#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation.
        </p>

        <p id="ta-ab" class="product-ua">
        If the <a class="internalDFN" href="#dfn-search-qualifier">search qualifier</a> provided is of <em>zero-length</em> then the current <a href="#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation and 
        the current find() operation was invoked with a non-<code>null</code> 
        <code>errorCB</code> parameter, then the user agent <em title="must" class="rfc2119">must</em> invoke the <code>errorCB</code> function
        with an error code of <a href="#widl-ContactError-INVALID_ARGUMENT_ERROR"><code>INVALID_ARGUMENT_ERROR</code></a>.
        </p>

        <p id="ta-ak" class="product-ua">
        In the case that the <a class="internalDFN" href="#dfn-search-qualifier">search qualifier</a> provided is of <em>non-zero-length</em> then the
        current <a href="#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation <em title="must" class="rfc2119">must</em> return only the matching <a href="#contact-interface"><code>Contact</code></a> properties within any resulting <a href="#contact-interface"><code>Contact</code></a> object(s).
        </p>

        <p id="ta-al" class="product-ua">
        If a provided <a class="internalDFN" href="#dfn-search-qualifier">search qualifier</a> element (<code>fields[x]</code>) does not match a <a href="#contact-interface"><code>Contact</code></a> attribute, <code>fields[x]</code> <em title="should" class="rfc2119">should</em> be ignored when
        executing the current <a href="#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation.
        </p>

        <div class="section" id="advanced-search-qualifiers">
          <h4><span class="secno">5.1.1 </span>Advanced Search Qualifiers</h4>

          <p>
          We call <dfn id="dfn-composed-attributes">composed attributes</dfn> <a href="#contact-interface"><code>Contact</code></a>
          attributes of types <code>object</code>, which contain information only available 
          only through child attributes of that object, or <code>array</code>.
          </p>

          <p class="product-ua" id="ta-ad">
          A requesting application <em title="must" class="rfc2119">must</em> be able to request both the full composed <a href="#contact-interface"><code>Contact</code></a> attribute and also be able to request individual parts
          of a composed <a href="#contact-interface"><code>Contact</code></a> attribute in the <a class="internalDFN" href="#dfn-search-qualifier">search
          qualifier</a> provided to a <a href="#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation.
          </p>

          <p>
          For example, the <code>name</code> attribute of a <a href="#contact-interface"><code>Contact</code></a> object is defined to be of composed type <a href="#contactname-interface"><code>ContactName</code></a>. Therefore, a requesting application may
          request either the full composed attribute (i.e. <code>name</code>) or specific individual attributes
          of this composed attribute (i.e. <code>name.formatted</code>, <code>name.familyName</code>,
          <code>name.givenName</code>, <code>name.middleName</code>, <code>name.honorificPrefix</code>,
          <code>name.honorificSuffix</code>) as part of a <a href="#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation's
          <a class="internalDFN" href="#dfn-search-qualifier">search qualifier</a>.
          </p>

          <p id="ta-af" class="product-ua">
          In the case that a composed <a href="#contact-interface"><code>Contact</code></a> attribute is
          defined as an array of composed objects, specific individual attributes can be referenced
          by using the composed attribute name, a dot (<code>.</code>) character and the individual attribute
          to be retrieved.
          </p>

          <p>
          For example, the <code>addresses</code> attribute of <a href="#contact-interface"><code>Contact</code></a> allows multiple <a href="#contactaddress-interface"><code>ContactAddress</code></a> objects to be defined. To request
          individual attributes of this composed attribute an application would request e.g.
          <code>addresses.locality</code>, <code>addresses.region</code>, etc.
          </p>
        </div>

        <div class="example">
          <p>
          The following Contact search is initiated:
          </p>
          <pre class="sh_javascript sh_sourceCode"> 
     navigator<span class="sh_symbol">.</span><span class="sh_function">contacts</span><span class="sh_symbol">(</span> <span class="sh_symbol">[</span><span class="sh_string">'emails.value'</span><span class="sh_symbol">,</span> <span class="sh_string">'name'</span><span class="sh_symbol">,</span> <span class="sh_string">'friends'</span><span class="sh_symbol">],</span>
                         <span class="sh_keyword">function</span><span class="sh_symbol">(</span>contacts<span class="sh_symbol">)</span> <span class="sh_cbracket">{</span> 
                           <span class="sh_keyword">for</span><span class="sh_symbol">(</span>i <span class="sh_keyword">in</span> contacts<span class="sh_symbol">)</span> <span class="sh_cbracket">{</span>
                             <span class="sh_keyword">for</span><span class="sh_symbol">(</span>j <span class="sh_keyword">in</span> contacts<span class="sh_symbol">[</span>i<span class="sh_symbol">].</span>emails<span class="sh_symbol">)</span>
                               <span class="sh_function">alert</span><span class="sh_symbol">(</span>contacts<span class="sh_symbol">[</span>i<span class="sh_symbol">].</span>emails<span class="sh_symbol">[</span>j<span class="sh_symbol">]);</span>
                           <span class="sh_cbracket">}</span>
                         <span class="sh_cbracket">}</span> <span class="sh_symbol">);</span>
  </pre>

          <p>
          The above example logically implies:
          </p>

          <ol class="rule">
            <li>Return only the valid <a href="#contact-interface"><code>Contact</code></a> attributes
            requested in the provided <a class="internalDFN" href="#dfn-search-qualifier">search qualifier</a> (<code>name</code>, <code>emails.value</code> -
            <code>friends</code> is not a valid <a href="#contact-interface"><code>Contact</code></a> attribute
            so ignore this element).</li>
          </ol>
        </div>
      </div>

      <div class="section" id="options-processing">
        <h3><span class="secno">5.2 </span>Options Processing</h3>

        <div class="section" id="search-cardinality">
          <h4><span class="secno">5.2.1 </span>Search Cardinality</h4>

          <p id="ta-am" class="product-ua">
          By default, the <a href="#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation <em title="must" class="rfc2119">must</em> return either an empty sequence or a single <a href="#contact-interface"><code>Contact</code></a> object, accessible as part of the sequence returned in
          the <a href="#contactfindcb-interface"><code>ContactFindCB</code></a> callback function.
          </p>

          <p id="ta-ae" class="product-ua">
          If a <a href="#contactfindoptions-interface"><code>ContactFindOptions</code></a> object is
          provided to the <a href="#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation and its <code>multiple</code> attribute is set to
          <code>true</code>, the <a href="#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation <em title="must" class="rfc2119">must</em> return either an empty sequence, a single <a href="#contact-interface"><code>Contact</code></a> object or <var>[X]</var> number of <a href="#contact-interface"><code>Contact</code></a> objects, accessible as part of the sequence returned in
          the <a href="#contactfindcb-interface"><code>ContactFindCB</code></a> callback function.
          </p>
        </div>

        <div class="section" id="search-filters">
          <h4><span class="secno">5.2.2 </span>Search Filters</h4>

	  <p>
          A <dfn id="dfn-search-filter">search filter</dfn> may be specified from a requesting web application to provide a hint to the user agents as to which contacts the user can select to share with the application.</p>

	  <p>The <a class="internalDFN" href="#dfn-search-filter">search filter</a> is defined through the <code>filter</code>
          attribute of the <a href="#contactfindoptions-interface"><code>ContactFindOptions</code></a> object
          provided to a <a href="#contacts-interface"><code>Contacts</code></a> <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation.
          </p>

          <p>The actual usage of this <a class="internalDFN" href="#dfn-search-filter">search filter</a> is user-agent dependant, but is expected to represent
          the logical union of provided values that are matched therein.
          </p>
	</div>
      </div>
    </div>

    <div class="section" id="extended-contact-properties-and-parameters">
      <!--OddPage--><h2><span class="secno">6. </span>Extended Contact Properties and Parameters</h2>

      <p>
      The properties and parameters defined on the <a href="#contact-interface"><code>Contact</code></a>
      interface <em title="may" class="rfc2119">may</em> be extended by implementors of this specification.
      </p>

      <p>
      Non-standard, private properties and parameters <em title="should" class="rfc2119">should</em> have a prefixed name starting with
      <code>X</code> (U+0058 LATIN CAPITAL LETTER X) or use a vendor-specific prefix. Extended properties and
      parameters can be defined bilaterally between <a class="internalDFN" href="#ua" title="user agent">user agents</a> without outside
      registration or standardization.
      </p>

      <p>
      It is <em title="recommended" class="rfc2119">recommended</em> that authors define both a formal vCard grammar and a WebIDL grammar for their
      proposed extension to ensure interoperability between vCard databases and other non-standard Contact
      databases and formats. It is also <em title="recommended" class="rfc2119">recommended</em> that authors provide documentation of their extension
      properties and parameters within the public domain.
      </p>

      <div class="example">
        <p>
        A new parameter is required by Company X to provide information related to a user's accounts
        registered across different networks and services.
        </p>

        <p>
        The [<cite><a href="#bib-WEBIDL" rel="biblioentry" class="bibref">WEBIDL</a></cite>] syntax for this parameter is defined as follows:
        </p>

        <pre class="idl"><span class="idlImplements"><a class="idlType" href="#idl-def-Contact"><code>Contact</code></a> implements <a class="idlType" href="#idl-def-ContactExtended"><code>ContactExtended</code></a>;</span></pre><div class="idlImplementsDesc">
          &nbsp;
        </div>

        <pre class="idl"><span class="idlInterface" id="idl-def-ContactExtended">[<span class="extAttr">NoInterfaceObject</span>]
interface <span class="idlInterfaceID">ContactExtended</span> {
<span class="idlAttribute">    attribute <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactAccount"><code>ContactAccount</code></a>[]</span> <span class="idlAttrName"><a href="#widl-ContactExtended-Xaccounts">Xaccounts</a></span>;</span>
};</span>
</pre><div class="section"><h3 id="attributes-8">Attributes</h3><dl class="attributes"><dt id="widl-ContactExtended-Xaccounts"><code>Xaccounts</code> of type array of <span class="idlAttrType"><a class="idlType" href="#idl-def-ContactAccount"><code>ContactAccount</code></a></span></dt><dd>One or more user accounts. See [[<cite><a href="#bib-POCO-SCHEMA" rel="biblioentry" class="bibref">POCO-SCHEMA</a></cite>] Section 7.2.2. <code>accounts</code>].<div><em>No exceptions.</em></div></dd></dl></div>

        <pre class="idl"><span class="idlInterface" id="idl-def-ContactAccount">[<span class="extAttr">NoInterfaceObject</span>]
interface <span class="idlInterfaceID">ContactAccount</span> {
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-ContactAccount-domain">domain</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-ContactAccount-username">username</a></span>;</span>
<span class="idlAttribute">    attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-ContactAccount-userid">userid</a></span>;</span>
};</span>
</pre><div class="section"><h3 id="attributes-9">Attributes</h3><dl class="attributes"><dt id="widl-ContactAccount-domain"><code>domain</code> of type <span class="idlAttrType"><a>DOMString</a></span></dt><dd>
            <p>
            See [[<cite><a href="#bib-POCO-SCHEMA" rel="biblioentry" class="bibref">POCO-SCHEMA</a></cite>] Section 7.6. <code>domain</code>].
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactAccount-userid"><code>userid</code> of type <span class="idlAttrType"><a>DOMString</a></span></dt><dd>
            <p>
            See [[<cite><a href="#bib-POCO-SCHEMA" rel="biblioentry" class="bibref">POCO-SCHEMA</a></cite>] Section 7.6. <code>userid</code>].
            </p>
          <div><em>No exceptions.</em></div></dd><dt id="widl-ContactAccount-username"><code>username</code> of type <span class="idlAttrType"><a>DOMString</a></span></dt><dd>
            <p>
            See [[<cite><a href="#bib-POCO-SCHEMA" rel="biblioentry" class="bibref">POCO-SCHEMA</a></cite>] Section 7.6. <code>username</code>].
            </p>
          <div><em>No exceptions.</em></div></dd></dl></div>

        <p>
        The corresponding vCard [<cite><a href="#bib-RFC2426" rel="biblioentry" class="bibref">RFC2426</a></cite>] notation for this parameter is defined as follows:
        </p>
        <pre>     The following ABNF grammar extends the grammar found in [<cite><a href="#bib-RFC2426" rel="biblioentry" class="bibref">RFC2426</a></cite>] (Section 4).
   
     <strong>X-ACCOUNT</strong>
   
     Purpose:  To specify the components of the accounts for the vCard 
        object.

     Value type:  A single structured text value, separated by the SEMI-
        COLON character (ASCII decimal 59).

     Cardinality:  (0,n)

     Special notes:  The structured type value consists of a sequence of
        account components.  The component values must be specified in
        their corresponding position.  The structured type value
        corresponds, in sequence, to the domain; the username; the userid.
        When a component value is missing, the associated component 
        separator must still be specified.    

        The text components are separated by the SEMI-COLON character
        (ASCII decimal 59).
      
     ABNF:
   
       X-ACCOUNT-param = ; no parameter allowed
       X-ACCOUNT-value = list-component 3(";" list-component)
  </pre>

        <p>
        This parameter will be used within the Contacts API as follows:
        </p>
        <pre class="sh_javascript sh_sourceCode">     <span class="sh_keyword">var</span> contact <span class="sh_symbol">=</span> <span class="sh_symbol">...;</span> <span class="sh_comment">// ...obtain individual contact object</span>
     <span class="sh_keyword">for</span><span class="sh_symbol">(</span><span class="sh_keyword">var</span> i <span class="sh_keyword">in</span> contact<span class="sh_symbol">.</span>Xaccounts<span class="sh_symbol">)</span> <span class="sh_cbracket">{</span>
        <span class="sh_function">alert</span><span class="sh_symbol">(</span>contact<span class="sh_symbol">.</span>Xaccounts<span class="sh_symbol">[</span>i<span class="sh_symbol">].</span>domain<span class="sh_symbol">);</span>   <span class="sh_comment">// thesocialnetwork.com</span>
        <span class="sh_function">alert</span><span class="sh_symbol">(</span>contact<span class="sh_symbol">.</span>Xaccounts<span class="sh_symbol">[</span>i<span class="sh_symbol">].</span>username<span class="sh_symbol">);</span> <span class="sh_comment">// null</span>
        <span class="sh_function">alert</span><span class="sh_symbol">(</span>contact<span class="sh_symbol">.</span>Xaccounts<span class="sh_symbol">[</span>i<span class="sh_symbol">].</span>userid<span class="sh_symbol">);</span>   <span class="sh_comment">// 344aesq2</span>
     <span class="sh_cbracket">}</span>            
  </pre>

        <p>
        This parameter will be used within the vCard format [<cite><a href="#bib-RFC2426" rel="biblioentry" class="bibref">RFC2426</a></cite>]] as follows:
        </p>
        <pre>     X-ACCOUNT;thesocialnetwork.com;;344aesq2
  </pre>
      </div>
    </div>

    <div class="section" id="api-invocation-via-dom-events">
      <!--OddPage--><h2><span class="secno">7. </span>API Invocation via DOM Events</h2>

      <p>
      The API contained in this document can be invoked either programmatically (for example, inline within
      a general script) or resulting from the <a class="internalDFN" href="#dfn-interaction-of-a-user">interaction of a user</a>.
      </p>

      <p>
      The <dfn id="dfn-interaction-of-a-user">interaction of a user</dfn> is when a user invokes the API from an <a href="http://dev.w3.org/html5/markup/elements.html"><code>HTMLElement</code></a> [<cite><a href="#bib-HTML5" rel="biblioentry" class="bibref">HTML5</a></cite>] within the current
      <a class="internalDFN" href="#dfn-browsing-context">browsing context</a> via a <a class="internalDFN" href="#dfn-valid-auto-invocation-event">valid auto-invocation event</a>.
      </p>

      <p>
      A <dfn id="dfn-valid-auto-invocation-event">valid auto-invocation event</dfn> includes any of the following event types, as defined in
      [<cite><a href="#bib-DOM-LEVEL-3-EVENTS" rel="biblioentry" class="bibref">DOM-LEVEL-3-EVENTS</a></cite>]:
      </p>

      <ul>
        <li><code>click</code></li>

        <li><code>dblclick</code></li>

        <li><code>mouseup</code></li>
      </ul>

      <p>
      The <code>find()</code> method on <a href="#contacts-interface"><code>Contacts</code></a> should, if
      the method was invoked by an <a class="internalDFN" href="#dfn-interaction-of-a-user">interaction of a user</a> (as opposed to having been created and executed
      in general script), display the <a class="internalDFN" href="#dfn-contact-picker-1">Contact Picker</a> directly.
      </p>
    </div>

    <div id="user-interaction-guidelines" class="informative appendix section">
      <!--OddPage--><h2><span class="secno">A. </span>User Interaction Guidelines</h2><p><em>This section is non-normative.</em></p>

      <p>
      This specification is primarily intended to provide the user with the ability to view and control the
      contact information that may be shared from their unified address book. This annex provides some examples
      of a conformant user experience that this specification enables.
      </p>

      <div class="section" id="accessing-contact-information---example--1">
        <h3><span class="secno">A.1 </span>Accessing Contact Information - Example #1</h3>

        <p>
        A website requests access to a user's address book with the following code:
        </p>

        <div class="example">
          <pre class="sh_javascript sh_sourceCode">   <span class="sh_symbol">&lt;</span>script type<span class="sh_symbol">=</span><span class="sh_string">"text/javascript"</span><span class="sh_symbol">&gt;</span>
 
  <span class="sh_keyword">function</span> <span class="sh_function">successContactFindCallback</span><span class="sh_symbol">(</span>contacts<span class="sh_symbol">)</span> <span class="sh_cbracket">{</span>
      <span class="sh_comment">// do something with resulting contact objects</span>
      <span class="sh_keyword">for</span> <span class="sh_symbol">(</span><span class="sh_keyword">var</span> i <span class="sh_keyword">in</span> contacts<span class="sh_symbol">)</span> <span class="sh_function">alert</span><span class="sh_symbol">(</span>contacts<span class="sh_symbol">[</span>i<span class="sh_symbol">].</span>name<span class="sh_symbol">);</span>
      <span class="sh_comment">// ...</span>
  <span class="sh_cbracket">}</span>

  <span class="sh_keyword">function</span> <span class="sh_function">generalErrorCB</span><span class="sh_symbol">(</span>error<span class="sh_symbol">)</span> <span class="sh_cbracket">{</span>
      <span class="sh_comment">// do something with resulting errors</span>
      <span class="sh_function">alert</span><span class="sh_symbol">(</span>error<span class="sh_symbol">.</span>code<span class="sh_symbol">);</span>
      <span class="sh_comment">// ...</span>
  <span class="sh_cbracket">}</span>

  <span class="sh_comment">// Perform an address book search. Obtain the 'name' and 'emails' properties </span>
  <span class="sh_comment">// and initially filter the list to Contact records containing 'Bob':</span>
  navigator<span class="sh_symbol">.</span>contacts<span class="sh_symbol">.</span><span class="sh_function">find</span><span class="sh_symbol">([</span><span class="sh_string">'name'</span><span class="sh_symbol">,</span> <span class="sh_string">'emails'</span><span class="sh_symbol">],</span>
                                  successContactFindCallback<span class="sh_symbol">,</span> 
                                  generalErrorCB<span class="sh_symbol">,</span>
                                  <span class="sh_cbracket">{</span>filter<span class="sh_symbol">:</span> <span class="sh_string">'Bob'</span><span class="sh_cbracket">}</span>
                                 <span class="sh_symbol">);</span>
                               
  <span class="sh_symbol">&lt;/</span>script<span class="sh_symbol">&gt;</span>
  </pre>
        </div>

        <p>
        As a result of executing this code, the <a class="internalDFN" href="#ua">user agent</a> may provide a non-blocking <dfn id="dfn-contact-search-notification">contact
        search notification</dfn> as follows:
        </p>

        <p align="center"><img src="contacts_notification.png" alt="Contact Search Notification"><br>
        (<a href="contacts_notification.png">View as PNG</a>)
        </p>

        <p>
        If an additional find() operation is called by the current web application before the user has
        clicked 'Select' or 'Cancel' on the current notification, an error will be invoked with a code of
        <a href="#widl-ContactError-PENDING_OPERATION_ERROR"><code>PENDING_OPERATION_ERROR</code></a> if that
        operation was defined with a non-<code>null</code> <code>errorCB</code> parameter.
        </p>

        <p>
        If the user clicks 'Cancel', the <code>errorCB</code>, if non-<code>null</code> for the current
        find() operation, will be invoked with an error code of <a href="#widl-ContactError-PERMISSION_DENIED_ERROR"><code>PERMISSION_DENIED_ERROR</code></a>.
        </p>

        <p>
        If the user clicks 'Select', the <a class="internalDFN" href="#ua">user agent</a> may provide a <dfn id="dfn-contact-picker">contact picker</dfn>,
        utilizing all of the parameters provided in the find() operation as follows:
        </p>

        <p align="center"><img src="contacts_picker.png" alt="Contact Picker"><br>
        (<a href="contacts_picker.png">View as PNG</a>)
        </p>

        <p>
        In this dialog, the user is provided with a summary of the sharing that the application is
        requesting and the option to select one or more contacts (as appropriate) from the user interface.
        </p>

        <p>
        If an additional find() operation is called by the current web application before the user has
        clicked 'Select' or 'Cancel' on the current notification, an error will be invoked with a code of
        <a href="#widl-ContactError-PENDING_OPERATION_ERROR"><code>PENDING_OPERATION_ERROR</code></a> if that
        operation was defined with a non-<code>null</code> <code>errorCB</code> parameter.
        </p>

        <p>
        If the user clicks 'Cancel', the <code>errorCB</code>, if non-<code>null</code> for the current
        find() operation, will be invoked with an error code of <a href="#widl-ContactError-PERMISSION_DENIED_ERROR"><code>PERMISSION_DENIED_ERROR</code></a>.
        </p>

        <p>
        If the user clicks 'Select', the <a href="#contactfindcb-interface"><code>ContactFindCB</code></a>
        associated to the current find() operation will be invoked with the contact information selected by the
        user provided as the only parameter.
        </p>

        <p>
        Further to this initial sharing of Contact information, the <a href="#security-and-privacy-considerations">Security and Privacy Considerations</a> section expects that the
        user should easily be able to review and revoke access that web applications have to this API 
        at a later time.
        </p>
      </div>

      <div class="section" id="accessing-contact-information---example--2">
        <h3><span class="secno">A.2 </span>Accessing Contact Information - Example #2</h3>

        <p>
        A website requests access to a user's address book with the following code:
        </p>

        <div class="example">
          <pre class="sh_javascript sh_sourceCode">  <span class="sh_symbol">&lt;</span>input type<span class="sh_symbol">=</span><span class="sh_string">"button"</span> value<span class="sh_symbol">=</span><span class="sh_string">"Share Contacts"</span> onclick<span class="sh_symbol">=</span><span class="sh_string">"getContacts()"</span> <span class="sh_symbol">/&gt;</span>
 
  <span class="sh_symbol">&lt;</span>script type<span class="sh_symbol">=</span><span class="sh_string">"text/javascript"</span><span class="sh_symbol">&gt;</span>
    <span class="sh_keyword">function</span> <span class="sh_function">successContactFindCallback</span><span class="sh_symbol">(</span>contacts<span class="sh_symbol">)</span> <span class="sh_cbracket">{</span>
      <span class="sh_comment">// do something with resulting contact objects</span>
      <span class="sh_keyword">for</span> <span class="sh_symbol">(</span><span class="sh_keyword">var</span> i <span class="sh_keyword">in</span> contacts<span class="sh_symbol">)</span> <span class="sh_function">alert</span><span class="sh_symbol">(</span>contacts<span class="sh_symbol">[</span>i<span class="sh_symbol">].</span>name<span class="sh_symbol">);</span>
      <span class="sh_comment">// ...</span>
    <span class="sh_cbracket">}</span>

    <span class="sh_keyword">function</span> <span class="sh_function">generalErrorCB</span><span class="sh_symbol">(</span>error<span class="sh_symbol">)</span> <span class="sh_cbracket">{</span>
      <span class="sh_comment">// do something with resulting errors</span>
      <span class="sh_function">alert</span><span class="sh_symbol">(</span>error<span class="sh_symbol">.</span>code<span class="sh_symbol">);</span>
      <span class="sh_comment">// ...</span>
    <span class="sh_cbracket">}</span>
  
    <span class="sh_keyword">function</span> <span class="sh_function">getContacts</span><span class="sh_symbol">()</span> <span class="sh_cbracket">{</span>
      <span class="sh_comment">// Perform an address book search. Obtain the 'name' and 'emails' properties </span>
      <span class="sh_comment">// and initially filter the list to Contact records containing 'Bob':</span>
      navigator<span class="sh_symbol">.</span><span class="sh_function">contacts</span><span class="sh_symbol">(</span> <span class="sh_symbol">[</span><span class="sh_string">'name'</span><span class="sh_symbol">,</span> <span class="sh_string">'emails'</span><span class="sh_symbol">],</span>
                          successContactFindCallback<span class="sh_symbol">,</span> 
                          generalErrorCB<span class="sh_symbol">,</span>
                          <span class="sh_cbracket">{</span> filter<span class="sh_symbol">:</span> <span class="sh_string">'Bob'</span> <span class="sh_cbracket">}</span> <span class="sh_symbol">);</span> 
      <span class="sh_comment">// is equivalent to: navigator.contacts.find(/* parameters */);</span>
    <span class="sh_cbracket">}</span>
  <span class="sh_symbol">&lt;/</span>script<span class="sh_symbol">&gt;</span>
  </pre>
        </div>

        <p>
        This code may render as follows within the <a class="internalDFN" href="#ua">user agent</a>:
        </p>

        <p align="center"><img src="contacts_element.png" alt="Contact Search via DOM Events"><br>
        (<a href="contacts_element.png">View as PNG</a>)
        </p>

        <p>
        If the user clicks on the rendered button element then the <a class="internalDFN" href="#ua">user agent</a> may directly provide a
        <dfn id="dfn-contact-picker-1">contact picker</dfn>, as defined in <a href="#api-invocation-via-dom-events">API Invocation via
        DOM Events</a>, utilizing all of the parameters provided in the <code>find()</code> operation as
        follows:
        </p>

        <p align="center"><img src="contacts_picker.png" alt="Contact Picker"><br>
        (<a href="contacts_picker.png">View as PNG</a>)
        </p>

        <p>
        In this dialog, the user is provided with a summary of the sharing that the application is
        requesting and the option to select one or more contacts (as appropriate) from the user interface.
        </p>

        <p>
        If an additional find() operation is called by the current web application before the user has
        clicked 'Select' or 'Cancel' on the current notification, an error will be invoked with a code of
        <a href="#widl-ContactError-PENDING_OPERATION_ERROR"><code>PENDING_OPERATION_ERROR</code></a> if that
        operation was defined with a non-<code>null</code> <code>errorCB</code> parameter.
        </p>

        <p>
        If the user clicks 'Cancel', the <code>errorCB</code>, if non-<code>null</code> for the current
        find() operation, will be invoked with an error code of <a href="#widl-ContactError-PERMISSION_DENIED_ERROR"><code>PERMISSION_DENIED_ERROR</code></a>.
        </p>

        <p>
        If the user clicks 'Select', the <a href="#contactfindcb-interface"><code>ContactFindCB</code></a>
        associated to the current find() operation will be invoked with the contact information selected by the
        user provided as the only parameter.
        </p>

        <p>
        Further to this initial sharing of Contact information, the <a href="#security-and-privacy-considerations">Security and Privacy Considerations</a> section expects that the
        user should easily be able to review and revoke access that web applications have to this API 
        at a later time.
        </p>
      </div>
    </div>

    <div id="adding-and-updating-contacts" class="informative appendix section">
      <!--OddPage--><h2><span class="secno">B. </span>Adding and Updating Contacts</h2><p><em>This section is non-normative.</em></p>

      <p>
      The ability to add and update contact information is not a function of the API provided in this
      specification. Instead, the intention is to reuse existing web platform APIs and paradigms in order to
      acheive add and update functionality.
      </p>

      <p>
      In this section we show how the existing web platform would be used to provide add and update
      writeback functionality to allow users to add new contacts or update existing contacts from a web page to
      their unified address book.
      </p>

      <p>
      A <dfn id="dfn-valid-contact-resource">valid Contact resource</dfn> is a web resource with a <code>.vcard</code> or <code>.vcf</code>
      filename extension or a web resource with a MIME-type matching a <a class="internalDFN" href="#dfn-valid-media-type">valid media type</a>. A <dfn id="dfn-vcard-object">vCard
      object</dfn> is a text-based representation of contact information provided according to any version of
      the vCard family of specifications.
      </p>

      <p class="note">Need to add informative references to all specs within the 'vCard family of
      specifications'.
      </p>

      <p>
      To handle the saving of a new Contact, a <a class="internalDFN" href="#ua">user agent</a> should register as the default handler for
      any <a class="internalDFN" href="#dfn-valid-contact-resource">valid Contact resource</a>.
      </p>

      <p>
      A <dfn id="dfn-valid-media-type">valid media type</dfn> will be one of the following web resource MIME types:
      </p>

      <ul>
        <li><code>text/vcard</code></li>
        <li><code>text/x-vcard</code></li>
        <li><code>text/directory</code></li>
        <li><code>text/directory;profile=vCard</code></li>
      </ul>

      <p>
      On invocation of a <a class="internalDFN" href="#dfn-valid-contact-resource">valid Contact resource</a>, the <a class="internalDFN" href="#ua">user agent</a> should, on successful download
      of the <a class="internalDFN" href="#dfn-valid-contact-resource">valid Contact resource</a>, store the given resource in the user's unified address book
      according to the <a class="internalDFN" href="#dfn-rule-for-storing-a-contact-resource">rule for storing a Contact resource</a>. As part of this standard download process,
      the <a class="internalDFN" href="#ua">user agent</a> may present a dialog to the user allowing them to select a different application
      with which to handle the given resource, thereby overriding the use of the unified address book for the
      storage of the data contained therein and bypassing the <a class="internalDFN" href="#dfn-rule-for-storing-a-contact-resource">rule for storing a Contact resource</a>.
      </p>

      <p>
      The <dfn id="dfn-rule-for-storing-a-contact-resource">rule for storing a Contact resource</dfn> is defined as follows:
      </p>

      <p>
      Let <var>Contact</var> be the parsed key/value pairs contained in the <a class="internalDFN" href="#dfn-valid-contact-resource">valid Contact
      resource</a>.
      </p>

      <ol>
        <li>If <var>Contact</var> contains a <code>UID</code> key then process the <a class="internalDFN" href="#dfn-valid-contact-resource">valid Contact
        resource</a> as follows.

          <ol>
            <li>Let <var>MatchedContact</var> be the result of obtaining a Contact object from the user's
            unified address book that matches exactly the value of the <code>UID</code> provided.</li>

            <li>If a <var>MatchedContact</var> has been found (i.e <var>MatchedContact</var> is
            not-<code>null</code>) then update the contents of <var>MatchedContact</var> with the contents of
            <var>Contact</var> and exit this rule.</li>
          </ol>
        </li>

        <li>Save the contents of <var>Contact</var> in the user's unified address book as a new Contact
        object.</li>
      </ol>

      <p>
      As part of the <a class="internalDFN" href="#dfn-rule-for-storing-a-contact-resource">rule for storing a Contact resource</a>, the <a class="internalDFN" href="#ua">user agent</a> may provide
      additional dialogs to the user after successful completion of the download and before the Contact
      information is saved to the unified address book, such as to show a preview of the Contact information
      contained therein as it will be stored in the user's unified address book. The user may be able to
      override the information provided before accepting the additions and permanently storing the given data
      in their unified address book.
      </p>

      <div id="adding-a-new-contact" class="informative section">
        <h3><span class="secno">B.1 </span>Adding a new Contact</h3><p><em>This section is non-normative.</em></p>

        <p>
        A web page can dynamically generate a <a class="internalDFN" href="#dfn-vcard-object">vCard object</a> on the client side for download to the
        user's unified address book via either data: URIs [<cite><a href="#bib-RFC2397" rel="biblioentry" class="bibref">RFC2397</a></cite>] or using the [<cite><a href="#bib-FILE-WRITER" rel="biblioentry" class="bibref">FILE-WRITER</a></cite>] and
        [<cite><a href="#bib-FILE-API" rel="biblioentry" class="bibref">FILE-API</a></cite>] interfaces. The following examples show two methods for creating a <a class="internalDFN" href="#dfn-vcard-object">vCard object</a>
        dynamically and then presenting this to the user. The user may then save this information by clicking
        on the presented information, download the dynamically generated <a class="internalDFN" href="#dfn-vcard-object">vCard object</a> and invoke a
        suitable application with which to handle the dynamic resource.
        </p>

        <div class="example">
          <pre class="sh_javascript sh_sourceCode">  <span class="sh_symbol">&lt;</span>a id<span class="sh_symbol">=</span><span class="sh_string">"vcard"</span><span class="sh_symbol">&gt;</span>Save our Contact Details<span class="sh_symbol">&lt;/</span>a<span class="sh_symbol">&gt;</span>

  <span class="sh_symbol">&lt;</span>script type<span class="sh_symbol">=</span><span class="sh_string">"text/javascript"</span><span class="sh_symbol">&gt;</span>
    <span class="sh_keyword">var</span> vcard <span class="sh_symbol">=</span> <span class="sh_string">'BEGIN:VCARD</span><span class="sh_specialchar">\r\n</span><span class="sh_string">'</span> <span class="sh_symbol">+</span>
                <span class="sh_string">'VERSION:2.1</span><span class="sh_specialchar">\r\n</span><span class="sh_string">'</span> <span class="sh_symbol">+</span>
                <span class="sh_string">'N:Doe;John</span><span class="sh_specialchar">\r\n</span><span class="sh_string">'</span> <span class="sh_symbol">+</span>
                <span class="sh_string">'FN:John Doe</span><span class="sh_specialchar">\r\n</span><span class="sh_string">'</span> <span class="sh_symbol">+</span>
                <span class="sh_string">'TEL;WORK;VOICE:123456</span><span class="sh_specialchar">\r\n</span><span class="sh_string">'</span> <span class="sh_symbol">+</span>
                <span class="sh_string">'END:VCARD'</span><span class="sh_symbol">;</span>

    <span class="sh_comment">// assign vCard as a Data URI to an anchor element for presentation and download by the user</span>
    document<span class="sh_symbol">.</span><span class="sh_function">getElementById</span><span class="sh_symbol">(</span><span class="sh_string">'vcard'</span><span class="sh_symbol">).</span>href <span class="sh_symbol">=</span> <span class="sh_string">"data:text/x-vcard;charset=utf-8,"</span> <span class="sh_symbol">+</span> <span class="sh_predef_func">encodeURIComponent</span><span class="sh_symbol">(</span> vcard <span class="sh_symbol">);</span> 
  <span class="sh_symbol">&lt;/</span>script<span class="sh_symbol">&gt;</span>
  </pre>
        </div>

        <div class="example">
          <pre class="sh_javascript sh_sourceCode">  <span class="sh_symbol">&lt;</span>a id<span class="sh_symbol">=</span><span class="sh_string">"vcard"</span><span class="sh_symbol">&gt;</span>Save our Contact Details<span class="sh_symbol">&lt;/</span>a<span class="sh_symbol">&gt;</span>

  <span class="sh_symbol">&lt;</span>script type<span class="sh_symbol">=</span><span class="sh_string">"text/javascript"</span><span class="sh_symbol">&gt;</span>
    <span class="sh_comment">// obtain an ArrayBuffer consisting of valid vCard syntax (out of scope)</span>
    <span class="sh_keyword">var</span> vCardObj <span class="sh_symbol">=</span> <span class="sh_function">getVCard</span><span class="sh_symbol">(</span> <span class="sh_comment">/* ... */</span> <span class="sh_symbol">);</span>
            
    <span class="sh_comment">// create a new vCard Blob [</span><cite><a href="#bib-FILE-WRITER" rel="biblioentry" class="bibref"><span class="sh_comment">FILE-WRITER</span></a></cite><span class="sh_comment">]</span>
    <span class="sh_keyword">var</span> contactBlobBuilder <span class="sh_symbol">=</span> <span class="sh_keyword">new</span> <span class="sh_function">BlobBuilder</span><span class="sh_symbol">();</span>
    contactBlobBuilder<span class="sh_symbol">.</span><span class="sh_function">append</span><span class="sh_symbol">(</span> vCardObj <span class="sh_symbol">);</span>
    <span class="sh_keyword">var</span> contactBlob <span class="sh_symbol">=</span> contactBlobBuilder<span class="sh_symbol">.</span><span class="sh_function">getBlob</span><span class="sh_symbol">(</span> <span class="sh_string">"text/x-vcard"</span> <span class="sh_symbol">);</span>

    <span class="sh_comment">// obtain a vCard Blob URL [</span><cite><a href="#bib-FILE-API" rel="biblioentry" class="bibref"><span class="sh_comment">FILE-API</span></a></cite><span class="sh_comment">]</span>
    <span class="sh_keyword">var</span> contactBlobURL <span class="sh_symbol">=</span> window<span class="sh_symbol">.</span>URL<span class="sh_symbol">.</span><span class="sh_function">createObjectUrl</span><span class="sh_symbol">(</span> contactBlob <span class="sh_symbol">);</span>

    <span class="sh_comment">// assign vCard Blob URL to an anchor element for presentation and download by the user</span>
    document<span class="sh_symbol">.</span><span class="sh_function">getElementById</span><span class="sh_symbol">(</span><span class="sh_string">'vcard'</span><span class="sh_symbol">).</span>href <span class="sh_symbol">=</span> contactBlobURL<span class="sh_symbol">;</span> 
  <span class="sh_symbol">&lt;/</span>script<span class="sh_symbol">&gt;</span>
  </pre>
        </div>
      </div>

      <div id="updating-an-existing-contact" class="informative section">
        <h3><span class="secno">B.2 </span>Updating an existing Contact</h3><p><em>This section is non-normative.</em></p>

        <p>
        To update an existing Contact, the user must have already shared the contact information to edit
        with the current web page via the <a href="#widl-Contacts-find-caller-void-DOMStringArray-fields-ContactFindCB-successCB-ContactErrorCB-errorCB-ContactFindOptions-options">find()</a> operation of the <a href="#contacts-interface"><code>Contacts</code></a> interface. This section assumes that the user is
        already sharing some contact information with the current web page via this process.
        </p>

        <p>
        If this existing Contact information is to be updated in the user's unified address book then the
        developer will assign the <code>id</code> attribute, as returned in the <code>Contact</code> object, as
        the <code>UID</code> property of any resulting <a class="internalDFN" href="#dfn-vcard-object">vCard object</a> to be processed by the <a class="internalDFN" href="#ua">user
        agent</a> according to the <a class="internalDFN" href="#dfn-rule-for-storing-a-contact-resource">rule for storing a Contact resource</a>.
        </p>

        <p>
        The examples below show two methods for updating an existing Contact in the user's unified address
        book by maintaining a valid UID property while changing other parameters of the Contact card. The user
        is then required to click on the resulting anchor element to download the modified Contact
        resource.
        </p>

        <div class="example">
          <pre class="sh_javascript sh_sourceCode">  <span class="sh_symbol">&lt;</span>a id<span class="sh_symbol">=</span><span class="sh_string">"vcard"</span><span class="sh_symbol">&gt;</span>Save our Contact Details<span class="sh_symbol">&lt;/</span>a<span class="sh_symbol">&gt;</span>

  <span class="sh_symbol">&lt;</span>script type<span class="sh_symbol">=</span><span class="sh_string">"text/javascript"</span><span class="sh_symbol">&gt;</span>
    <span class="sh_comment">// Obtain a single existing Contact object resulting from navigator.contacts.find()</span>
    <span class="sh_keyword">var</span> existingContactObj <span class="sh_symbol">=</span> <span class="sh_symbol">...;</span>
  
    <span class="sh_keyword">var</span> vcard <span class="sh_symbol">=</span> <span class="sh_string">'BEGIN:VCARD</span><span class="sh_specialchar">\r\n</span><span class="sh_string">'</span> <span class="sh_symbol">+</span>
                <span class="sh_string">'VERSION:3.0</span><span class="sh_specialchar">\r\n</span><span class="sh_string">'</span> <span class="sh_symbol">+</span>
                <span class="sh_string">'UID:'</span> <span class="sh_symbol">+</span> existingContactObj<span class="sh_symbol">.</span>id <span class="sh_symbol">+</span> <span class="sh_string">'</span><span class="sh_specialchar">\r\n</span><span class="sh_string">'</span> <span class="sh_symbol">+</span> <span class="sh_comment">// assign the Contact.id to a UID property   </span>
                <span class="sh_string">'N:Doe;John</span><span class="sh_specialchar">\r\n</span><span class="sh_string">'</span> <span class="sh_symbol">+</span>
                <span class="sh_string">'FN:John Doe</span><span class="sh_specialchar">\r\n</span><span class="sh_string">'</span> <span class="sh_symbol">+</span>
                <span class="sh_string">'TEL;HOME;VOICE:654321</span><span class="sh_specialchar">\r\n</span><span class="sh_string">'</span> <span class="sh_symbol">+</span>
                <span class="sh_string">'END:VCARD'</span><span class="sh_symbol">;</span>

    <span class="sh_comment">// assign vCard as a Data URI to an anchor element for presentation and download by the user</span>
    document<span class="sh_symbol">.</span><span class="sh_function">getElementById</span><span class="sh_symbol">(</span><span class="sh_string">'vcard'</span><span class="sh_symbol">).</span>href <span class="sh_symbol">=</span> <span class="sh_string">"data:text/x-vcard;charset=utf-8,"</span> <span class="sh_symbol">+</span> <span class="sh_predef_func">encodeURIComponent</span><span class="sh_symbol">(</span> vcard <span class="sh_symbol">);</span> 
  <span class="sh_symbol">&lt;/</span>script<span class="sh_symbol">&gt;</span>
  </pre>
        </div>

        <div class="example">
          <pre class="sh_javascript sh_sourceCode">  <span class="sh_symbol">&lt;</span>a id<span class="sh_symbol">=</span><span class="sh_string">"vcard"</span><span class="sh_symbol">&gt;</span>Update our Contact Details<span class="sh_symbol">&lt;/</span>a<span class="sh_symbol">&gt;</span>

  <span class="sh_symbol">&lt;</span>script type<span class="sh_symbol">=</span><span class="sh_string">"text/javascript"</span><span class="sh_symbol">&gt;</span>
    <span class="sh_comment">// Obtain a single existing Contact object resulting from navigator.contacts.find()</span>
    <span class="sh_keyword">var</span> existingContactObj <span class="sh_symbol">=</span> <span class="sh_symbol">...;</span>
  
    <span class="sh_comment">// Modify some parameters as required. e.g. add a new phone number</span>
    existingContactObj<span class="sh_symbol">.</span>phoneNumbers<span class="sh_symbol">.</span><span class="sh_function">push</span><span class="sh_symbol">(</span><span class="sh_cbracket">{</span>
      type<span class="sh_symbol">:</span> <span class="sh_string">'home'</span><span class="sh_symbol">,</span> 
      value<span class="sh_symbol">:</span> <span class="sh_string">'654321'</span>
    <span class="sh_cbracket">}</span><span class="sh_symbol">);</span>

    <span class="sh_comment">// With the existing Contact object, create an ArrayBuffer consisting of valid vCard </span>
    <span class="sh_comment">// syntax (out of scope) making sure to set the resulting vCard UID property to </span>
    <span class="sh_comment">// the id parameter returned in the existing Contact object</span>
    <span class="sh_keyword">var</span> vCardObj <span class="sh_symbol">=</span> <span class="sh_function">getVCard</span><span class="sh_symbol">(</span> existingContactObj <span class="sh_symbol">);</span>

    <span class="sh_comment">// create a new vCard Blob [</span><cite><a href="#bib-FILE-WRITER" rel="biblioentry" class="bibref"><span class="sh_comment">FILE-WRITER</span></a></cite><span class="sh_comment">]</span>
    <span class="sh_keyword">var</span> contactBlobBuilder <span class="sh_symbol">=</span> <span class="sh_keyword">new</span> <span class="sh_function">BlobBuilder</span><span class="sh_symbol">();</span>
    contactBlobBuilder<span class="sh_symbol">.</span><span class="sh_function">append</span><span class="sh_symbol">(</span> vCardObj <span class="sh_symbol">);</span>
    <span class="sh_keyword">var</span> contactBlob <span class="sh_symbol">=</span> contactBlobBuilder<span class="sh_symbol">.</span><span class="sh_function">getBlob</span><span class="sh_symbol">(</span> <span class="sh_string">"text/x-vcard"</span> <span class="sh_symbol">);</span>

    <span class="sh_comment">// obtain a vCard Blob URL [</span><cite><a href="#bib-FILE-API" rel="biblioentry" class="bibref"><span class="sh_comment">FILE-API</span></a></cite><span class="sh_comment">]</span>
    <span class="sh_keyword">var</span> contactBlobURL <span class="sh_symbol">=</span> window<span class="sh_symbol">.</span>URL<span class="sh_symbol">.</span><span class="sh_function">createObjectUrl</span><span class="sh_symbol">(</span> contactBlob <span class="sh_symbol">);</span>

    <span class="sh_comment">// assign vCard Blob URL to an anchor element for presentation and download by the user</span>
    document<span class="sh_symbol">.</span><span class="sh_function">getElementById</span><span class="sh_symbol">(</span><span class="sh_string">'vcard'</span><span class="sh_symbol">).</span>href <span class="sh_symbol">=</span> contactBlobURL<span class="sh_symbol">;</span> 
  <span class="sh_symbol">&lt;/</span>script<span class="sh_symbol">&gt;</span>
  </pre>
        </div>
      </div>
    </div>
  

<div class="appendix section" id="references"><!--OddPage--><h2><span class="secno">C. </span>References</h2><div class="section" id="normative-references"><h3><span class="secno">C.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-DOM-LEVEL-3-EVENTS">[DOM-LEVEL-3-EVENTS]</dt><dd>Björn Höhrmann; Tom Pixley; Philippe Le Hégaret. <a href="http://www.w3.org/TR/2011/WD-DOM-Level-3-Events-20110531/"><cite>Document Object Model (DOM) Level 3 Events Specification.</cite></a> 31 May 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2011/WD-DOM-Level-3-Events-20110531/">http://www.w3.org/TR/2011/WD-DOM-Level-3-Events-20110531/</a> 
</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Ian Hickson; David Hyatt. <a href="http://www.w3.org/TR/2011/WD-html5-20110525/"><cite>HTML5.</cite></a> 25 May 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2011/WD-html5-20110525/">http://www.w3.org/TR/2011/WD-html5-20110525/</a> 
</dd><dt id="bib-RFC2119">[RFC2119]</dt><dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in RFCs to Indicate Requirement Levels.</cite></a> March 1997. Internet RFC 2119.  URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a> 
</dd><dt id="bib-WEBIDL">[WEBIDL]</dt><dd>Cameron McCormack. <a href="http://www.w3.org/TR/2008/WD-WebIDL-20081219"><cite>Web IDL.</cite></a> 19 December 2008. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2008/WD-WebIDL-20081219">http://www.w3.org/TR/2008/WD-WebIDL-20081219</a> 
</dd></dl></div><div class="section" id="informative-references"><h3><span class="secno">C.2 </span>Informative references</h3><dl class="bibliography"><dt id="bib-FILE-API">[FILE-API]</dt><dd>Arun Ranganathan. <a href="http://www.w3.org/TR/2009/WD-FileAPI-20091117/"><cite>File API.</cite></a> 17 November 2009. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2009/WD-FileAPI-20091117/">http://www.w3.org/TR/2009/WD-FileAPI-20091117/</a> 
</dd><dt id="bib-FILE-WRITER">[FILE-WRITER]</dt><dd>Eric Uhrhane. <a href="http://dev.w3.org/2009/dap/file-system/file-writer.html"><cite>File Writer API.</cite></a> W3C Working Draft. (Work in progress.) URL: <a href="http://dev.w3.org/2009/dap/file-system/file-writer.html">http://dev.w3.org/2009/dap/file-system/file-writer.html</a> 
</dd><dt id="bib-NAVIGATOR">[NAVIGATOR]</dt><dd>Ian Hickson, David Hyatt. <a href="http://dev.w3.org/html5/spec/timers.html#navigator"><cite>Navigator interface in HTML5.</cite></a> 15 April 2011. Editors' draft. (Work in progress.) URL: <a href="http://dev.w3.org/html5/spec/timers.html#navigator">http://dev.w3.org/html5/spec/timers.html#navigator</a> 
</dd><dt id="bib-OMA-CAB">[OMA-CAB]</dt><dd>Converged Address Book Enabler, Version 1.0, Open Mobile Alliance, URL: http://www.openmobilealliance.org/
</dd><dt id="bib-POCO-SCHEMA">[POCO-SCHEMA]</dt><dd>Joseph Smarr. <a href="http://portablecontacts.net/draft-spec.html#schema"><cite>Portable Contacts 1.0 Draft C: Contact Schema</cite></a> 5 August 2008. URL: <a href="http://portablecontacts.net/draft-spec.html#schema">http://portablecontacts.net/draft-spec.html#schema</a> 
</dd><dt id="bib-RFC2397">[RFC2397]</dt><dd>L. Masinter. <a href="http://www.ietf.org/rfc/rfc2397.txt"><cite>The "data" URL scheme.</cite></a> August 1998. Internet RFC 2397. URL: <a href="http://www.ietf.org/rfc/rfc2397.txt">http://www.ietf.org/rfc/rfc2397.txt</a> 
</dd><dt id="bib-RFC2426">[RFC2426]</dt><dd>F. Dawson, T. Howes. <a href="http://www.ietf.org/rfc/rfc2426.txt"><cite>vCard MIME Directory Profile.</cite></a> September 1998. URL: <a href="http://www.ietf.org/rfc/rfc2426.txt">http://www.ietf.org/rfc/rfc2426.txt</a> 
</dd><dt id="bib-WIDGETS">[WIDGETS]</dt><dd>Marcos Caceres. <a href="http://www.w3.org/TR/2009/CR-widgets-20091201/"><cite>Widget Packaging and Configuration.</cite></a> 01 December 2009. W3C Candidate Recommendation. (Work in progress.) URL: <a href="http://www.w3.org/TR/2009/CR-widgets-20091201/">http://www.w3.org/TR/2009/CR-widgets-20091201/</a> 
</dd></dl></div></div></body></html>