Ticket #6469 (closed defect: fixed)

Opened 8 months ago

Last modified 5 months ago

[patch] FilteringSelect: newlines in inline data not trimmed

Reported by: reiz6153@… Owned by: haysmark
Priority: normal Milestone: 1.2
Component: Dijit Version: 1.1.0
Severity: normal Keywords:
Cc: jaredj

Description

I study along with The Dojo Book and program in the MyEclipse?. I learn Example 2 - The Postman Always Clicks Twice. When I program FilteringSelect?, the problem occured. At first, my code is: <select id="option1" dojoType="dijit.form.FilteringSelect?">

<option value="pop3">POP3</option> <option value="imap">IMAP</option>

</select> It has work well. But when I format using MyEclipse?'s Format functionality, my code changes to: <select id="option1" dojoType="dijit.form.FilteringSelect?">

<option value="pop3">

POP3

</option> <option value="imap">

IMAP

</option>

</select> It doesn't work well. Note: Carriage Return appear alongside "POP3" and "IMAP". I guess this is a bug of Dojo 1.0.0. Because of I'm a Chinese, I don't be easy to login in this web site. Whether this is a bug or not, please notify me using Email. Thanks a lot. My email address: reiz6153@…

Attachments

6469.dijit.patch (0.8 kB) - added by haysmark 5 months ago.
Fixes #6469. Strip option tags of newlines; users usually don't intend for them to be there.
6469.dojo.patch (411 bytes) - added by haysmark 5 months ago.
Refs #6469. Enable dojo.data to match against values containing newline characters.

Change History

Changed 8 months ago by bill

  • reporter changed from guest to reiz6153@hotmail.com
  • component changed from HTML to Dijit
  • summary changed from FilteringSelect doesn't work to FilteringSelect: newlines in inline data not trimmed
  • priority changed from highest to normal
  • milestone set to 1.2
  • owner changed from sjmiles to bill

Changing bug summary to be more descriptive than "doesn't work". Note that every ticket is about something that doesn't work.

Looks like a simple fix to dijit.form._ComboBoxDataStore.

Changed 5 months ago by haysmark

  • cc jaredj added
  • owner changed from bill to haysmark

I am also getting this behavior with dojo.data. In states.json, if you write:

	{name:"\nAlaska\n", label:"Alaska",abbreviation:"AK"},

Alaska will vanish from the ComboBox? list (dojo.data does not return it in the result list). The item is in the store, but even a query for '*' does not match it.

I say this because I noticed a mixin to our store I don't remember:

//Mix in the simple fetch implementation to this class. 
dojo.extend(dijit.form._ComboBoxDataStore,dojo.data.util.simpleFetch);

So maybe if we can figure this out for dojo.data the rest will follow.

Changed 5 months ago by bill

Hmm, that does sound like a bug in the dojo.data library functions, but regardless of that, it seems like if a developer accesses an item from ComboBoxDataStore (perhaps by accessing ComboBox.item), it would be bad for it to contain newlines like:

{name:"\nAlaska\n", label:"Alaska",abbreviation:"AK"}

I just figured we should trim the data from each <option> tag.

Changed 5 months ago by haysmark

Fixes #6469. Strip option tags of newlines; users usually don't intend for them to be there.

Changed 5 months ago by haysmark

Refs #6469. Enable dojo.data to match against values containing newline characters.

Changed 5 months ago by haysmark

  • status changed from new to assigned

I've attached two patches: one for ComboBoxDataStore? and one for dojo.data. I thought it would be good if dojo.data could match values even if they contained newlines.

Changed 5 months ago by haysmark

I ran the dojo.data patch against the doh tests in dojo and dojox on Firefox 2, IE 7, and Safari 3.1 and they all passed.

Changed 5 months ago by haysmark

  • summary changed from FilteringSelect: newlines in inline data not trimmed to [patch] FilteringSelect: newlines in inline data not trimmed

Changed 5 months ago by jaredj

  • status changed from assigned to closed
  • resolution set to fixed

(In [14312]) Fix to ComboBox?. fixes #6469

Changed 5 months ago by jaredj

(In [14313]) Fix to ComboBox?. refs #6469

Changed 5 months ago by bill

(In [14323]) Use dojo.trim(). replace() is insufficient since it doesn't remove spaces or tabs.

The other option is to do trimming on lookup rather than on instantiation. We should do that if current strategy affects page load time significantly.

Refs #6469. !strict

Note: See TracTickets for help on using tickets.