* Compares the position of two validation errors by the position of their corresponding field * binding directive in the DOM. * - For errors with multiple field bindings, the earliest one in the DOM will be used for comparison. * - For errors that have no field bindings, they will be considered t
( a: ValidationError.WithFieldTree, b: ValidationError.WithFieldTree, )
| 433 | * - For errors that have no field bindings, they will be considered to come after all other errors. |
| 434 | */ |
| 435 | function compareErrorPosition( |
| 436 | a: ValidationError.WithFieldTree, |
| 437 | b: ValidationError.WithFieldTree, |
| 438 | ): number { |
| 439 | const aEl = getFirstBoundElement(a); |
| 440 | const bEl = getFirstBoundElement(b); |
| 441 | if (aEl === bEl) return 0; |
| 442 | if (aEl === undefined || bEl === undefined) return aEl === undefined ? 1 : -1; |
| 443 | return aEl.compareDocumentPosition(bEl) & Node.DOCUMENT_POSITION_PRECEDING ? 1 : -1; |
| 444 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…