Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12614 closed defect (fixed)

[regression] problems with lang/dir attributes getting set to undefined, causing exceptions loading language files

Reported by: nicola.besagni Owned by: bill
Priority: high Milestone: 1.6.1
Component: Parser Version: 1.6.0
Keywords: dojo.html.set Cc:
Blocked By: Blocking:

Description (last modified by bill)

I want dynamically loading a dom tree from a string (actually a server response). I've trouble with a ValidationTextBox into a ContentPane.

See this fragment (the same code work fine in dojo 1.5 or using dijit.form.TextBox instead of dijit.form.ValidationTextBox)

*

(fragment deleted, see attachment bug_12614.html instead)

from firebug I see this

Error: Bundle not found: validate in dijit.form , locale=undefined
Error parsing in _ContentSetter#Setter_dijit_layout_ContentPane_0_1
Error: Bundle not found: validate in dijit.form , locale=undefined
Error undefined running custom onLoad code: This deferred has already been resolved

Attachments (5)

html.html (1.1 KB) - added by bill 8 years ago.
works for me on FF3.6
test.html (1.2 KB) - added by nicola.besagni 8 years ago.
My original test file
domFailure.txt (6.0 KB) - added by nicola.besagni 8 years ago.
domSuccess.txt (6.6 KB) - added by nicola.besagni 8 years ago.
bug_12614.html (1.5 KB) - added by nicola.besagni 8 years ago.
case study with explicit locale = it_it

Download all attachments as: .zip

Change History (22)

comment:1 Changed 8 years ago by bill

Keywords: dojo.html.set added; dojox.html.set removed
Summary: Dinamically loading a ValidationTextBox and ContentPane does not work in dojo 1.6Dynamically loading a ValidationTextBox and ContentPane does not work in dojo 1.6

It works for me on FF 3.6/mac. I'm using the attached test case, which is just your test case reformatted. What browser fails for you?

Changed 8 years ago by bill

Attachment: html.html added

works for me on FF3.6

comment:2 in reply to:  1 Changed 8 years ago by nicola.besagni

I've tested on Mozilla/5.0 and IE8 on Windows XP SP3

Changed 8 years ago by nicola.besagni

Attachment: test.html added

My original test file

comment:3 Changed 8 years ago by nicola.besagni

Now I see the in my code fragment the var content declaration is

var content = ;

this is an copy and paste error (!) ; my real code has

var content = ;

I've attached it in test.html

I confirm that it not work in IE8 and FF5.0 Thanks

comment:4 Changed 8 years ago by bill

OK, do you really mean FF5.0? FF4 was just released, I don't think there's a FF5. Your test file is working fine in FF4 and IE8 for me, no errors in the console.

comment:5 Changed 8 years ago by nicola.besagni

sorry, sorry, sorry, sorry, sorry, sorry, sorry, sorry, sorry !!!

FireFox? version 3.6.16 Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.9.2.16) Gecko/20110319

on Windows XP SP3

I try some other test

sorry

Changed 8 years ago by nicola.besagni

Attachment: domFailure.txt added

Changed 8 years ago by nicola.besagni

Attachment: domSuccess.txt added

comment:6 Changed 8 years ago by nicola.besagni

I try again on FF3.6.16 I see in console the follows errors

Error: Bundle not found: validate in dijit.form , locale=undefined Line 0

Error parsing in _ContentSetter#Setter_dijit_layout_ContentPane_0_1 Error: Bundle not found: validate in dijit.form , locale=undefined

Error undefined running custom onLoad code: This deferred has already been resolved http://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dijit/layout/ContentPane.xd.js Line 8

You see the risulting html dom in attached file domFailure.txt; see <div> with dojoType=dijit.form.ValidationTextBox? are not parsed

if I change code in

dojo.require("dojo.parser"); ... dojo.html.set(srcNodeRef, content, {parseContent: false}); dojo.parser.parse();

(i.e. running the parser manually ) all work fine !!!

comment:7 Changed 8 years ago by bill

So if you run http://bill.dojotoolkit.org/test.html on FF3.6 you get those errors? It works fine for me.

Changed 8 years ago by nicola.besagni

Attachment: bug_12614.html added

case study with explicit locale = it_it

comment:8 in reply to:  7 Changed 8 years ago by nicola.besagni

On FF3.6 I get the error, but now I've understood our different result: different locale. Try my last attached file (bug_12614.html), with explicit setting of locale in djConfig.locale = "it_it" (get error). If I change locale = "en_us" all work fine.

comment:9 Changed 8 years ago by bill

Owner: set to Adam Peller

Aha. OK, this is one for Adam. BTW it works against a source tree, just not against google CDN.

comment:10 Changed 8 years ago by Adam Peller

note: locales must be specified with a dash (e.g. it-it), not an underscore, though either it_it or en_us should just fall back to the default translations (English)

comment:11 Changed 8 years ago by bill

Component: GeneralParser

OK, taking this one back.

The parser (and perhaps dojo.html.set()?) is passing in {dir: undefined, lang: undefined} as inherited values to the widget constructors. That calls ContentPane.set("lang", undefined) which calls dojo.attr(domNode, "lang", undefined), which sets lang="undefined" on the ContentPane.domNode.

Then ContentPane calls dojo.parser.parse(), which notices the lang="undefined" string setting on ContentPane.domNode and passes it to child widget ValidationTextBox.

Then ValidationTextBox calls dojo.i18n.getLocalization("dijit.form", "validate", "undefined"), which apparently operates differently in XD mode vs. normal mode, only causing an exception in XD mode, but presumably not loading the right message file in either case.

Anyway, the root problem is that dir and lang shouldn't be passed as parameters to widget constructors unless they have valid values. So I'll fix that.

comment:12 Changed 8 years ago by bill

Milestone: tbd1.6.1
Owner: changed from Adam Peller to bill
Status: newassigned

comment:13 Changed 8 years ago by bill

Description: modified (diff)
Summary: Dynamically loading a ValidationTextBox and ContentPane does not work in dojo 1.6[regression] problems with ang/dir attributes getting set to undefined, causing exceptions loading language files

comment:14 Changed 8 years ago by bill

Summary: [regression] problems with ang/dir attributes getting set to undefined, causing exceptions loading language files[regression] problems with lang/dir attributes getting set to undefined, causing exceptions loading language files

comment:15 in reply to:  14 Changed 8 years ago by nicola.besagni

thank

Nicola

... and sorry for my English

comment:16 Changed 8 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [24277]) Fix issues with widgets being instantiated with {dir: undefined, lang: undefined} parameters, or worse yet {dir: "undefined", lang: "undefined"}. Don't pass in dir, lang as parameters unless they have valid (non-null, non-empty-string) values.

Fixes #12614 on 1.6/ branch (trunk checkin will follow), !strict.

comment:17 Changed 8 years ago by bill

(In [24278]) Fix issues with widgets being instantiated with {dir: undefined, lang: undefined} parameters, or worse yet {dir: "undefined", lang: "undefined"}. Don't pass in dir, lang, textdir as parameters unless they have valid (non-null, non-empty-string) values.

Also fixing bug when parser called with rootNode parameter (where rootNode is not <body>), where it would ignore dir/lang/textDir settings on rootNode.

Fixes #12614 on trunk !strict.

Note: See TracTickets for help on using tickets.