Opened 9 years ago

Closed 4 years ago

#11202 closed defect (patchwelcome)

IE8 multiple DTL test failures

Reported by: haysmark Owned by: Neil Roberts
Priority: low Milestone: 1.13
Component: DojoX DTL Version: 1.5.0b2
Keywords: dohfail needsreview Cc:
Blocked By: Blocking:

Description

See:

http://archive.dojotoolkit.org/nightly/checkout/util/doh/runner.html?testModule=dojox.dtl.tests.module

Unfortunately all IE8 reports in the above link about the error is [Object Error]. I tweaked the failing tests to catch the exceptions and log everything on them, here is what I get in the console regarding the failing tests:

LOG: name:TypeError
LOG: message:'undefined' is null or not an object
LOG: number:-2146823281
LOG: description:'undefined' is null or not an object
  [object Error]
LOG: debug: 	ERROR IN:
		 function test_filter_date(t){
			try{
			var dd = dojox.dtl;
			var context = new dd.Context({ now: new Date(2007, 0, 1), then: new Date(2007, 1, 1) });

			var tpl = new dd.Template('{{ now|date }}');
			t.is(dojox.dtl.utils.date.format(context.now, "N j, Y"), tpl.render(context));

			context.then = new Date(2007, 0, 1);
			tpl = new dd.Template('{{ now|date:"d" }}');
			t.is("01", tpl.render(context));

			tpl = new dd.Template('{{ now|date:"D" }}');
			t.is("Mon", tpl.render(context));

			tpl = new dd.Template('{{ now|date:"j" }}');
			t.is("1", tpl.render(context));

			tpl = new dd.Template('{{ now|date:"l" }}');
			t.is("Monday", tpl.render(context));

			tpl = new dd.Template('{{ now|date:"N" }}');
			t.is("Jan.", tpl.render(context));

			tpl = new dd.Template('{{ now|date:"S" }}');
			t.is("st", tpl.render(context));
			context.now.setDate(2);
			t.is("nd", tpl.render(context));
			context.now.setDate(3);
			t.is("rd", tpl.render(context));
			context.now.setDate(4);
			t.is("th", tpl.render(context));
			context.now.setDate(5);
			t.is("th", tpl.render(context));
			context.now.setDate(6);
			t.is("th", tpl.render(context));
			context.now.setDate(7);
			t.is("th", tpl.render(context));
			context.now.setDate(8);
			t.is("th", tpl.render(context));
			context.now.setDate(9);
			t.is("th", tpl.render(context));
			context.now.setDate(10);
			t.is("th", tpl.render(context));
			context.now.setDate(11);
			t.is("th", tpl.render(context));
			context.now.setDate(12);
			t.is("th", tpl.render(context));
			context.now.setDate(13);
			t.is("th", tpl.render(context));
			context.now.setDate(14);
			t.is("th", tpl.render(context));
			context.now.setDate(15);
			t.is("th", tpl.render(context));
			context.now.setDate(16);
			t.is("th", tpl.render(context));
			context.now.setDate(17);
			t.is("th", tpl.render(context));
			context.now.setDate(18);
			t.is("th", tpl.render(context));
			context.now.setDate(19);
			t.is("th", tpl.render(context));
			context.now.setDate(20);
			t.is("th", tpl.render(context));
			context.now.setDate(21);
			t.is("st", tpl.render(context));
			context.now.setDate(22);
			t.is("nd", tpl.render(context));
			context.now.setDate(23);
			t.is("rd", tpl.render(context));
			context.now.setDate(24);
			t.is("th", tpl.render(context));
			context.now.setDate(25);
			t.is("th", tpl.render(context));
			context.now.setDate(26);
			t.is("th", tpl.render(context));
			context.now.setDate(27);
			t.is("th", tpl.render(context));
			context.now.setDate(28);
			t.is("th", tpl.render(context));
			context.now.setDate(29);
			t.is("th", tpl.render(context));
			context.now.setDate(30);
			t.is("th", tpl.render(context));
			context.now.setDate(31);
			t.is("st", tpl.render(context));
			context.now.setDate(1);

			tpl = new dd.Template('{{ now|date:"w" }}');
			t.is("1", tpl.render(context));

			tpl = new dd.Template('{{ now|date:"z" }}');
			t.is("0", tpl.render(context));
		
			tpl = new dd.Template('{{ now|date:"W" }}');
			t.is("1", tpl.render(context));
			}catch(e){
				for(var i in e){
					console.log(i+":"+e[i]);
				}
				throw e;
			}
		}
LOG: debug: FAILED test: test_filter_date 0 ms

LOG: name:TypeError
LOG: message:'undefined' is null or not an object
LOG: number:-2146823281
LOG: description:'undefined' is null or not an object
  [object Error]
LOG: debug: 	ERROR IN:
		 function test_filter_time(t){
			try{
			var dd = dojox.dtl;
			var context = new dd.Context({ now: new Date(2007, 0, 1) });

			tpl = new dd.Template('{{ now|time }}');
			t.is(dojox.dtl.utils.date.format(context.now, "P"), tpl.render(context));
			}catch(e){
				for(var i in e){
					console.log(i+":"+e[i]);
				}
				throw e;
			}
		}
LOG: debug: FAILED test: test_filter_time 0 ms

LOG: name:TypeError
LOG: message:'undefined' is null or not an object
LOG: number:-2146823281
LOG: description:'undefined' is null or not an object
  [object Error]
LOG: debug: 	ERROR IN:
		 function test_tag_ifchanged(t){
			try{
			var dd = dojox.dtl;

			var context = new dd.Context({
				year: 2008,
				days: [
					new Date(2008, 0, 12),
					new Date(2008, 0, 28),
					new Date(2008, 1, 1),
					new Date(2008, 1, 1),
					new Date(2008, 1, 1)
				]
			});

			var template = new dd.Template("<h1>Archive for {{ year }}</h1>"+
"{% for date in days %}"+
'{% ifchanged %}<h3>{{ date|date:"F" }}</h3>{% endifchanged %}'+
'<a href="{{ date|date:\'M/d\'|lower }}/">{{ date|date:\'j\' }}</a>'+
"{% endfor %}");
			t.is('<h1>Archive for 2008</h1>'+
'<h3>January</h3>'+
'<a href="jan/12/">12</a>'+
'<a href="jan/28/">28</a>'+
'<h3>February</h3>'+
'<a href="feb/01/">1</a>'+
'<a href="feb/01/">1</a>'+
'<a href="feb/01/">1</a>', template.render(context));

			template = new dd.Template('{% for date in days %}'+
'{% ifchanged date.date %} {{ date.date }} {% endifchanged %}'+
'{% ifchanged date.hour date.date %}'+
'{{ date.hour }}'+
'{% endifchanged %}'+
'{% endfor %}');
			t.is(' 2008-01-12 0 2008-01-28 0 2008-02-01 0', template.render(context));
			}catch(e){
				for(var i in e){
					console.log(i+":"+e[i]);
				}
				throw e;
			}
		}
LOG: debug: FAILED test: test_tag_ifchanged 0 ms

LOG: name:TypeError
LOG: message:'undefined' is null or not an object
LOG: number:-2146823281
LOG: description:'undefined' is null or not an object
  [object Error]
LOG: debug: 	ERROR IN:
		 function test_tag_now(t){
			try{
			var dd = dojox.dtl;

			var template = new dd.Template('It is {% now "jS F Y H:i" %}');
			t.t(template.render().match(/^It is \d{1,2}[a-z]{2} [A-Z][a-z]+ [0-9]{4,} \d{2}:\d{2}$/));

			template = new dd.Template('It is the {% now "jS \\o\\f F" %}');
			t.t(template.render().match(/^It is the \d{1,2}[a-z]{2} of [A-Z][a-z]+$/));

			template = new dd.Template("It is the {% now 'jS \\o\\f F' %}");
			t.t(template.render().match(/^It is the \d{1,2}[a-z]{2} of [A-Z][a-z]+$/));

			var found = false;
			try{
				template = new dd.Template("It is the {% now 'jS \\o\\f F %}");
			}catch(e){
				found = true;
				t.is("'now' statement takes one argument", e.message);
			}
			t.t(found);

			found = false;
			try{
				template = new dd.Template('It is the {% now "jS \\o\\f F %}');
			}catch(e){
				found = true;
				t.is("'now' statement takes one argument", e.message);
			}
			t.t(found);
			}catch(e){
				for(var i in e){
					console.log(i+":"+e[i]);
				}
				throw e;
			}
		}
LOG: debug: FAILED test: test_tag_now 0 ms

LOG: name:TypeError
LOG: message:'undefined' is null or not an object
LOG: number:-2146823281
LOG: description:'undefined' is null or not an object
  [object Error]
LOG: debug: 	ERROR IN:
		 function test_tag_ifchanged(t){
			try{
			var dd = dojox.dtl;

			var context = new dd.Context({
				year: 2008,
				days: [
					new Date(2008, 0, 12),
					new Date(2008, 0, 28),
					new Date(2008, 1, 1),
					new Date(2008, 1, 1),
					new Date(2008, 1, 1)
				]
			});

			var template = new dd.DomTemplate("<div><h1>Archive for {{ year }}</h1>"+
"{% for date in days %}"+
'{% ifchanged %}<h3>Month: </h3><h3>{{ date|date:"F" }}</h3>{% endifchanged %}'+
'<a href="{{ date|date:\'M/d\'|lower }}/">{{ date|date:\'j\' }}</a>'+
"{% endfor %}</div>");

			t.is('<div><h1>Archive for 2008</h1>'+
'<h3>Month: </h3><h3>January</h3>'+
'<a href="jan/12/">12</a>'+
'<a href="jan/28/">28</a>'+
'<h3>Month: </h3><h3>February</h3>'+
'<a href="feb/01/">1</a>'+
'<a href="feb/01/">1</a>'+
'<a href="feb/01/">1</a></div>', dd.tests.dom.util.render(template, context));

			template = new dd.DomTemplate('<div>{% for date in days %}'+
'{% ifchanged date.date %} {{ date.date }} {% endifchanged %}'+
'{% ifchanged date.hour date.date %}'+
'{{ date.hour }}'+
'{% endifchanged %}'+
'{% endfor %}</div>');
			t.is('<div> 2008-01-12 0 2008-01-28 0 2008-02-01 0</div>', dd.tests.dom.util.render(template, context));
			}catch(e){
				for(var i in e){
					console.log(i+":"+e[i]);
				}
				throw e;
			}
		}
LOG: debug: FAILED test: test_tag_ifchanged 47 ms

LOG: name:TypeError
LOG: message:Object doesn't support this property or method
LOG: number:-2146827850
LOG: description:Object doesn't support this property or method
  [object Error]
LOG: debug: 	ERROR IN:
		 function test_tabIndex(){
			try{
			var dd = dojox.dtl;

			var context = new dd.Context();
			var template = new dd.DomTemplate('<div tabIndex="-1"></div>');
			//the following should not throw errors in IE
			dd.tests.dom.util.render(template, context);
			}catch(e){
				for(var i in e){
					console.log(i+":"+e[i]);
				}
				throw e;
			}
		}
LOG: debug: FAILED test: test_tabIndex 0 ms

LOG: name:TypeError
LOG: message:Object doesn't support this property or method
LOG: number:-2146827850
LOG: description:Object doesn't support this property or method
  [object Error]
LOG: debug: 	ERROR IN:
		 function test_insertion_order_text(t){
			try{
			var dd = dojox.dtl;

			var context = new dd.Context({
				first: false,
				last: false
			});

			var template = new dd.DomTemplate("<div>{% if first %}first{% endif %}middle{% if last %}last{% endif %}</div>");
			t.is("<div>middle</div>", dd.tests.dom.util.render(template, context));

			context.first = true;
			t.is("<div>firstmiddle</div>", dd.tests.dom.util.render(template, context));

			context.first = false;
			context.last = true;
			t.is("<div>middlelast</div>", dd.tests.dom.util.render(template, context));

			context.first = true;
			t.is("<div>firstmiddlelast</div>", dd.tests.dom.util.render(template, context));
			}catch(e){
				for(var i in e){
					console.log(i+":"+e[i]);
				}
				throw e;
			}
		}
LOG: debug: FAILED test: test_insertion_order_text 0 ms

Change History (6)

comment:1 Changed 8 years ago by bill

Keywords: dohfail added

comment:2 Changed 8 years ago by GregGirty

This issue can be hot-patched with the following code:

dojox.dtl.utils.date.DateFormat = function(/*String*/ format){
	return new dojox.date.php.DateFormat(this, format);
}

A maintainer can find the erroneous declaration in src/dojox/dtl/utils/date.js

Last edited 8 years ago by GregGirty (previous) (diff)

comment:3 Changed 8 years ago by liucougar

In [26680]:

refs #11202: fix dojox/dtl/utils/date

comment:4 in reply to:  2 Changed 8 years ago by JoshNewman

Replying to GregGirty:

This issue can be hot-patched with the following code:

dojox.dtl.utils.date.DateFormat = function(/*String*/ format){
	return new dojox.date.php.DateFormat(this, format);
}

A maintainer can find the erroneous declaration in src/dojox/dtl/utils/date.js

I don't see how this sets the context in:

dojox.date.php.DateFormat

It seems to work with just the format argument:

dojox.dtl.utils.date.DateFormat = function(/*String*/ format){
	return new dojox.date.php.DateFormat(this, format);
}

But then, DateFormat, is in a different context than expected.

comment:5 Changed 8 years ago by ben hockey

Keywords: needsreview added
Priority: highlow

i'm closing most dtl tickets and marking them as patchwelcome due to the lack of support for dtl. should this ticket be closed as patchwelcome as well?

comment:6 Changed 4 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: newclosed

Given the lack of attention that dojox/dtl has received, I'm closing this ticket as patchwelcome. If you would like to work on a fix, please create a pull request and reopen the ticket.

Note: See TracTickets for help on using tickets.