This project is archived and is in readonly mode.

#339 ✓invalid
Roderick

Selector with onmouseover (Bug in IE)

Reported by Roderick | August 27th, 2008 @ 09:48 PM | in 2.0 (closed)

The following code throws an error in IE (not in FF3, Safari 3.1, Opera 9.50). The problem is "a[onmouseover^=alert]".


window.addEvent('domready', function() {
  $('container').getElements('a[onmouseover^=alert]').each(function(item) {
    alert(item);
  });
});


<div id="container">
		<a href="#" onmouseover="alert('test');">Test</a><br />
		<a href="#" onmouseover="alert('test');">Test</a><br />
		<a href="#" onmouseover="alert('test');">Test</a><br />
</div>

Comments and changes to this ticket

  • Christoph Pojer

    Christoph Pojer March 14th, 2009 @ 12:15 AM

    • State changed from “new” to “invalid”

    on* events are not intended to be used with selectors and most probably breaks unexpectedly. Also, don't use inline events.

  • Justen

    Justen June 23rd, 2010 @ 03:34 AM

    • Assigned user changed from “Valerio” to “Christoph Pojer”

    on* events are not intended to be used with selectors and most probably breaks unexpectedly. Also, don't use inline events.

    This sort of non-solution wasn't satisfying to me for a number of reasons. I needed to supersede some inline events without replacing all of them in a ton of files in a large application while working under time constraints. Anyway, point being, I found a solution. It will take a bit of work to roll it into the selectors engine, but it's a start. This is sufficient for replicating [onmouseover*=] functionality in IE.. If you trim off the leading few lines and the last line in the results you should be able to do more precise matching.

    @@@ Javascript var att = element.getAttribute('onmouseover');
    if(typeof(att) == 'function') att = att.toString();

    
    

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Pages