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

responsive.org - Runaway javascript #145

Closed
hoosteeno opened this Issue Jun 24, 2014 · 4 comments

Comments

Projects
None yet
4 participants
@hoosteeno
Copy link

hoosteeno commented Jun 24, 2014

URL: http://responsive.org/2014/03/the-operating-model/
Browser: Firefox
Version: 31.0
Problem type: Looks like the website has a bug.
Site owner: Unknown

Steps to Reproduce

  1. Open web console.
  2. Navigate to http://responsive.org/2014/03/the-operating-model/
  3. Watch javascript error count increase by 50 per second.
@miketaylr

This comment has been minimized.

Copy link
Member

miketaylr commented Jun 24, 2014

Uncaught TypeError: Cannot read property 'complete' of undefined, from script.js. And also happening in Chrome.

Confirmed from here. Here's the offending code, needs analysis:

/*  FlexSlider
/* ------------------------------------ */
    var firstImage = jQuery('.flexslider').find('img').filter(':first'),
        checkforloaded = setInterval(function() {
            var image = firstImage.get(0);
            if (image.complete || image.readyState == 'complete' || image.readyState == 4) {
                clearInterval(checkforloaded);
                jQuery('.flexslider').flexslider({
                    animation: "slide",
                    useCSS: false, // Fix iPad flickering issue
                    slideshow: false,
                    directionNav: true,
                    controlNav: true,
                    pauseOnHover: true,
                    slideshowSpeed: 7000,
                    animationSpeed: 400,
                    smoothHeight: true,
                    touch: false
                });
            }
        }, 20);
@miketaylr

This comment has been minimized.

Copy link
Member

miketaylr commented Jun 24, 2014

OK, so the problem is firstImage is undefined and they're checking it every 20ms. :/

> jQuery('.flexslider').find('img').filter(':first').length
0

Inside of checkforloaded, they should first check for the existence of that DOM element before trying to get its properties (by checking the length property of the jQuery property like above.

@miketaylr

This comment has been minimized.

Copy link
Member

miketaylr commented Jun 24, 2014

@miketaylr miketaylr added sitewait and removed contactready labels Jun 24, 2014

@miketaylr

This comment has been minimized.

Copy link
Member

miketaylr commented Apr 29, 2015

It seems like either the site was rebuilt (the URL 404s), or they fixed this--I don't see similar errors anywhere else.

@miketaylr miketaylr closed this Apr 29, 2015

@karlcow karlcow added this to the fixed milestone Oct 30, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment