summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/selectors/pseudo-classes/utils.js
blob: a8b1cd62a81842b8721774a3ff80ea1de95de349 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function getElementsByIds(ids) {
  var result = [];
  ids.forEach(function(id) {
    result.push(document.getElementById(id));
  });
  return result;
}

function testSelectorIdsMatch(selector, ids, testName) {
  test(function(){
    var elements = document.querySelectorAll(selector);
    assert_array_equals(elements, getElementsByIds(ids));
  }, testName);
}

function testSelectorElementsMatch(selector, elements, testName) {
  test(function(){
    assert_array_equals(document.querySelectorAll(selector), elements);
  }, testName);
}