Unifying code between JSRenderElementImpl and BSRenderElementImpl