Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#10345 closed defect (fixed)

Bug IE dojo.attr with events (or doc omission)

Reported by: piopier Owned by: Eugene Lazutkin
Priority: low Milestone: 1.4.1
Component: Documentation Version: 1.3.2
Keywords: Cc:
Blocked By: Blocking:

Description

When passing a string as an event property in dojo.attr or dojo.create (e.g dojo.attr(n, "onclick", "myfunction(myparam);") )

the event launches on FF but not on IE. Seems to be due to the fact that dojo.attr code uses "n.setAttribute" in this case, instead of "d.connect" .

This should either be corrected, or the documentation could simply specify that attaching an event with dojo.attr/dojo.connect REQUIRES to use a function and not a string.

Change History (10)

comment:1 Changed 10 years ago by dante

Milestone: tbdfuture
Owner: changed from anonymous to Eugene Lazutkin

comment:2 Changed 10 years ago by Eugene Lazutkin

Milestone: future1.4
Resolution: fixed
Status: newclosed

It looks like it was fixed in the course of other ticket. Please reopen with a test case if you can reproduce the bug.

comment:3 Changed 10 years ago by piopier

Resolution: fixed
Status: closedreopened

comment:4 Changed 10 years ago by piopier

I tried with Dojo 1.4, the bug still appears.

comment:5 Changed 10 years ago by Adam Peller

Do you have a test case?

comment:6 Changed 10 years ago by piopier

Very simple : the following page displays the alert box on FF3.5, it doesn't on IE7.

<html>
<head>
<script type='text/javascript' src='js/dojo/dojo.js'></script>
</head>
<body><form>
<p id='abc'></p>
<script>
dojo.create("span",{innerHTML:"click here...",onclick:"alert('onclick works');"},"abc");
</script>
</form></body></html>

comment:7 Changed 10 years ago by Eugene Lazutkin

Milestone: 1.41.4.1

Yeah, it looks like the documentation should be more explicit about functions rather than strings for event handlers.

comment:8 Changed 10 years ago by Eugene Lazutkin

Component: CoreDocumentation

comment:9 Changed 10 years ago by Eugene Lazutkin

Resolution: fixed
Status: reopenedclosed

Done.

comment:10 Changed 9 years ago by Eugene Lazutkin

(In [21195]) dojox.gfx: copying fixes to 1.4.x branch, !strict, refs #10345, refs #9815, refs #9858, refs #10353, refs #10632.

Note: See TracTickets for help on using tickets.