(lineNumber)
| 291 | } |
| 292 | |
| 293 | highlightLine(lineNumber) { |
| 294 | if (this.currentLine === lineNumber) return; |
| 295 | |
| 296 | if (this.currentLine !== null) { |
| 297 | const prevLine = this.codeContainer.querySelector( |
| 298 | `[data-line="${this.currentLine}"]`, |
| 299 | ); |
| 300 | if (prevLine) prevLine.classList.remove("highlighted"); |
| 301 | } |
| 302 | |
| 303 | if (lineNumber === null || lineNumber === undefined) { |
| 304 | this.currentLine = null; |
| 305 | return; |
| 306 | } |
| 307 | |
| 308 | this.currentLine = lineNumber; |
| 309 | const newLine = this.codeContainer.querySelector( |
| 310 | `[data-line="${lineNumber}"]`, |
| 311 | ); |
| 312 | if (newLine) { |
| 313 | newLine.classList.add("highlighted"); |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | reset() { |
| 318 | this.highlightLine(null); |
no test coverage detected