Created
August 1, 2012 20:09
-
-
Save radmiraal/3230269 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var isLocal = (function() { | |
var rhash = /#.*$/, | |
currentPage = location.href.replace( rhash, "" ); | |
return function( anchor ) { | |
// clone the node to work around IE 6 not normalizing the href property | |
// if it's manually set, i.e., a.href = "#foo" kills the normalization | |
anchor = anchor.cloneNode( false ); | |
return anchor.hash.length > 1 && | |
anchor.href.replace( rhash, "" ) === currentPage; | |
}; | |
})(); |
This file contains hidden or 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
var isLocal = (function() { | |
var rhash = /#.*$/, | |
currentPage = location.href.replace( rhash, "" ); | |
return function( anchor ) { | |
var href = anchor.href.replace(location.origin + '/', location.href); | |
// clone the node to work around IE 6 not normalizing the href property | |
// if it's manually set, i.e., a.href = "#foo" kills the normalization | |
anchor = anchor.cloneNode( false ); | |
return anchor.hash.length > 1 && | |
href.replace( rhash, "" ) === currentPage; | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment