MCPcopy Create free account
hub / github.com/angular/components / getCellElement

Function getCellElement

src/material/datepicker/calendar-body.ts:634–645  ·  view source on GitHub ↗

* Gets the date table cell element that is or contains the specified element. * Or returns null if element is not part of a date cell.

(element: HTMLElement)

Source from the content-addressed store, hash-verified

632 * Or returns null if element is not part of a date cell.
633 */
634function getCellElement(element: HTMLElement): HTMLElement | null {
635 let cell: HTMLElement | undefined;
636 if (isTableCell(element)) {
637 cell = element;
638 } else if (isTableCell(element.parentNode)) {
639 cell = element.parentNode as HTMLElement;
640 } else if (isTableCell(element.parentNode?.parentNode)) {
641 cell = element.parentNode!.parentNode as HTMLElement;
642 }
643
644 return cell?.getAttribute('data-mat-row') != null ? cell : null;
645}
646
647/** Checks whether a value is the start of a range. */
648function isStart(value: number, start: number | null, end: number | null): boolean {

Callers 2

MatCalendarBodyClass · 0.85
_getCellFromElementMethod · 0.85

Calls 2

isTableCellFunction · 0.85
getAttributeMethod · 0.65

Tested by

no test coverage detected