(error: ValidationError.WithFieldTree)
| 414 | } |
| 415 | |
| 416 | function getFirstBoundElement(error: ValidationError.WithFieldTree) { |
| 417 | if (error.formField) return error.formField.element; |
| 418 | return error |
| 419 | .fieldTree() |
| 420 | .formFieldBindings() |
| 421 | .reduce<HTMLElement | undefined>((el: HTMLElement | undefined, binding) => { |
| 422 | if (!el || !binding.element) return el ?? binding.element; |
| 423 | return el.compareDocumentPosition(binding.element) & Node.DOCUMENT_POSITION_PRECEDING |
| 424 | ? binding.element |
| 425 | : el; |
| 426 | }, undefined); |
| 427 | } |
| 428 | |
| 429 | /** |
| 430 | * Compares the position of two validation errors by the position of their corresponding field |
no test coverage detected
searching dependent graphs…