(browserId, result, footnote)
| 545 | |
| 546 | // Function to print out a single <td> result cell. |
| 547 | function resultCell(browserId, result, footnote) { |
| 548 | if (!browsers[browserId]) { |
| 549 | throw new Error(browserId + " is not found\n- Did you mean \"" + closestString(Object.keys(browsers), browserId) + "\"?"); |
| 550 | } |
| 551 | result = testValue(result); |
| 552 | |
| 553 | // Create the cell, and add classes and attributes |
| 554 | var cell = $('<td></td>'); |
| 555 | cell.addClass({ |
| 556 | 'true': "yes", |
| 557 | 'false': "no", |
| 558 | 'undefined': 'unknown', |
| 559 | 'tally': 'tally', |
| 560 | 'flagged': 'no flagged', |
| 561 | 'needs-polyfill-or-native': 'no needs-polyfill-or-native', |
| 562 | 'strict': 'no strict', |
| 563 | 'null': 'unknown', |
| 564 | }[result] || ''); |
| 565 | if (result === "needs-polyfill-or-native") { |
| 566 | cell.attr('title', "Requires native support or a polyfill."); |
| 567 | } else if (result === "strict") { |
| 568 | cell.attr('title', "Support for this feature incorrectly requires strict mode."); |
| 569 | } |
| 570 | |
| 571 | cell.attr('data-browser', browserId).addClass( |
| 572 | browsers[browserId].obsolete ? "obsolete" : |
| 573 | browsers[browserId].unstable ? "unstable" : |
| 574 | ""); |
| 575 | |
| 576 | // Add extra signifiers if the result is not applicable. |
| 577 | if (isOptional(t.category) && |
| 578 | // Annex B is only optional for non-browsers. |
| 579 | (t.category.indexOf("annex b")===-1 || (browsers[browserId].platformtype && |
| 580 | "desktop|mobile".indexOf(browsers[browserId].platformtype) === -1 && |
| 581 | !browsers[browserId].needs_annex_b))) { |
| 582 | var msg = ( |
| 583 | t.category === STAGE2 |
| 584 | ? "This proposal has not yet reached stage 2" |
| 585 | : "This feature is optional on non-browser platforms" |
| 586 | ) + ", and doesn't contribute to the platform's support percentage."; |
| 587 | cell.attr('title', msg); |
| 588 | cell.addClass("not-applicable"); |
| 589 | } |
| 590 | |
| 591 | if (result !== 'tally') { |
| 592 | cell.text({ |
| 593 | strict: 'Strict', |
| 594 | flagged: 'Flag', |
| 595 | 'true': 'Yes', |
| 596 | 'false': 'No', |
| 597 | }[result] || '?'); |
| 598 | } |
| 599 | |
| 600 | if (footnote) { |
| 601 | cell.append(footnote); |
| 602 | } |
| 603 | return cell; |
| 604 | } |
no test coverage detected