Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#11431 closed defect (worksforme)

[patch][cla]dojox.dtl.dom.tag test_tag_ifequal test fails

Reported by: ben hockey Owned by: Neil Roberts
Priority: high Milestone: 1.7
Component: DojoX DTL Version: 1.5.0b2
Keywords: dohfail Cc:
Blocked By: Blocking:

Description

the dojox.dtl.dom.tag test_tag_ifequal test fails with the following error:

     _AssertFailure: http://127.0.0.1:8000/dojo%20trunk/dojo/_base/_loader/bootstrap.js:581 doh._AssertFailure: assertEqual() failed:
 	expected
		<div><ul><li><span>apple</span><br/><p>red</p></li><li><label>Name: <input name="name" value="banana"/></label><br/><label>Color: <textarea name="color">yellow</textarea></label></li><li><span>pear</span><br/><p>green</p></li><li><span>kiwi</span><br/><p>brown</p></li></ul></div>
	but got
		<div><ul><li><span>apple</span><br/><p>red</p></li><li><label>Name: <input name="name" value="{{ item.name }}"/></label><br/><label>Color: <textarea name="color">yellow</textarea></label></li><li><span>pear</span><br/><p>green</p></li><li><span>kiwi</span><br/><p>brown</p></li></ul></div>

this problem is caused by dojo.attr setting the *property* on the node rather than the *attribute* when it sets value. i don't want to enter into the debate of how dojo.attr should work but that is just to describe what is happening.

this problem becomes a real pain when you try to parse widgets. say, for example you have something like this:

<div dojoType="dijit.form.TextBox parsed" name="name" value="{{ note.name }}"></div>

the value="{{ note.name }}" ends up effectively setting node.value property to be equal to the parsed value of note.name via a call to dojo.attr in DomBuffer.setAttribute but leaves the value attribute unchanged. then when dojo.parser is used to instantiate the widget, it uses node.getAttribute to get the value attribute. this ends up setting the widget's value to "{{ note.name }}".

a solution might be to treat value as a special case and in addition to calling dojo.attr make an explicit call to setAttribute for the node as well. i've attached a patch that would do this.

Attachments (1)

11431.diff (404 bytes) - added by ben hockey 9 years ago.

Download all attachments as: .zip

Change History (6)

Changed 9 years ago by ben hockey

Attachment: 11431.diff added

comment:1 Changed 9 years ago by ben hockey

Component: GeneralDojoX DTL
Owner: changed from anonymous to Neil Roberts

comment:2 Changed 8 years ago by bill

Keywords: dohfail added

comment:3 Changed 8 years ago by ben hockey

Resolution: fixed
Status: newclosed

this patch seems to have been applied at some point.

comment:4 Changed 8 years ago by Adam Peller

Milestone: tbd1.7

comment:5 Changed 8 years ago by Adam Peller

Resolution: fixedworksforme
Note: See TracTickets for help on using tickets.