Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #15895 > unrolled thread

jQuery and autosuggest and more

Started byjustaguy <lichunshen84@gmail.com>
First post2012-09-15 08:19 -0700
Last post2012-09-17 23:34 -0700
Articles 7 on this page of 47 — 7 participants

Back to article view | Back to comp.lang.javascript


Contents

  jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-15 08:19 -0700
    Re: jQuery and autosuggest and more Gregor Kofler <usenet@gregorkofler.com> - 2012-09-15 20:02 +0200
      Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-15 12:11 -0700
        Re: jQuery and autosuggest and more Gregor Kofler <usenet@gregorkofler.com> - 2012-09-15 23:38 +0200
          Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-15 15:48 -0700
            Re: jQuery and autosuggest and more Gregor Kofler <usenet@gregorkofler.com> - 2012-09-16 23:15 +0200
    Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-17 12:51 -0700
      Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-17 14:42 -0700
        Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-17 15:38 -0700
          Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-17 16:31 -0700
            Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-17 17:01 -0700
              Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-17 17:58 -0700
                Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-17 18:19 -0700
                  Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-17 19:47 -0700
                    Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-17 22:17 -0700
                      Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-17 22:32 -0700
                        Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-17 23:22 -0700
                          Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-17 23:59 -0700
                        Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-18 02:08 -0700
                      Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-18 05:46 -0700
                        Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-18 07:50 -0700
                      Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-18 08:07 -0700
                        Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-18 12:03 -0700
                          Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-18 12:58 -0700
                            Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-18 13:42 -0700
                              Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-18 14:24 -0700
                                Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-18 15:34 -0700
                                  Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-18 15:40 -0700
                                    Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-19 09:30 -0700
                                      Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-19 11:45 -0700
            Re: jQuery and autosuggest and more Christoph Becker <cmbecker69@gmx.de> - 2012-09-18 02:04 +0200
              Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-17 17:52 -0700
                Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-17 18:17 -0700
                  Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-17 19:45 -0700
                Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-17 19:44 -0700
              Re: jQuery and autosuggest and more justaguy <lichunshen84@gmail.com> - 2012-09-17 18:00 -0700
              Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-17 20:12 -0700
                Re: jQuery and autosuggest and more Christoph Becker <cmbecker69@gmx.de> - 2012-09-19 01:54 +0200
                  Re: jQuery and autosuggest and more "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2012-09-18 17:45 -0700
                    Re: jQuery and autosuggest and more Christoph Becker <cmbecker69@gmx.de> - 2012-09-19 16:46 +0200
                      Re: jQuery and autosuggest and more Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-20 21:35 +0200
                        Re: jQuery and autosuggest and more Christoph Becker <cmbecker69@gmx.de> - 2012-09-21 17:14 +0200
                        Re: jQuery and autosuggest and more Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-21 19:05 +0200
                  Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-18 18:00 -0700
      Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-17 19:54 -0700
        Re: jQuery and autosuggest and more "S.T." <anon@anon.com> - 2012-09-17 22:53 -0700
          Re: jQuery and autosuggest and more David Mark <dmark.cinsoft@gmail.com> - 2012-09-17 23:34 -0700

Page 3 of 3 — ← Prev page 1 2 [3]


#16061

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2012-09-20 21:35 +0200
Message-ID<5333372.F23O1iBho1@PointedEars.de>
In reply to#15998
Christoph Becker wrote:

> Michael Haufe (TNO) wrote:
>> Array.map() exists in JavaScript 1.6+
>> 
>> Array.prototype.map() is defined in the current ECMAScript standard
>> <http://es5.github.com/#x15.4.4.19>
> 
> Thanks for the correction.  I was not yet aware of the ECMAscript 5
> improvements regarding applicative programming -- the set seems quite
> complete. :-)
> 
> BTW: I wanted to look up browser compatibility information on
> <https://developer.mozilla.org/>, but the DNS lookup fails.  Has anybody
> some information about that?

About your DNS configuration: It is borken.  I can access that site.

About Array.prototype.map(): Information in the current ECMAScript Support 
Matrix is sparse on that, indeed, so the following is more or less copy-
pasted from my thesis' results that I am going to publish later this year 
(sorry about the delay, that's real life interfering when you least expect 
it).

Array.prototype.map(callback : Function[, thisArg : Object]) : number|int	

* ECMAScript Ed. 5 [15.4.4.19]

* Microsoft JScript
  - 5.5.6330	1/11 (*)
  - 9.0.16440	11/11 (+)

* Netscape/Mozilla JavaScript
  - 1.5	1/11 (*)
  - 1.6	11/11 (+)

* Google V8
  - 3.7.12.12	11/11 (+)

* Apple JavaScriptCore
  - 531.22.7	11/11 (+)

