Squashed commit of the following:

commit 1f58495619b3d8eae3df0a6f7e01d205cea14fc7
Author: Jared Jurkiewicz <jared.jurkiewicz@gmail.com>
Date:   Thu Jun 26 11:03:00 2014 -0400

    Fix issue with parentNode as null, fixes #18130

(cherry picked from commit a69c33ce3a88417995e6b5086f2648d6492e3616)