IE11 - Error connecting controller - TypeError: Object doesn't support property or method 'matches'
See original GitHub issueGetting this error thrown with a controller, seems to be linked to accessing a target, but unconfirmed.
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:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in v1.1.1 via https://github.com/stimulusjs/stimulus/commit/0251c87795f351a7462d00fa0f028b2daf967a01. Thanks for the heads up, @jalada!
Doh!!! My bad! Deepest apologies!