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

Error raised in _onTap function for removed elements actioned by tap events #92

Open
ArthurJahn opened this issue Aug 31, 2015 · 5 comments
Assignees

Comments

@ArthurJahn
Copy link

When removing a child element from a drawer, the following error raised:

Uncaught TypeError: targetElement.hasAttribute is not a function

just added one more condition to if clause in line 502 so it doesn't happened anymore.

_onTap: function(event) {
        var targetElement = Polymer.dom(event).localTarget;
        var isTargetToggleElement = targetElement &&
          this.drawerToggleAttribute && targetElement.hasAttribute &&
          targetElement.hasAttribute(this.drawerToggleAttribute);

        if (isTargetToggleElement) {
          this.togglePanel();
        }
      },

It's a minor issue, maybe caused by a bubbling event after element has been removed, but you should look into this.

@blasten
Copy link
Contributor

blasten commented Sep 24, 2015

hmm. so what is targetElement if it's not an element with hasAttribute? Would you mind sending a code that reproduces this issue?

@ArthurJahn
Copy link
Author

when the element is dynamically removed from dom, the object received in this function is window, that does not provide a method hasAttribute.
I'll send you a code to reproduce this issue.

@blasten
Copy link
Contributor

blasten commented Jan 5, 2016

cc @azakus. Is it possible for Polymer.dom(event).localTarget to return window in the case described above?

@blasten
Copy link
Contributor

blasten commented Jan 28, 2016

friendly ping @azakus

@GnunuX
Copy link

GnunuX commented Dec 2, 2016

Any news for this bug?

We can see this bug in polymer-element-catalog project.
For example, in this page:
https://elements.polymer-project.org/browse?tag=live&view=cards

When we click on a tag (for example "live") we has this error:
"TypeError: Argument 1 of Node.contains does not implement interface Node."

johnyanarella pushed a commit to johnyanarella/radium-combo that referenced this issue Feb 8, 2017
Otherwise, this leaked event causes issues when this component is loaded inside a `<paper-drawer-panel>`.
PolymerElements/paper-drawer-panel#92
johnyanarella pushed a commit to johnyanarella/radium-filters that referenced this issue Feb 8, 2017
Otherwise, this leaked event causes issues when this component is loaded inside a `<paper-drawer-panel>`.
PolymerElements/paper-drawer-panel#92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants