question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SupportError: `TypeError: range.getClientRects is not a function

See original GitHub issue

Expectation: Pass or fail the color-contrast rule check.

Actual: color-contrast was uncompleted. Receive the SupportError: TypeError: range.getClientRects is not a function - feature unsupported in your environment. Skipping color-contrast rule.

Motivation: Solve the support error. Do not skipping the color-contrast rule.


axe-core version: 4.0.2

Browser and Assistive Technology versions

For Tooling issues:
- User AgentMozilla/5.0 (darwin) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/16.4.0
- Platform:  Mac

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
strakercommented, Nov 23, 2020

Thanks for the test example. I confirmed that JSDOM doesn’t seem to support Range.getClientRects() as logging the output of what’s on Range gives me this:

Range: Range {}
Range.selectNodeContents: [Function: selectNodeContents]
Range.getClientRects: undefined

As JSDOM lacks support for the feature, there’s not much we can do (as we correctly handle the error and report its unsupport in the environment). The only workaround we can suggest is turning off the color contrast rule.

await axe.run({ rules: {  'color-contrast': { enabled: false }}})
0reactions
siyuancncommented, Nov 23, 2020

i’m sorry for my later reply. I got the error with a very simple testing code.

message: ‘TypeError: range.getClientRects is not a function - feature unsupported in your environment. Skipping color-contrast rule.’,

const data = "<html><head><title>Hello</title></head><body>Testing</body></html>";

const { JSDOM } = jsdom;
const dom = new JSDOM(data);

const body = dom.window.document.querySelector('body');

axe.configure({
  reporter: 'v2',
});

return await axe.run(body);

The jsdom version is: 16.4.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

jQuery UI error - f.getClientRects is not a function
It's extremely weird. jQuery.Deferred exception: elem.getClientRects is not a function TypeError: elem.getClientRects ...
Read more >
axe-core/axe.js - chromium/src/third_party - Git at Google
console.log('Could not create a template function: ' + str); ... throw new TypeError('executor must be a function.'); ... throw new SupportError({.
Read more >
Uncaught TypeError: r.getClientRects is not a function
The error console keeps showing Uncaught TypeError: r.getClientRects is not a function every time the popup fires. Any help here would be great....
Read more >
2731373-43.patch - Drupal
If a copy of the MPL was not distributed with this + * file, You can obtain one at ... 'function') { +...
Read more >
Commits from Samsung - GitHub Pages
2022-07-25, chromium, Add empty check while getting range for character index ... 2020-01-08, chromium, input type=date with max below min should not allow ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found