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

Don't call public API methods; instead call their backing algorithms #55

Closed
domenic opened this issue Oct 9, 2015 · 7 comments · Fixed by #501
Closed

Don't call public API methods; instead call their backing algorithms #55

domenic opened this issue Oct 9, 2015 · 7 comments · Fixed by #501

Comments

@domenic
Copy link

domenic commented Oct 9, 2015

A few places in the spec refer to public API methods:

The DOMRect corresponding to the target’s getBoundingClientRect().

Let boundingClientRect be the value of target.getBoundingClientRect().

For each observer in node’s internal [[RegisteredIntersectionObservers]] slot, invoke unobserve() on observer, passing in node as target.

This is not quite the right thing to do, since it implies that e.g. if I do Element.prototype.getBoundingClientRect = () => { throw new Error("boo"); }, you'll call that overriden function.

Instead, the correct thing to do is to refer to the backing concept or algorithm behind that method. For unobserve, you'd probably define something in the processing model like

"To remove an intersection observer o from an Element target, perform the following steps: ..."

Then unobserve() algorithm would do "Remove the intersection observer this from target," and instead of doing "invoke unobserve()," you would do a similar thing.

For getBoundingClientRect(), things are more annoying, since CSSOM View hasn't factored themselves appropriately. There you could do something like "Let boundingClientRect be a DOMRectReadonly obtained by the same algorithm as that of Element's getBoundingClientRect() performed on target."

@mpb
Copy link
Collaborator

mpb commented Nov 6, 2015

Fixed unobserve() in #67.

Not sure the best way to address getBoundingClientRect().

@ojanvafai
Copy link
Collaborator

For getBoudningClientRect lets used Domenic's text and file a bug against cssom-view asking for a name for this algorithm so we can refer to it directly.

@mpb
Copy link
Collaborator

mpb commented Nov 12, 2015

Added Dominic's text in #71.

@domfarolino
Copy link
Member

For getBoudningClientRect lets used Domenic's text and file a bug against cssom-view asking for a name for this algorithm so we can refer to it directly.

Has this been done?

@szager-chromium
Copy link
Collaborator

I filed a bug on cssom-view:

w3c/csswg-drafts#5614

@annevk
Copy link
Member

annevk commented Oct 14, 2020

I'm reopening this as it's not fixed. (And #401 got closed so I guess this is preferred.)

@miketaylr
Copy link
Member

I sent in a PR to cssom-view, w3c/csswg-drafts#7446

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants