BHV-14856: Guard against uncreated DOM node. Also, optimization to prevent repeated calculation of popup bounds

### Issue
An error was thrown when the direction of a `moon.ContextualPopup` was set before the popup had been shown for the first time.

### Fix
We guard against accessing an undefined node by adding a conditional check in `alterDirection` that examines the `showing` property. This also adds an optimization to prevent unnecessary calculation of bounds when the popup is not showing and/or when the popup is being hidden.

Enyo-DCO-1.1-Signed-off-by: Aaron Tam <aaron.tam@lge.com>