korimo / firewatir

Automatically exported from code.google.com/p/firewatir
0 stars 0 forks source link

patch to fix event firing (uses DOM events) #43

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently FireWatir's fire_event method relies on the old, deprecated event
style.

For example:

<input type="text" name="test1" id="test1"
    onclick="alert('Hello!')" />

However, events are now more commonly added using the DOM, like this:

<input type="text" name="test2" id="test2" />
<script type="text/javascript">
document.getElementById('test2').addEventListener('click', 
        function(ev) {alert('Hello!')},
        true
    );
</script>

The current implementation of the fire_event method will fail to fire the
'onclick' event in 'test2'. The attached patch fixes this, so that events
are now triggered using the DOM rather than by looking for the old
'onevent' style invocations.

Additionally, the patch changes the behaviour of the 'set' method for
radios and checkboxes. The method now only sets (i.e. checks) the control,
rather than just toggling it. This is the correct behaviour as defined in
the original Watir API.

I've tested the patch against all of the unit tests and it looks like it works.

Original issue reported on code.google.com by matt.zuk...@gmail.com on 3 Oct 2007 at 7:51

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the patch. Updated code in SVN

Original comment by ang...@gmail.com on 4 Oct 2007 at 1:02