-
Notifications
You must be signed in to change notification settings - Fork 715
[cssom-view] Algorithm of Element.offsetParent
#409
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
Comments
cc @zcorpan |
Do browsers do something differently for this? |
Firefox currently returns the containing block of absolutely-positioned descendant, Chrome seems to follow what the spec says. |
Thanks. Do you have a test case at hand so we can also check WebKit and Edge? |
No at this moment, but I can create one later today if needed. |
Per the definition at https://drafts.csswg.org/css-position/#containing-block "the containing block is established by the nearest ancestor with a position other than static" (or ICB, in which case |
Actually, I'd argue that a fixed-positioned element caught by an ancestor with |
This is a testcase with which we can compare behavior of different engines: https://bugzilla.mozilla.org/attachment.cgi?id=8781553 It seems WebKit always returns |
And Edge always returns |
I discussed this with @rune-opera and @mstensho-opera and they said they think the Gecko behavior makes most sense. I tend to agree. We can make the spec say "first ancestor which is a containing block of absolutely-positioned descendants" instead. But would be good to hear from WebKit and Edge people also. @hober, @atanassov ? |
WebKit's code is here: https://trac.webkit.org/browser/trunk/Source/WebCore/rendering/RenderObject.cpp#L1869 |
@smfr Looking at the code, I think it should mostly match Blink's behavior. Not sure why the testcase shows something different... Anyway, what do you think about the proposal of changing the algorithm here? |
Sorry, I retract what I just said, the test case isn't working properly for us because we do not support setting the style property as a string, we just don't throw when you do it but it has no effect. In addition, we do not support Here is what we actually return for cases we support:
|
Blink code here, FYI. |
The current spec says
offsetParent
should return an ancestor ifIt doesn't seem to me it is quite useful to query an ancestor who has some specific
position
value. Isn't it supposed to return the first ancestor which is a containing block of absolutely-positioned descendants?The text was updated successfully, but these errors were encountered: