/** * I handle a click event from within the host. */ function handleClick( event ) { if ( isEventModified( event ) ) { return; } var anchor = getAnchorFromEvent( event ); if ( ! anchor || isAnchorExternal( anchor ) ) { return; } event.preventDefault(); // Update the URL to reflect the anchor HREF; but, don't navigate the page. window.history.pushState( { xHandler: xHandler, xID: xID, href: anchor.href }, null, anchor.href ); // Implement the "navigation" content swap using AJAX. processHref( anchor.href ); }