Editing Modernizr
Appearance
Content that violates any copyrights will be deleted. Encyclopedic content must be verifiable through citations to reliable sources.
Latest revision | Your text | ||
Line 25: | Line 25: | ||
}} |
}} |
||
'''Modernizr''' is a [[JavaScript]] [[library (computer science)|library]] that detects the features available in a user's [[web browser|browser]]. This lets web pages avoid unsupported features by informing the user their browser |
'''Modernizr''' is a [[JavaScript]] [[library (computer science)|library]] that detects the features available in a user's [[web browser|browser]]. This lets web pages avoid unsupported features by informing the user their browser isn't supported or loading a [[Polyfill (programming)|polyfill]]. Modernizr aims to provide [[Feature detection (web development)|feature detection]] in a consistent and easy to use manner that discourages the use of failure-prone [[browser sniffing]].<ref>{{cite web | url=https://modernizr.com/docs/#what-is-modernizr | title=What is Modernizr | accessdate=25 December 2019}}</ref> |
||
==Overview== |
==Overview== |
||
Line 35: | Line 35: | ||
Modernizr offers tests for more than 250 features, then creates a [[JavaScript]] object (named "Modernizr") that contains the results of these tests as [[Boolean data type|boolean]] properties. It also adds classes to the [[HTML]] element based on what features are and are not natively supported. |
Modernizr offers tests for more than 250 features, then creates a [[JavaScript]] object (named "Modernizr") that contains the results of these tests as [[Boolean data type|boolean]] properties. It also adds classes to the [[HTML]] element based on what features are and are not natively supported. |
||
To perform feature detection tests, Modernizr often creates an element, sets a specific style instruction on that element and then immediately tries to retrieve that setting. [[Web browser]]s that understand the instruction will return something sensible; browsers that |
To perform feature detection tests, Modernizr often creates an element, sets a specific style instruction on that element and then immediately tries to retrieve that setting. [[Web browser]]s that understand the instruction will return something sensible; browsers that don't understand it will return nothing or "undefined". Modernizr uses the result to assess whether that feature is supported by the web browser.{{citation needed|date=October 2019}} |
||
Many tests in the documentation come with a small code sample to illustrate how a specific test can be used in web development [[workflow]]. |
Many tests in the documentation come with a small code sample to illustrate how a specific test can be used in web development [[workflow]]. |