* Opera ECMAScript
  - 7.02	1/11 (*)
  - 8.0	4/11 (*)
  - 9.52	11/11 (+)

* KDE JavaScript
  - 4.6.5	11/11 (+)

Legend: (*) partial support (passes some, but not all testcases)
        (+) full support    (passes all testcases)

Only changes between tested versions of an implementation are listed.

The following host environments have been used for the tests:

* JScript
  - Version 5.5.6330 in Internet Explorer 5.50.4807.2300
    (Mozilla/4.0 (compatible; MSIE 5.5; Windows 98))
  - Version 5.6.6626 in Internet Explorer 6.0.2800.1106
    (Mozilla/4.0 (compatible; MSIE 6.0; Windows 98))
  - Version 5.7.22589 in Internet Explorer 7.0.5730.13
    for Windows Server 2003
    (Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322;
    .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648;
    .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729))
  - Version 5.8.23141 in Internet Explorer 8.0.6001.18702IC for Windows XP
     Pro 2002 SP3
    (Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0;
    .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152;
    .NET CLR 3.5.30729))
  - Version 9.0.16440 in Internet Explorer 9.0.8112.16421 for Windows 7 Pro
    32-bit SP1
    (Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0))

* Netscape/Mozilla JavaScript
  - Version 1.5 in Firefox 1.0.8 for Windows
    (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.13)
    Gecko/20060410 Firefox/1.0.8)
  - Version 1.6 in Firefox for Windows 1.5.0.12
    (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.12)
    Gecko/20070508 Firefox/1.5.0.12)
  - Version 1.7 in Firefox for Windows 2.0
    (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1)
    Gecko/20061010 Firefox/2.0)
  - Version 1.8 in Firefox for Windows 3.0.19
    (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.19)
    Gecko/2010031422 Firefox/3.0.19)
  - Version 1.8.1 in Debian Iceape (SeaMonkey) 2.0.11-9
    (Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20111108
    Iceape/2.0.11)
  - Version 1.8.5 in Debian Iceweasel (Firefox) 10.0.2
    (Mozilla/5.0 (X11; Linux i686; rv:10.0.2) Gecko/20100101 Firefox/10.0.2
    Iceweasel/10.0.2)

* Google V8
  - Version 3.7.12.12 in Chrome 17.0.963.78 (Developer Build 125577 Linux)
    (Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.11 (KHTML, like Gecko)
    Chrome/17.0.963.78 Safari/535.11)
  - Version 3.8.9.5 in Google Chrome 18.0.1025.45 beta for Linux
    (Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.19 (KHTML, like Gecko)
    Chrome/18.0.1025.45 Safari/535.19)

* Apple JavaScriptCore
  - Version 531.22.7 in Safari for Windows 4.0.5 (531.22.7)
    (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/531.22.7
    (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7)
  - Version 7533.18.5 in Safari for Windows 5.0.2 (7533.18.5)
    (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.18.1
    (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5)
  - Version 7534.52.7 in Safari 5.1.2 (7534.52.7) for Windows 7 32-bit SP1
    (Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.52.7 (KHTML, like Gecko)
    Version/5.1.2 Safari/534.52.7)

* Opera ECMAScript
  - Version 7.02 in Opera 7.02.2668 for Windows XP 32-bit
    (Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.1) Opera 7.02
    [en])
  - Version 8.0 in Opera 8.0.7561 for Windows
    (Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.0)
  - Version 9.27 in Opera 9.27.8841 for Windows
    (Opera/9.27 (Windows NT 5.1; U; en))
  - Version 9.52 in Opera 9.52.10108 for Windows
    (Opera/9.52 (Windows NT 5.1; U; en))
  - Version 9.62 in Opera 9.62.10467 for Windows
    (Opera/9.62 (Windows NT 5.1; U; en) Presto/2.1.1)
  - Version 9.64 in Opera 9.64.10487 for Windows
    (Opera/9.64 (Windows NT 5.1; U; en) Presto/2.1.1)
  - Version 10.53 in Opera 10.53.3374 for Windows
    (Opera/9.80 (Windows NT 5.1; U; en) Presto/2.5.24 Version/10.53)
  - Version 10.54 in Opera 10.54.3423 for Windows
    (Opera/9.80 (Windows NT 5.1; U; en) Presto/2.5.24 Version/10.54)
  - Version 11.61 in Opera 11.61.1250 for Linux
    (Opera/9.80 (X11; Linux i686; U; en) Presto/2.10.229 Version/11.61)

* KDE JavaScript
  - Version 4.6.5 in Konqueror for Linux 4.6.5
    (Mozilla/5.0 (compatible; Konqueror/4.6; Linux 2.6.39.3-pe; X11; i686;
    de) KHTML/4.6.5 (like Gecko))


HTH

PointedEars
-- 
var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
)  // Plone, register_function.js:16

[toc] | [prev] | [next] | [standalone]


#16077

FromChristoph Becker <cmbecker69@gmx.de>
Date2012-09-21 17:14 +0200
Message-ID<k3i086$bp1$1@speranza.aioe.org>
In reply to#16061
Thomas 'PointedEars' Lahn wrote:
> Christoph Becker wrote:
>> BTW: I wanted to look up browser compatibility information on
>> <https://developer.mozilla.org/>, but the DNS lookup fails.  Has anybody
>> some information about that?
> 
> About your DNS configuration: It is borken.  I can access that site.

I was able to access the site later in the evening.  I should have
reported this; sorry for any inconvenience.

> About Array.prototype.map(): Information in the current ECMAScript Support 
> Matrix is sparse on that, indeed, so the following is more or less copy-
> pasted from my thesis' results that I am going to publish later this year 
> (sorry about the delay, that's real life interfering when you least expect 
> it).

> HTH

Yes, that's very useful information.  Thank you.

-- 
Christoph M. Becker

[toc] | [prev] | [next] | [standalone]


#16084

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2012-09-21 19:05 +0200
Message-ID<1457495.vSIgYpi9Oe@PointedEars.de>
In reply to#16061
Thomas 'PointedEars' Lahn wrote:

> Array.prototype.map(callback : Function[, thisArg : Object]) : number|int

That is a copy-and-paste error.  Of course, Array.prototype.map() returns a 
reference to an Array instance, not a number.
 
-- 
PointedEars

[toc] | [prev] | [next] | [standalone]


#15985

FromDavid Mark <dmark.cinsoft@gmail.com>
Date2012-09-18 18:00 -0700
Message-ID<bcad12e5-1484-4dc3-a6a7-92e47a74d590@n9g2000yqn.googlegroups.com>
In reply to#15983
On Sep 18, 7:53 pm, Christoph Becker <cmbecke...@gmx.de> wrote:
> David Mark wrote:
> > You need to learn both the language and the DOM.
>
> Thank you for clarifying this. :-)

You're welcome.

> My wording was mistaken, as I meant
> not the language (ECMAScript), but in fact the hosting environment
> (DOM).  Even if jQuery gives some functions such as jQuery.map(), which
> IMHO should be available in ECMAScript "directly".

That is a good point. jQuery is such a hodgepodge that it does have a
few fillers that are unrelated to the DOM. Of course, you still have
to know the language to call methods of any sort.

Also brings up that jQuery has always been marketed as one large
script; there's no builder to exclude the bits you don't need. It's
just not modular in that sense. I remember a few years back when
criticized about this very issue, one of the authors (probably Resig)
shot back that it was in hundreds of pieces (and how much more
"modular" does it need to be?!). Of course, it was/is in hundreds of
pieces for the developers writing it, but the users always ended up
with a single monolith. :(

I think they are trying to write a "roll your own" builder now. They'd
do well to see another of my examples:

http://www.cinsoft.net/mylib-builder.asp

...Or perhaps they already have. :)

For the example at hand, DOM + Ajax/Requester should be enough for the
core and the keyboard add-on is easily the best at what it does.
That's about all that is required; a competent JS/CSS developer should
be able to put the pieces together to create a cross-browser auto-
complete/suggest widget that suits their needs. It's not the instant
gratification of downloading junk from the "jQuery Universe", but it
sure travels farther and lasts longer.

Last two widgets I wrote using My Library were an auto-suggest and
date picker, which shared a lot of common code. Very lightweight and
efficient; they work perfectly in IE 5.5-10 (though a bit degraded in
5.5 and 6) and don't foul up iPads, iPhones, etc. either. As for
ancient browsers (or crippled browsers like Opera Mini), they bail out
safely, leaving plain old SELECT and INPUT controls. That's the way
this stuff is supposed to work and the code that enables such
performance has been online (and virtually unchanged) for going on
five years.

[toc] | [prev] | [next] | [standalone]


#15953

FromDavid Mark <dmark.cinsoft@gmail.com>
Date2012-09-17 19:54 -0700
Message-ID<01a91bf8-82f7-42e6-8ef7-3e42743cf673@i14g2000yqe.googlegroups.com>
In reply to#15930
On Sep 17, 3:50 pm, "S.T." <a...@anon.com> wrote:
> On 9/15/2012 8:19 AM, justaguy wrote:
>
> > Hi,
>
> > I'm a casual user of jQuery.  Question, does jQuery support
> > autosuggest?  That is, for instance, I have an form INPUT field of
> > type: text, and I'd like to execute a database query to retrieve a
> > list of items upon loading of the page, when a user types a few
> > letters it would show items that starts with these typed letters, and
> > then, upon a selection, it would trigger another event, for instance,
> > submit the form.  Is it doable with jQuery?  If so, I'd appreciates an
> > example.
>
> If you're most comfortable with jQuery there's the jQuery UI project
> that has quite a few options.

