Skip to content

Commit

Permalink
Replace jQuery.type() with our own isstring() test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Plotkin authored and Andrew Plotkin committed Dec 9, 2024
1 parent fde78da commit 187eee5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/quixe/gi_load.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function load_run(optobj, image, imageoptions) {
resources could also be an object already, in which case
we leave it as is.) */
if (all_options.resources != undefined) {
if (jQuery.type(all_options.resources) === 'string') {
if (isstring(all_options.resources)) {
if (window[all_options.resources])
all_options.resources = window[all_options.resources];
else
Expand All @@ -227,7 +227,7 @@ function load_run(optobj, image, imageoptions) {
/* Same deal for image_info_map. (You wouldn't usually have both,
mind you.) */
if (all_options.image_info_map != undefined) {
if (jQuery.type(all_options.image_info_map) === 'string') {
if (isstring(all_options.image_info_map)) {
if (window[all_options.image_info_map])
all_options.image_info_map = window[all_options.image_info_map];
else
Expand Down Expand Up @@ -478,6 +478,12 @@ function absolutize(url) {
return res.href;
}

/* Really, is val a string? Supports the "new String('foo')" corner
case. */
function isstring(val) {
return (typeof val === 'string' || val instanceof String);
}

/* In the following functions, "decode" means turning native string data
into an array of numbers; "encode" is the other direction. That's weird,
I know. It's because an array of byte values is the natural data format
Expand Down

0 comments on commit 187eee5

Please sign in to comment.