I'm looking at modernizr which is supposed to help with feature detection which is supposedly the bees knees in figuring out if your website is compatible with a given web browser but I do not see anything that indicates that I can use it to detect custom HTML elements that we create & define in our content.
If it's not modernizr, how do I reliably detect whether a browser is capable of handling custom HTML elements the "HTML 5" way?
The concept of feature detection The idea behind feature detection is that you can run a test to determine whether a feature is supported in the current browser, and then conditionally run code to provide an acceptable experience both in browsers that do support the feature, and browsers that don't.
New! Save questions or answers and organize your favorite content. Learn more.
One of the key features of the Web Components standard is the ability to create custom elements that encapsulate your functionality on an HTML page, rather than having to make do with a long, nested batch of elements that together provide a custom page feature.
Modernizr doesn't have a test for this at the moment, however since it has an API to create the element, it should be as simple as
var supportsCustomElements = ('registerElement' in document)
to detect for v0 of the API. To check for the more up to date v1, its
var supportsCustomElements = ('customElements' in window)
(more info on the in
operator)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With