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

hasAttribute is not a function #22

Open
vcipriani opened this issue Mar 1, 2018 · 1 comment
Open

hasAttribute is not a function #22

vcipriani opened this issue Mar 1, 2018 · 1 comment

Comments

@vcipriani
Copy link

We're getting a lot of errors in our application coming from the call to target.hasAttribute('data-ember-action') because hasAttribute is not defined. I haven't been able to identify what event is causing it, but it seems like it is likely something where window is the target.

I'll submit a PR if you want to let me know how you want to guard against this. Seems like changing the line to else if (target && target.hasAttribute && target.hasAttribute('data-ember-action')) would work. I'm assuming there is a reason its a do-while loop and not while, otherwise converting to a while loop should also prevent it.

let handleEvent = this._eventHandlers[event] = (event) => {
      let target = event.target;

      do {
        if (viewRegistry[target.id]) {
          if (viewHandler(target, event) === false) {
            event.preventDefault();
            event.stopPropagation();
            break;
          }
        } else if (target.hasAttribute('data-ember-action')) {
          actionHandler(target, event);
          break;
        }

        target = target.parentNode;
      } while(target && target.nodeType === 1);
    };
@vcipriani
Copy link
Author

Because this package is deprecated and replaced in Ember 3.0, we are no longer receiving the error from this package; however, it is now being generated by Ember's internals.
I've created an issue in ember.js - emberjs/ember.js#16730

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

1 participant