Closed Bug 595067 Opened 14 years ago Closed 14 years ago

values showed from datalist/list should be filtered by the field value by default and an attribute should disable that

Categories

(Toolkit :: Autocomplete, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b7

People

(Reporter: mounir, Assigned: mounir)

References

Details

(Keywords: dev-doc-needed)

Attachments

(1 file, 2 obsolete files)

Attached patch WIP Patch (obsolete) — Splinter Review
<datalist id='d'>
  <option>Foo</option>
  <option>Foobar</option>
</datalist>
<input list='d'>

The list should show "Foo" and "Foobar" if the user hasn't typed or has typed "F", "Fo", "Foo", "o" or "oo".

If mozNoFilter is set, the entire list will be shown.
Attached patch Patch v1 (obsolete) — Splinter Review
Attachment #473928 - Attachment is obsolete: true
I hate doing that but I think it would be better to not try to write tests for that for the moment. We should push that for beta6 and tests can be written after. A lot of tests would have to be written for the list feature actually.

Gavin, do you think you can review this very small patch for Friday?
Attachment #473930 - Attachment description: WIP Patch → Patch v1
Attachment #473930 - Flags: review?(gavin.sharp)
Comment on attachment 473930 [details] [diff] [review]
Patch v1

Jonas, let me know if that's what you were expecting.
Do you want me to add an IDL attribute? Doesn't sound really useful considering that is a temporary attribute which may disappear -someday- for a standardized one?
Attachment #473930 - Flags: feedback?(jonas)
Attachment #473930 - Flags: approval2.0?
Comment on attachment 473930 [details] [diff] [review]
Patch v1

Why is this using regexp matching? That seems like it would result in strange behavior if the user types '.', '[', '\' or other characters that have special meaning in regexps. Why not simply do a substring search using something like:

if (filter && label.toLower().indexOf(lowerFieldValue) < 0) {
  continue;
}
Attachment #473930 - Flags: feedback?(jonas) → feedback-
Attached patch Patch v1.1Splinter Review
Thanks, I didn't know indexOf ;)
Attachment #473930 - Attachment is obsolete: true
Attachment #473981 - Flags: review?(gavin.sharp)
Attachment #473981 - Flags: feedback?(jonas)
Attachment #473981 - Flags: approval2.0?
Attachment #473930 - Flags: review?(gavin.sharp)
Attachment #473930 - Flags: approval2.0?
Attachment #473981 - Flags: review?(gavin.sharp)
Attachment #473981 - Flags: review+
Attachment #473981 - Flags: feedback?(jonas)
Attachment #473981 - Flags: approval2.0?
Attachment #473981 - Flags: approval2.0+
Version: unspecified → Trunk
http://hg.mozilla.org/mozilla-central/rev/fa6c83c1a10e
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b6
Depends on: 595415
mozNoFilter never got documented on MDN and so was almost re-implemented in bug 1349747. It also wasn't standardized as far as I can tell. I think it's an essential feature for @list to implement features such as Google search suggestions (which can include typo/spelling corrections) as described in some threads below.

Mentions in Google:
* https://www.w3.org/Bugs/Public/show_bug.cgi?id=9785
* https://lists.w3.org/Archives/Public/public-whatwg-archive/2011May/0050.html
* https://lists.w3.org/Archives/Public/public-html-comments/2012Oct/0000.html
Depends on: 1044407
Keywords: dev-doc-needed
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: