<!DOCTYPE html>
<html>
<body>
This tests removing a Attr node inside a shadow tree. WebKit should not hit any assertions.
<script>

if (window.testRunner)
    testRunner.dumpAsText();

function createAttrInShadowTree()
{
    const host = document.createElement('div');
    document.body.appendChild(host);
    const shadowRoot = host.attachShadow({mode: 'closed'});
    shadowRoot.innerHTML = '<span title="foo"></span>';
    const span = shadowRoot.firstChild;
    const attr = span.attributes[0];
    span.removeAttribute('title');
    span.setAttribute('lang', 'en');
    host.remove();
    return attr;
}

(function () { const attr = createAttrInShadowTree(); })();
if (window.GCController)
    GCController.collect();

document.write('PASS');

</script>
</body>
</html>
