modernizr
Version:
Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.
34 lines (32 loc) • 859 B
JavaScript
/*!
{
"name": "Hashchange event",
"property": "hashchange",
"caniuse": "hashchange",
"tags": ["history"],
"notes": [{
"name": "MDN documentation",
"href": "https://developer.mozilla.org/en-US/docs/Web/API/window.onhashchange"
}],
"polyfills": [
"jquery-hashchange",
"moo-historymanager",
"jquery-ajaxy",
"hasher",
"shistory"
]
}
!*/
/* DOC
Detects support for the `hashchange` event, fired when the current location fragment changes.
*/
define(['Modernizr', 'hasEvent'], function(Modernizr, hasEvent) {
Modernizr.addTest('hashchange', function() {
if (hasEvent('hashchange', window) === false) {
return false;
}
// documentMode logic from YUI to filter out IE8 Compat Mode
// which false positives.
return (document.documentMode === undefined || document.documentMode > 7);
});
});