void HTMLContentElement::attach()
{
    ShadowRoot* root = toShadowRoot(shadowTreeRootNode());

    // Before calling StyledElement::attach, selector must be calculated.
    if (root) {
        HTMLContentSelector* selector = root->ensureSelector();
        selector->unselect(m_selections.get());
        selector->select(this, m_selections.get());
    }

    HTMLElement::attach();

    if (root) {
        for (HTMLContentSelection* selection = m_selections->first(); selection; selection = selection->next())
            selection->node()->attach();
    }
}