summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/selectors/selector-placeholder-shown-emptify-placeholder.html
blob: 17316ede264776061e9b890cbaf839fa32a51ae0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html>
<title>When non-empty placeholder becomes empty, :placeholder-shown test</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://drafts.csswg.org/selectors-4/#placeholder">
<input id="myinput" type="text" placeholder="FAIL">
<textarea id="mytextarea" placeholder="FAIL"></textarea>
<script>
test(() => {
  const input = document.querySelector("input");
  input.placeholder = "";
  input.value = "NO RED";
  assert_false(input.matches(":placeholder-shown"));
}, "input:placeholder-shown should not be matched");

test(() => {
  const textarea = document.querySelector("textarea");
  textarea.placeholder = "";
  textarea.value = "No RED";
  assert_false(textarea.matches(":placeholder-shown"));
}, "textarea:placeholder-shown should not be matched");
</script>