This repository has been archived by the owner on Dec 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #263 from WordPress/primary-nav
Update primary navigation
- Loading branch information
Showing
10 changed files
with
310 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* File primary-navigation.js. | ||
* | ||
* Required to open and close the mobile navigation. | ||
*/ | ||
|
||
/** | ||
* Polyfill for Element.closest() because we need to support IE11. | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/closest | ||
*/ | ||
if ( ! Element.prototype.matches ) { | ||
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; | ||
} | ||
|
||
if ( ! Element.prototype.closest ) { | ||
Element.prototype.closest = function( s ) { | ||
var el = this; | ||
do { | ||
if ( Element.prototype.matches.call( el, s ) ) { | ||
return el; | ||
} | ||
el = el.parentElement || el.parentNode; | ||
} while ( el !== null && el.nodeType === 1 ); | ||
return null; | ||
}; | ||
} | ||
|
||
/** | ||
* Polyfill for NodeList.foreach() because we need to support IE11. | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach | ||
*/ | ||
if ( window.NodeList && ! NodeList.prototype.forEach ) { | ||
NodeList.prototype.forEach = function( callback, thisArg ) { | ||
thisArg = thisArg || window; | ||
for ( var i = 0; i < this.length; i++ ) { | ||
callback.call( thisArg, this[i], i, this ); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.