Import fixes from ShadowDOM repository (https://github.com/Polymer/ShadowDOM/commit/6badf10005399113b49a20b4103127a567bce680 and https://github.com/Polymer/ShadowDOM/commit/df3bde23fae815959b65e959bed6d55ff458a2ef)
Merge pull request #1234 from dinhviethoa/1193-shadow-polyfill-dom-fixes

Import fixes from ShadowDOM repository