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

TypeError: Argument 1 of Window.getDefaultComputedStyle does not implement interface Element #686

Closed
jmatsushita opened this issue Aug 5, 2014 · 1 comment

Comments

@jmatsushita
Copy link

Repost of the following stackoverflow post which includes a workaround: http://stackoverflow.com/questions/24994129/typeerror-argument-1-of-window-getdefaultcomputedstyle-does-not-implement-inter

I have the following code outside my polymer element (in another polymer):

        $(mainThis.shadowRoot.querySelector('#test1')).click(function(e){
            mainThis.$.testelement.openPopup();
        });

The line:

mainThis.$.testelement.openPopup();

Is causing error:

TypeError: Argument 1 of Window.getDefaultComputedStyle does not implement interface Element.

openPopup - is my custom function in polymer "testelement".
The error appears only in FireFox (version 31) on other browsers (Chrome, Safari, Opera) works perfect. How to fix it ?

Edit (openPopup function):

<script type="text/javascript">
    Polymer('popup-element', {

        domReady : function() {
            var mainThis = this;
            $(this.$.popup).on('click','.closebutton', function(e){
                mainThis.closePopup();
            });
        },
        openPopup : function (){
            $(this.$.popup).show();
            return this;
        },
        closePopup : function (){
            $(this.$.popup).hide();
            return this;
        }
    });

</script>

ANSWER

Ok, now I can see. I had the same problem. I have solved it like this:
Instead of:

$(this.$.popup).show();

Try this:

this.$.popup.style.display = "block";

It seems, it is impossible to use jQuery in polymer element javascript function when you execute it from another polymer element (in firefox only!). Please somebody smarter than me to improve this answer :)

jmatsushita added a commit to iilab/openoil that referenced this issue Aug 5, 2014
@arv
Copy link
Contributor

arv commented Aug 5, 2014

getDefaultComputedStyle was just added to the shadow dom polyfill.

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

No branches or pull requests

2 participants