Git Product home page Git Product logo

Comments (25)

flesler avatar flesler commented on May 18, 2024

That's a warning that pops in the console?

from jquery.scrollto.

szepeviktor avatar szepeviktor commented on May 18, 2024

ofcourse

from jquery.scrollto.

nitriques avatar nitriques commented on May 18, 2024

See https://twitter.com/derickbailey/status/425299085537460224

from jquery.scrollto.

szepeviktor avatar szepeviktor commented on May 18, 2024

Then it is OK now.
I do not care about the console.

from jquery.scrollto.

nitriques avatar nitriques commented on May 18, 2024

I do not care about the console.

You should.

from jquery.scrollto.

tmorehouse avatar tmorehouse commented on May 18, 2024

I've seen other similar error from jQuery itself in the console log. Right now they are just warnings. so nothing major to to worry about.

from jquery.scrollto.

szepeviktor avatar szepeviktor commented on May 18, 2024

I mean this console message.
Or should this webkit condition be deleted?
https://github.com/flesler/jquery.scrollTo/blob/master/jquery.scrollTo.js#L48

from jquery.scrollto.

tmorehouse avatar tmorehouse commented on May 18, 2024

maybe change it to:

return (document.body.scrollTop) ? document.body : document.documentElement;

from jquery.scrollto.

szepeviktor avatar szepeviktor commented on May 18, 2024

That may cause an error.
return (document.documentElement.scrollTop) ? document.documentElement : document.body;

from jquery.scrollto.

tmorehouse avatar tmorehouse commented on May 18, 2024

Maybe:

return (document.documentElement && document.documentElement.scrollTop) ? 
    document.documentElement : document.body;

from jquery.scrollto.

flesler avatar flesler commented on May 18, 2024

Let's keep this open, I'm afraid nothing might work once Chrome 33 is released

from jquery.scrollto.

flesler avatar flesler commented on May 18, 2024

Maybe $(window).scrollTop() will do? not sure, need to do some research.
I appreciate if you guys help out.

from jquery.scrollto.

nitriques avatar nitriques commented on May 18, 2024

@flesler

Maybe $(window).scrollTop()

I ALWAYS use that. Never body, nor html. If it's on part of the document, it's always a div.

from jquery.scrollto.

szepeviktor avatar szepeviktor commented on May 18, 2024

jQuery 1.10.2

// Create scrollLeft and scrollTop methods
jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
    var top = /Y/.test( prop );

    jQuery.fn[ method ] = function( val ) {
        return jQuery.access( this, function( elem, method, val ) {
            var win = getWindow( elem );

            if ( val === undefined ) {
                return win ? (prop in win) ? win[ prop ] :
                    win.document.documentElement[ method ] :
                    elem[ method ];
            }

            if ( win ) {
                win.scrollTo(
                    !top ? val : jQuery( win ).scrollLeft(),
                    top ? val : jQuery( win ).scrollTop()
                );

            } else {
                elem[ method ] = val;
            }
        }, method, val, arguments.length, null );
    };
});

function getWindow( elem ) {
    return jQuery.isWindow( elem ) ?
        elem :
        elem.nodeType === 9 ?
            elem.defaultView || elem.parentWindow :
            false;
}

from jquery.scrollto.

flesler avatar flesler commented on May 18, 2024

I think you can see the warning by using vanilla jQuery. Not sure the core implementation is the solution.

from jquery.scrollto.

tmorehouse avatar tmorehouse commented on May 18, 2024

I see jQuery throwing the same error once and a while, just by itself.

from jquery.scrollto.

tmorehouse avatar tmorehouse commented on May 18, 2024

http://dom.spec.whatwg.org/#concept-document-quirks

you could maybe do a test on document.compatMode. If it exists and has a value of CSS1Compat then scroll the documentElement, otherwise revert to scrolling the body element.

The "strict mode" chrome is referring to is not use strict, but rather the rendering mode of the browser (based on the DOCTYPE)

change this:

return /webkit/i.test(navigator.userAgent) || doc.compatMode == 'BackCompat' ?
    doc.body : 
    doc.documentElement;

to this maybe:

return doc.compatMode && doc.compatMode == 'CSS1Compat' ?
    doc.documentElement :
    doc.body;

from jquery.scrollto.

flesler avatar flesler commented on May 18, 2024

I'll try this fix when I get home

facebook/react#643

Also I'll take from jQuery's code, the one Viktor posted.

On Fri, Jan 24, 2014 at 12:54 PM, Troy Morehouse
[email protected]:

http://dom.spec.whatwg.org/#concept-document-quirks

you could maybe do a test on document.compatMode. If it exists and has a
value of CSS1Compat then scroll the documentElement, otherwise revert to
scrolling the body element.

The "strict mode" chrome is referring to is not use strict, but rather
the rendering mode of the browser (based on the DOCTYPE)


Reply to this email directly or view it on GitHubhttps://github.com//issues/61#issuecomment-33234233
.

Ariel Flesler

from jquery.scrollto.

flesler avatar flesler commented on May 18, 2024

Ok, I've been doing some experiments on Windows 7.
Updated the tests to use the latest version of jquery, you can try them yourself.
The results were unexpected.

Chrome 32 shows a warning when on compatibility mode as expected:

Chrome 33 beta actually showed no warning and worked with the current version of scrollTo just fine:

I tried using the documentElement on all cases and then on compat mode, Chrome 33 didn't work at all.
So the lesson is, Chrome 33 beta only works with the body which is the way it is right now.

@szepeviktor @nitriques @tmorehouse @Mithgol
I encourage you to try it yourself on other platforms and browsers let me know what you get.

from jquery.scrollto.

nitriques avatar nitriques commented on May 18, 2024

Thanks @flesler
I will test tomorrow!

from jquery.scrollto.

flesler avatar flesler commented on May 18, 2024

How did it go @nitriques ?
Can you guys take a look too? @szepeviktor @tmorehouse @Mithgol

from jquery.scrollto.

nitriques avatar nitriques commented on May 18, 2024

Chrome 32 still complains in WinMaxY-compat.html.
But Chrome 34 (canary) does not.

from jquery.scrollto.

flesler avatar flesler commented on May 18, 2024

Good, same as me. Thanks.

from jquery.scrollto.

nitriques avatar nitriques commented on May 18, 2024

You're welcome :)

from jquery.scrollto.

flesler avatar flesler commented on May 18, 2024

Well, closing this. Reopen if something else related comes up

from jquery.scrollto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.