Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing features for DOMRect API #11679

Merged
merged 6 commits into from
Aug 10, 2021

Conversation

queengooborg
Copy link
Contributor

This PR is a part of a project to add missing interfaces and interface features to BCD that are from an active spec (including WICG specs) and is supported in at least one browser. This particular PR adds the missing features of the DOMRect API, populating the results using data from the mdn-bcd-collector project (v3.2.1).

Tests Used: https://mdn-bcd-collector.appspot.com/tests/api/DOMRect

This PR is a part of a project to add missing interfaces and interface features to BCD that are from an active spec (including WICG specs) and is supported in at least one browser.  This particular PR adds the missing features of the DOMRect API, populating the results using data from the [mdn-bcd-collector](https://mdn-bcd-collector.appspot.com) project (v3.2.1).

Tests Used: https://mdn-bcd-collector.appspot.com/tests/api/DOMRect
@github-actions github-actions bot added the data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label Jul 22, 2021
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated
"spec_url": "https://drafts.fxtf.org/geometry/#dom-domrectreadonly-height",
"support": {
"chrome": {
"version_added": "61"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": "61"
"version_added": "2"

For the properties that were on ClientRect, I think we should mark support as going back that far. That's what we do with other prefixed and alt.name. entries.

api/DOMRect.json Outdated
"version_added": "27"
},
"ie": {
"version_added": false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version_added": false,
"version_added": "4",

And no note needed. These were copied from DOMRectReadOnly.json but I think we should remove everything about ClientRect from there, including the notes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've sent #11694 for that.

@foolip
Copy link
Contributor

foolip commented Jul 23, 2021

One important fact when reviewing this is to know what properties ClientRect originally had. I've tested in IE 11, Safari 4 and Firefox 10 and all have top, right, bottom, left, width and height. I'll assume this was universally true for all ClientRect implementations.

Copy link
Contributor

@foolip foolip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that Samsung Internet 8.0 was probably wrong, and then more :)

There's a problem with treating ClientRect as an alias I didn't realize before, I'll write a separate comment.

api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Show resolved Hide resolved
@foolip
Copy link
Contributor

foolip commented Jul 23, 2021

Trying to make the data consistently represent the earlier support of ClientRect runs into a problem. As mentioned above, ClientRect had 6 properties. But only width and height are on DOMRect (and DOMRectReadOnly), the other 4 (top, right, bottom, left) are on DOMRectReadOnly only.

This means that we'd need to treat ClientRect as an old alias of both DOMRect and DOMRectReadOnly, but I just removed the latter in #11694.

It's tempting to say we should just forget about ClientRect and ClientRectList, but doing that will make BCD inconsistent, seemingly claiming support of APIs like getBoundingClientRect() before its return type is supported.

@ddbeck @Elchi3 do you have thoughts on how to handle this?

@ddbeck ddbeck self-requested a review July 27, 2021 15:54
@ddbeck
Copy link
Collaborator

ddbeck commented Aug 3, 2021

Hmm. My initial reaction is to favor consistency, even though it's a bit of a hassle to reinstate what you just removed. This isn't even so much for the benefit of being outwardly consistent as it is for not doing surprising things that we'll stumble upon later.

@ddbeck ddbeck removed their request for review August 3, 2021 10:43
Co-authored-by: Philip Jägenstedt <[email protected]>
foolip added a commit to foolip/browser-compat-data that referenced this pull request Aug 10, 2021
Since the properties top, right, bottom and left are on DOMRectReadOnly,
it's necessary to treat ClientRect as an alias of both DOMRect and
DOMRectReadOnly. See discussion starting here:
mdn#11679 (comment)

This reverts mdn#11694 but
goes much further in representing the ClientRect support than before.
@foolip
Copy link
Contributor

foolip commented Aug 10, 2021

Hmm. My initial reaction is to favor consistency, even though it's a bit of a hassle to reinstate what you just removed. This isn't even so much for the benefit of being outwardly consistent as it is for not doing surprising things that we'll stumble upon later.

It was a bit of a hassle, but I've sent #11960 now. I think having the alias in both places is the right call in the end.

api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
api/DOMRect.json Outdated Show resolved Hide resolved
@foolip foolip merged commit 230e430 into mdn:main Aug 10, 2021
@queengooborg queengooborg deleted the api/DOMRect/additions branch August 10, 2021 20:00
ddbeck pushed a commit that referenced this pull request Aug 18, 2021
Since the properties top, right, bottom and left are on DOMRectReadOnly,
it's necessary to treat ClientRect as an alias of both DOMRect and
DOMRectReadOnly. See discussion starting here:
#11679 (comment)

This reverts #11694 but
goes much further in representing the ClientRect support than before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants