1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38

content / test / data / accessibility / html / label-updates.html [blame]

<!--
@WAIT-FOR:finished
@BLINK-DENY:nameFrom*
-->
<!DOCTYPE html>
<html>
<body>
  <input id="input1">
  <label id="label1" aria-hidden="true" for="input1"><span><span>apples</span></span></label>

  <input id="input2">
  <label id="label2" aria-hidden="true" for="input2"><span><span>apples</span></span></label>

  <input id="input3">
  <label id="label3" aria-hidden="true" for="input3">grapes</label>

  <input id="input4">
</div>

<script>
  setTimeout(() => {
    const label1 = document.getElementById('label1');
    label1.firstElementChild.firstElementChild.innerText = 'oranges';
    const label2 = document.getElementById('label2');
    label2.firstElementChild.firstElementChild.innerText = 'oranges';

    const label3 = document.getElementById('label3');
    const text3 = label3.firstChild;
    text3.deleteData(0,5);  // Delete 'grape'
    text3.insertData(0,'banana');  // Text should now be 'bananas'
    setTimeout(() => {
      const input4 = document.getElementById('input4');
      input4.setAttribute('aria-label', 'finished');
    }, 0);
  }, 100);
</script>
</body>
</html>