[go: nahoru, domu]

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

[css-values] Value of rem when document have no root element #936

Closed
upsuper opened this issue Jan 16, 2017 · 1 comment
Closed

[css-values] Value of rem when document have no root element #936

upsuper opened this issue Jan 16, 2017 · 1 comment

Comments

@upsuper
Copy link
Member
upsuper commented Jan 16, 2017

It is not specced that what should happen when there is no root element in a document, and one tries to compute value of rem unit.

For example given the following code:

<!DOCTYPE html>
<iframe src="about:blank"></iframe>
<script>
  window.onload = function() {
    var win = document.querySelector('iframe').contentWindow;
    var doc = document.querySelector('iframe').contentDocument;
    var b = doc.body;
    doc.documentElement.style.fontSize = '24px';
    b.style.lineHeight = '2rem';
    doc.removeChild(doc.documentElement);
    alert('line-height: ' + win.getComputedStyle(b).lineHeight);
  };
</script>

Gecko and Edge shows 48px, and Blink shows empty.

@tabatkins
Copy link
Member

Fixed now - we folded the root-finding into the same bit as the parent-finding (for 'em' in 'font-size'), and so if there is no root, it ends up looking at the initial values.

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

No branches or pull requests

2 participants