3 <title>Test for bug
1658302: We don't reframe for placeholder attribute value changes.
</title>
4 <link rel=
"author" href=
"mailto:emilio@crisal.io" title=
"Emilio Cobos Álvarez">
5 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
7 <textarea id=
"textarea"></textarea>
9 SimpleTest
.waitForExplicitFinish();
10 const utils
= SpecialPowers
.DOMWindowUtils
;
12 function expectReframe(shouldHaveReframed
, callback
) {
13 document
.documentElement
.offsetTop
;
14 const previousConstructCount
= utils
.framesConstructed
;
15 const previousReflowCount
= utils
.framesReflowed
;
19 document
.documentElement
.offsetTop
;
20 isnot(previousReflowCount
, utils
.framesReflowed
, "We should have reflowed");
21 (shouldHaveReframed
? isnot
: is
)(previousConstructCount
,
22 utils
.framesConstructed
,
23 `We should ${shouldHaveReframed ? "" : "not"} have reframed`);
26 for (const control
of document
.querySelectorAll("input, textarea")) {
27 // Creating the placeholder attribute reframes right now.
29 // TODO: Could be avoided with some more work.
30 expectReframe(true, () => {
31 control
.placeholder
= "foo";
34 // Incrementally changing it should not reframe, just reflow.
35 expectReframe(false, () => {
36 control
.placeholder
= "bar";
39 // Removing the placeholder attribute reframes right now.
41 // TODO: Could maybe be avoided with some more work.
42 expectReframe(true, () => {
43 control
.removeAttribute("placeholder");