chromium/third_party/blink/web_tests/fast/forms/resources/common-pseudo-classes.js

function matchedNodesContainId(root, selector, expectedId) {
    var matchedNodes = root.querySelectorAll(selector);
    for (var i = 0; i < matchedNodes.length; ++i) {
        if (matchedNodes[i].id == expectedId)
            return true;
    }
    return false;
}