marcj / css-element-queries

CSS Element-Queries aka Container Queries. High-speed element dimension/media queries in valid css.
http://marcj.github.io/css-element-queries/
MIT License
4.27k stars 487 forks source link

Element queries not working when Gravatar Hovercards from Jetpack for WordPress is being used #187

Open enventa opened 6 years ago

enventa commented 6 years ago

Hi @marcj

I have noticed that Element Queries don't work when "Gravatar Hovercards" functionality from Jetpack for WordPress plugin is ON. If I deactivate that functionality, Element Queries work fine again.

In fact, it is this piece of javascript code the one to blaim:

/* global WPGroHo:true, Gravatar */
WPGroHo = jQuery.extend( {
    my_hash: '',
    data: {},
    renderers: {},
    syncProfileData: function( hash, id ) {
        if ( !WPGroHo.data[hash] ) {
            WPGroHo.data[hash] = {};
            jQuery( 'div.grofile-hash-map-' + hash + ' span' ).each( function() {
                WPGroHo.data[hash][this.className] = jQuery( this ).text();
            } );
        }

        WPGroHo.appendProfileData( WPGroHo.data[hash], hash, id );
    },
    appendProfileData: function( data, hash, id ) {
        for ( var key in data ) {
            if ( jQuery.isFunction( WPGroHo.renderers[key] ) ) {
                return WPGroHo.renderers[key]( data[key], hash, id, key );
            }

            jQuery( '#' + id ).find( 'h4' ).after( jQuery( '<p class="grav-extra ' + key + '" />' ).html( data[key] ) );
        }
    }
}, WPGroHo );

jQuery( document ).ready( function() {
    if ( 'undefined' === typeof Gravatar ) {
        return;
    }

    Gravatar.profile_cb = function( h, d ) {
        WPGroHo.syncProfileData( h, d );
    };

    Gravatar.my_hash = WPGroHo.my_hash;
    Gravatar.init( 'body', '#wpadminbar' );
} );

Do you see what the incompatibility issue may come from? Anything suspect in the code above that could be the cause of the issue?

Thanks!

Regards, Víctor

enventa commented 6 years ago

In fact, making just some trials, I found out that is the last line (Gravatar.init( 'body', '#wpadminbar' );) the one to blame.

Anyone knows what does it do exactly?

marcj commented 6 years ago

Actually no idea. Maybe you should post the code behind Gravatar.init to get more insights.