w3c / w3c/webdriver

Replace obsolete ToInteger() for checking an Integer

Open
#1,295 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
718
Forks
228
PR merge metrics
No merged PRs in 30d

Description

As by the spec the method ToInteger() should be used to check if the given Number is an integer.

https://w3c.github.io/webdriver/#dfn-integer

An integer is a Number that is unchanged under the ToInteger operation.

But the MDN web docs claim this method to be obsolete, and it never reached the ES6 final specification:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toInteger

As such an alternative should be used. Also given that we shouldn't directly compare an integer and a float, Number.EPSILON might have to be taken into account. But maybe this is neglected given that no-one might specify a timeout with such a precision.

What's in the ECMAScript specification for a long time is toFixed(), which is supported by every browser.

I propose the following:

An integer is a Number that is unchanged under the toFixed operation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests. Start with the WebDriver integer definition and compare its ToInteger reference with the cited ECMAScript and MDN material, then trace where the definition is used in the specification. Done means agreeing on a standards-compatible replacement and updating all affected wording consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.