diff --git a/common/changes/@uifabric/utilities/keco-mark-setPortalAttribute-public_2018-09-10-21-17.json b/common/changes/@uifabric/utilities/keco-mark-setPortalAttribute-public_2018-09-10-21-17.json new file mode 100644 index 00000000000000..281da775b60ee9 --- /dev/null +++ b/common/changes/@uifabric/utilities/keco-mark-setPortalAttribute-public_2018-09-10-21-17.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "@uifabric/utilities", + "comment": "Mark setPortalAttribute dom utility function as public to fix undefined runtime error.", + "type": "patch" + } + ], + "packageName": "@uifabric/utilities", + "email": "keco@microsoft.com" +} \ No newline at end of file diff --git a/packages/utilities/src/dom.ts b/packages/utilities/src/dom.ts index e9143b3ec597e1..0de632697c2495 100644 --- a/packages/utilities/src/dom.ts +++ b/packages/utilities/src/dom.ts @@ -76,10 +76,7 @@ export function getVirtualParent(child: HTMLElement): HTMLElement | undefined { * @public */ export function getParent(child: HTMLElement, allowVirtualParents: boolean = true): HTMLElement | null { - return ( - child && - ((allowVirtualParents && getVirtualParent(child)) || (child.parentNode && (child.parentNode as HTMLElement))) - ); + return child && ((allowVirtualParents && getVirtualParent(child)) || (child.parentNode && (child.parentNode as HTMLElement))); } /** @@ -112,11 +109,7 @@ export function getChildren(parent: HTMLElement, allowVirtualChildren: boolean = * * @public */ -export function elementContains( - parent: HTMLElement | null, - child: HTMLElement | null, - allowVirtualParents: boolean = true -): boolean { +export function elementContains(parent: HTMLElement | null, child: HTMLElement | null, allowVirtualParents: boolean = true): boolean { let isContained = false; if (parent && child) { @@ -209,6 +202,7 @@ export function getRect(element: HTMLElement | Window | null): IRectangle | unde /** * Identify element as a portal by setting an attribute. * @param element Element to mark as a portal. + * @public */ export function setPortalAttribute(element: HTMLElement): void { element.setAttribute(DATA_PORTAL_ATTRIBUTE, 'true'); @@ -235,10 +229,7 @@ export function portalContainsElement(target: HTMLElement, parent?: HTMLElement) * @param matchFunction the function that determines if the element is a match * @returns the matched element or null no match was found */ -export function findElementRecursive( - element: HTMLElement | null, - matchFunction: (element: HTMLElement) => boolean -): HTMLElement | null { +export function findElementRecursive(element: HTMLElement | null, matchFunction: (element: HTMLElement) => boolean): HTMLElement | null { if (!element || element === document.body) { return null; }