public boolean addShadowRootBefore(ShadowElement shadow, ShadowElement insertBefore) { if (shadow == null) { throw new IllegalArgumentException("Shadow element cannot be null!"); } if (insertBefore == null) return addShadowRoot(shadow); if (insertBefore.getShadowHost() != this) throw new UiException("Wrong shadow host [" + insertBefore + "]"); AuxInfo auxinf = initAuxInfo(); if (!auxinf.seRoots.contains(shadow)) { auxinf.seRoots.add(auxinf.seRoots.indexOf(insertBefore), shadow); return true; } return false; }