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

offsetParent never returns an inline element. #15102

Open
Permutatrix opened this issue Jan 18, 2017 · 1 comment
Open

offsetParent never returns an inline element. #15102

Permutatrix opened this issue Jan 18, 2017 · 1 comment

Comments

@Permutatrix
Copy link
Contributor

@Permutatrix Permutatrix commented Jan 18, 2017

<!DOCTYPE html>
<style>
  .parent {
    position: relative;
  }
</style>
<div class="parent">
  <span class="parent">
    <span id="this">ABC</span>
  </span>
</div>
<span class="parent">
  <div>
    <span id="that">ABC</span>
  </div>
</span>
<script>
  // should be: SPAN. Gecko: SPAN. KHTML/WebKit/Blink: SPAN. Servo: DIV.
  console.log(document.getElementById('this').offsetParent.tagName);
  // should be: SPAN. Gecko: SPAN. KHTML/WebKit/Blink: BODY. Servo: BODY.
  console.log(document.getElementById('that').offsetParent.tagName);
</script>

This can't be properly addressed until #13982 is fixed, because without reliable information about where an inline element starts and ends, the query code can't identify descendants of that element.

@stshine
Copy link
Contributor

@stshine stshine commented Jan 24, 2017

I suggest to treat inline-level element and block-level element separately like how we do it in the layout system. That is, when query an element you should first determine whether it is an inline-level or block-level element, and use different logic for the two situations.

Not sure this will actually work, but it should have some value.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.