paper-drawer-panel icon indicating copy to clipboard operation
paper-drawer-panel copied to clipboard

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

Open ArthurJahn opened this issue 10 years ago • 5 comments

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.

ArthurJahn avatar Aug 31 '15 04:08 ArthurJahn

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

blasten avatar Sep 24 '15 21:09 blasten

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.

ArthurJahn avatar Sep 24 '15 22:09 ArthurJahn

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

blasten avatar Jan 05 '16 18:01 blasten

friendly ping @azakus

blasten avatar Jan 28 '16 20:01 blasten

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."

GnunuX avatar Dec 02 '16 11:12 GnunuX