Unfortunately, it is built on top of jQuery. :(

>
> http://jqueryui.com/demos/autocomplete/
>
> Decent tutorial with back-end using PHP:
>
> http://www.jensbits.com/2010/03/29/jquery-ui-autocomplete-widget-with...

Doesn't really matter; you can't use such garbage in production (at
least not on the Web). And yes, I know lots of people do just that.
They typically end up with two documents for every resource due to
their jQuery-based "solution" being far too slow and bloated for
mobile users.

>
> Footnote, don't know if you were tossing up some quick unsafe sample
> code quickly or if you are a little unclear on SQL injection issues.
> Greg mentioned it, but your sample code that looked like:
> mysql_query("select * where id LIKE %".$_GET['term']."%")

Don't concatenate SQL query strings in PHP scripts. And yes, that is
one of the worst examples I've ever seen. Doesn't matter the context,
such code shouldn't be posted where it is likely to be copied.

>
> ... is practically begging for troubles down the line. Very quick,
> non-foolproof but relatively safe PHP SQL injection mini-tutorial*

Relatively safe as compared to what? :(

[toc] | [prev] | [next] | [standalone]


#15962

From"S.T." <anon@anon.com>
Date2012-09-17 22:53 -0700
Message-ID<50580c60$0$65512$742ec2ed@news.sonic.net>
In reply to#15953
On 9/17/2012 7:54 PM, David Mark wrote:
>>
>> Footnote, don't know if you were tossing up some quick unsafe sample
>> code quickly or if you are a little unclear on SQL injection issues.
>> Greg mentioned it, but your sample code that looked like:
>> mysql_query("select * where id LIKE %".$_GET['term']."%")
>
> Don't concatenate SQL query strings in PHP scripts. And yes, that is
> one of the worst examples I've ever seen. Doesn't matter the context,
> such code shouldn't be posted where it is likely to be copied.
>
>>
>> ... is practically begging for troubles down the line. Very quick,
>> non-foolproof but relatively safe PHP SQL injection mini-tutorial*
>
> Relatively safe as compared to what? :(

Select querying against data intended to be seen by the public while 
filtering with concatenated mysql_real_escape_string() has no risk. It's 
not a good habit - prepared statements are what you want to use for more 
sensitive database operations like an INSERT to selecting against a 
supposedly protected and hashed password - but there's no risk in the 
situation described in this thread.

[toc] | [prev] | [next] | [standalone]


#15964

FromDavid Mark <dmark.cinsoft@gmail.com>
Date2012-09-17 23:34 -0700
Message-ID<74c0c251-8ffe-45e8-9dd0-e6f0c34dad42@v15g2000yqi.googlegroups.com>
In reply to#15962
On Sep 18, 1:53 am, "S.T." <a...@anon.com> wrote:
> On 9/17/2012 7:54 PM, David Mark wrote:
>
>
>
> >> Footnote, don't know if you were tossing up some quick unsafe sample
> >> code quickly or if you are a little unclear on SQL injection issues.
> >> Greg mentioned it, but your sample code that looked like:
> >> mysql_query("select * where id LIKE %".$_GET['term']."%")
>
> > Don't concatenate SQL query strings in PHP scripts. And yes, that is
> > one of the worst examples I've ever seen. Doesn't matter the context,
> > such code shouldn't be posted where it is likely to be copied.
>
> >> ... is practically begging for troubles down the line. Very quick,
> >> non-foolproof but relatively safe PHP SQL injection mini-tutorial*
>
> > Relatively safe as compared to what? :(
>
> Select querying against data intended to be seen by the public while
> filtering with concatenated mysql_real_escape_string() has no risk.

Assuming that function is 100% reliable, what is the "non-foolproof"
designation in aid of? In any event, production applications should
use stored procedures, which eliminate the need to concatenate
anything.

> It's
> not a good habit - prepared statements are what you want to use for more
> sensitive database operations like an INSERT to selecting against a
> supposedly protected and hashed password - but there's no risk in the
> situation described in this thread.

Whether perceived as sensitive or not, you should not be fiddling
around with SQL strings in PHP scripts. I often come across (bad)
examples like "justaguy" presented in ostensibly finished applications.

[toc] | [prev] | [standalone]


Page 3 of 3 — ← Prev page 1 2 [3]

Back to top | Article view | comp.lang.javascript


csiph-web