W3C home > Mailing lists > Public > public-test-infra@w3.org > April to June 2017

Recommended way to force layout in a test?

From: Koji Ishii <kojii@chromium.org>
Date: Wed, 19 Apr 2017 14:06:46 +0900
Message-ID: <CACQRE+SidaAetcQZpywNe4S7vHVxn3JN3Zon9kgEUyZfMUc4Yw@mail.gmail.com>
To: public-test-infra <public-test-infra@w3.org>
Hi all,

Sorry if this was discussed before, but is there a recommended way to force
layout in a test?

A common use case is to test invalidation of a CSS properties, such as:

<style>
#e { a-css-property: abc; }
</style>
<div id=e></div>
<script>
window.onload = function () {
  /* force layout here */
  e.style.aCssProperty = 'xyz';
}
</script>

and this should render the same as:

<style>
#e { a-css-property: xyz; }
</style>

In Blink and WebKit, it's known that `document.body.offsetTop` forces
layout, and this technique is used in some internal tests.

Since such tests are useful for other implementations too, I wonder if
there's a good way to make such tests interoperable and upstream to wpt.

Opinions appreciated in advance.
Received on Wednesday, 19 April 2017 05:07:56 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:34:13 UTC