Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read property 'replace' of null #156

Open
dylanh724 opened this issue Apr 16, 2016 · 3 comments
Open

Uncaught TypeError: Cannot read property 'replace' of null #156

dylanh724 opened this issue Apr 16, 2016 · 3 comments
Labels

Comments

@dylanh724
Copy link

dylanh724 commented Apr 16, 2016

In header, I add:
<script src="js/queryloader2.min.js" type="text/javascript">

(confirmed it exists or I wouldn't have this err)

In .ready I call the jquery:
$("body").queryLoader2();

(at the top)

The screen just goes black and doesn't come out after getting error 'cannot read property replace of null'

image

@Gaya
Copy link
Owner

Gaya commented Apr 18, 2016

Seems like something is going wrong with detecting urls, will take a look later.

@Gaya Gaya added the bug label Apr 18, 2016
@albanyacademy
Copy link

albanyacademy commented Jun 7, 2016

Encountered this problem when trying to embed Wistia popovers. Solved it by this:
findImageInElement: function(e) {
var t = this.determineUrlAndType(e);
if (!this.hasGradient(t.url)) {
t.url = this.stripUrl(t.url);
if (t.url = "undefined") return false;
for (var n = t.url.split(", "), i = 0; i < n.length; i++)
if (this.validUrl(n[i]) && this.urlIsNew(n[i])) {
var r = "";
(this.isIE() || this.isOpera()) && (r = "?rand=" + Math.random()), this.sources.push(n[i] + r)
}
}
},

And stripURL needed an if statement:
stripUrl: function(e) { if (e) return e = e.replace(/url\(\'/g, ""), e = e.replace(/url\(/g, ""), e = e.replace(/\'\)/g, ""), e = e.replace(/\)/g, ""), e = e.replace },
Not sure if this is the right solution, but it clears the errors and still loads normally for me.
Apologies in advance for formatting/providing my solution here, this is my first contribution on github.

@Gaya
Copy link
Owner

Gaya commented Jun 8, 2016

@albanyacademy Thanks for contributing. I fear that your addition will not help as it's setting a variable instead of checking a condition. I will take your adjustments into consideration.
If you'd like to contribute you can add a pull request with your adjusted code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants