W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2008

Change Event, Bubbling and IE8

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Thu, 10 Jul 2008 20:29:40 -0700
Message-ID: <c9e12660807102029h787bc07doa26ab6baa3abd47f@mail.gmail.com>
To: "DOM mailing list" <www-dom@w3.org>

This is a compliance issue with Internet Explorer.

If a change event can bubble, what can it bubble up to?

Will it be possible to observe a bubbled change on a FORM?

http://www.w3.org/TR/DOM-Level-2-Events/events.html


| change
|    The change event occurs when a control loses the input
| focus and its value has been modified since gaining focus.
| This event is valid for INPUT, SELECT, and TEXTAREA. element.
|
|        * Bubbles: Yes
|        * Cancelable: No
|        * Context Info: None



Internet Explorer 8 still does not support EventTarget, however, it
does support bubbling.

The result below from Safari3 and Firefox3 are that the change and
submit events bubble and alerts are shown.

IE8: No alert shown.


=============================================================================

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> Change </title>
</head>

<body>

<h1>Form Dirty?</h1>

<form id='big'>

  <fieldset id="ff"><legend>legend</legend>
  <select name='big'>
    <option>one</option>
    <option>two</option>
  </select>

  <textarea name="a">foo</textarea>
  <label>
    <input type="radio" name="df"/>radio
  </label>
    <input type="radio" name="df"/>radio
  <input type="checkbox"/>
  <input type='text'/>
  <input type="password"/>
  <input type="submit" value="go"/>
</fieldset>

</form>

<script>
  var big = document.getElementById('big');

  if(big.addEventListener) {
    big.addEventListener("change", getTimeStamp, true);
    big.attachEvent("submit", getTimeStamp, true);
  } else if(big.attachEvent) {
    big.attachEvent("onchange",  getTimeStamp, true);
    window.attachEvent("submit", getTimeStamp, true);
  }
  function getTimeStamp(e){
      alert(e.timeStamp);
  }
</script>

</body>
</html>
=============================================================================

If MSIE is not going to implement DOM Events, what should be the
expected behavior of MSIE?

Garrett
Received on Friday, 11 July 2008 03:30:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:59 GMT