question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IE11 - Error connecting controller - TypeError: Object doesn't support property or method 'matches'

See original GitHub issue

Getting this error thrown with a controller, seems to be linked to accessing a target, but unconfirmed.

image

Stripped back my controller to the following code… Console.log(‘1’) fires, the rest is where the error is thrown.

Data-controller is on the body, as it needs to be a site-wide thing.

// Samples Controller
import { Controller } from 'stimulus'

export default class extends Controller {
  static targets = ['counter']

  connect() {
    this.updateCount()
  }

  updateCount() {
    console.log('1')
    console.log(this.counterTargets)
    console.log('2')
  }
}

It seems to stem from this…

Scope.prototype.findAllElements = function (selector) {
        var head = this.element.matches(selector) ? [this.element] : [];
        var tail = this.filterElements(Array.from(this.element.querySelectorAll(selector)));
        return head.concat(tail);
    };

Edit: this.targets.findAll(‘counter’) returns the same error in all controllers.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
javancommented, Jan 7, 2019
1reaction
nicholas-ccommented, Nov 22, 2018

Doh!!! My bad! Deepest apologies!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object doesn't support property or method 'matches' · Issue #780
Hello,. I'm trying to figure out why I have this error in IE11.. I setup core-js on the simplest project as possible.
Read more >
Error in IE 11 browser - EXCEPTION: Object doesn't support ...
It looks like IE implements the matches function using a non-standard name (source). That link includes a polyfill which will define the ...
Read more >
Getting Object doesnt support property or method forEach ...
I have an application which works fine in Edge and Google Chrome. But whenever sample application is run in IE11 and we go...
Read more >
Handling common JavaScript problems - MDN Web Docs
If you look at the console, you'll see the error message "Uncaught TypeError: can't access property "length", heroes is undefined", and the ...
Read more >
"Object doesn't support property or method 'match'" error ...
1. Click setting in IE11, Open 'Internet option' · 2. Open 'Internet option' in Setting · 3. Switch to 'Security' · 4. Select...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found