Opened 16 years ago

Closed 16 years ago

Last modified 15 years ago

#619 closed defect (invalid)

Passing an array for a widget in an attribute includes leading whitespace

Reported by: [email protected] Owned by: Tom Trenka
Priority: high Milestone:
Component: Core Version: 0.2
Keywords: leading whitespace array common.js disabledactions Cc:
Blocked By: Blocking:


The use case:

Attempting to pass multiple actionsDisabled into a tree node in the format:

<div dojoType="TreeNode" actionsDisabled="move; delete" title="Can't move or delete this node"></div>

delete will not be recognised as a 'real' action, becuase the parser includes any leading white space.

In effect the two array items become:

arrayItem[0] = "actionA", // == "actionA"
arrayItem[1]= " actionB'; // != "actionB"

This could be fixed with a change to src/lang/common.js

@@ -56,12 +56,12 @@
                while(i != end) {
-                       if(dojo.string.trim(arr[i]) === val){ return i; }
+                       if(arr[i] === val){ return i; }
                        i += step;
                while(i != end) {
-                       if(dojo.string.trim(arr[i]) == val){ return i; }
+                       if(arr[i] == val){ return i; }
                        i += step;

Change History (4)

comment:1 Changed 16 years ago by Tom Trenka

Milestone: 0.4

I hesistate to say this would seem to me that this is by design and not really a bug. You'd think that you'd want trimmed strings in an array, but there exists the possibility (however remote) that you'd *want* the whitespace.

I'm going to push this back to 0.4, and then we can decide whether or not we should really trim this. BTW if we do, the fix should be in the parser code and not in dojo.lang.

comment:2 Changed 16 years ago by dylan

Owner: changed from anonymous to Tom Trenka

time to decide on this one...

comment:3 Changed 16 years ago by Tom Trenka

Resolution: invalid
Status: newclosed

Making a decision...let's keep the whitespace and not trim passed parameters. There may or may not be cases where someone would want the whitespace, and if they don't they can always define thier attribute values without using any whitespace.

comment:4 Changed 15 years ago by (none)

Milestone: 0.4

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.