* If link is available, builds the anchor. Otherwise, it'd return a basic span. * @param {string} text * @param {?string} link * @return {!Element}
(text, link)
| 214 | * @return {!Element} |
| 215 | */ |
| 216 | function buildLinkMaybe(text, link) { |
| 217 | let element; |
| 218 | if (link) { |
| 219 | element = document.createElement('a'); |
| 220 | element.setAttribute('href', link); |
| 221 | element.setAttribute('target', '_blank'); |
| 222 | } else { |
| 223 | element = document.createElement('span'); |
| 224 | } |
| 225 | element.textContent = text; |
| 226 | return element; |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * Updates states of all experiments in the table. |
no test coverage detected