Re: [dom] matches, querySelector, etc. shouldn't throw on an unrecognized selector (#39)

I don't have much of an opinion on the API ergonomics of this. The biggest issue indeed would be code that depends on the exception being thrown, which normally isn't on the radar, but in this case looks like it is.

We could measure how often the exception is thrown in Blink, but given how widely used the API itself is I'd be somewhat surprised if it's negligible.

I'm not a big fan of making the prefixed and unprefixed APIs different, there's so much code assuming that they're equivalent, a difference here might be annoying to debug.

Perhaps an API that returns null if the selector is supported and something non-null that can be passed to `matches((DOMString or SomethingNotNull) selectors)` would solve the problem? The overhead of making that `SomethingNotNull` be accessible from scripts might not be negligible though, it's not a given that it would be an improvement at least.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/39#issuecomment-125603109

Received on Tuesday, 28 July 2015 13:15:20 UTC