datalist: fix scope issue when using data-url - jscancer - Javascript crap (rel… | |
git clone git://git.codemadness.org/jscancer | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit b854b15d50265f3224377c2ba2df0f7a9462368a | |
parent bcea34ac9ce237ca816262b5ed70aa06dc046a1b | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Thu, 9 Dec 2021 18:35:19 +0100 | |
datalist: fix scope issue when using data-url | |
Diffstat: | |
M datalist/datalist.js | 8 ++++---- | |
1 file changed, 4 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/datalist/datalist.js b/datalist/datalist.js | |
@@ -50,8 +50,8 @@ function datalist_init(input) { | |
datalist_match = function(s, fn, ev) { | |
clearTimeout(timer); | |
- url = urlfn(s); | |
- if (url === prevurl) { | |
+ var requrl = urlfn(s); | |
+ if (requrl === prevurl) { | |
fn(prevmatches); | |
return; | |
} | |
@@ -67,11 +67,11 @@ function datalist_init(input) { | |
for (var i = 0; i < o.length; i++) | |
prevmatches.push(createitem(o[… | |
- prevurl = url; | |
+ prevurl = requrl; | |
fn(prevmatches); | |
}; | |
- x.open("GET", url + "&t=" + String(new Date().… | |
+ x.open("GET", requrl + "&t=" + String(new Date… | |
x.setRequestHeader("X-Requested-With", "XMLHtt… | |
x.timeout = 10000; | |
x.send(); |