/*
YUI 3.17.2 (build 9c3c78e)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/

if (typeof __coverage__ === 'undefined') { __coverage__ = {}; }
if (!__coverage__['build/pjax-content/pjax-content.js']) {
   __coverage__['build/pjax-content/pjax-content.js'] = {"path":"build/pjax-content/pjax-content.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":24},"end":{"line":1,"column":43}}},"2":{"name":"PjaxContent","line":35,"loc":{"start":{"line":35,"column":0},"end":{"line":35,"column":23}}},"3":{"name":"(anonymous_3)","line":61,"loc":{"start":{"line":61,"column":16},"end":{"line":61,"column":40}}},"4":{"name":"(anonymous_4)","line":117,"loc":{"start":{"line":117,"column":17},"end":{"line":117,"column":43}}},"5":{"name":"(anonymous_5)","line":130,"loc":{"start":{"line":130,"column":48},"end":{"line":130,"column":77}}},"6":{"name":"(anonymous_6)","line":174,"loc":{"start":{"line":174,"column":23},"end":{"line":174,"column":58}}},"7":{"name":"(anonymous_7)","line":200,"loc":{"start":{"line":200,"column":18},"end":{"line":200,"column":30}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":281,"column":63}},"2":{"start":{"line":35,"column":0},"end":{"line":35,"column":25}},"3":{"start":{"line":37,"column":0},"end":{"line":203,"column":2}},"4":{"start":{"line":62,"column":8},"end":{"line":66,"column":22}},"5":{"start":{"line":68,"column":8},"end":{"line":72,"column":9}},"6":{"start":{"line":69,"column":12},"end":{"line":69,"column":62}},"7":{"start":{"line":71,"column":12},"end":{"line":71,"column":32}},"8":{"start":{"line":74,"column":8},"end":{"line":80,"column":9}},"9":{"start":{"line":75,"column":12},"end":{"line":75,"column":48}},"10":{"start":{"line":77,"column":12},"end":{"line":79,"column":13}},"11":{"start":{"line":78,"column":16},"end":{"line":78,"column":54}},"12":{"start":{"line":82,"column":8},"end":{"line":82,"column":23}},"13":{"start":{"line":118,"column":8},"end":{"line":118,"column":26}},"14":{"start":{"line":121,"column":8},"end":{"line":123,"column":9}},"15":{"start":{"line":122,"column":12},"end":{"line":122,"column":34}},"16":{"start":{"line":126,"column":8},"end":{"line":134,"column":9}},"17":{"start":{"line":130,"column":12},"end":{"line":133,"column":15}},"18":{"start":{"line":131,"column":16},"end":{"line":131,"column":72}},"19":{"start":{"line":132,"column":16},"end":{"line":132,"column":43}},"20":{"start":{"line":137,"column":8},"end":{"line":156,"column":11}},"21":{"start":{"line":175,"column":8},"end":{"line":178,"column":32}},"22":{"start":{"line":181,"column":8},"end":{"line":181,"column":32}},"23":{"start":{"line":185,"column":8},"end":{"line":185,"column":33}},"24":{"start":{"line":186,"column":8},"end":{"line":186,"column":36}},"25":{"start":{"line":188,"column":8},"end":{"line":188,"column":21}},"26":{"start":{"line":201,"column":8},"end":{"line":201,"column":29}},"27":{"start":{"line":205,"column":0},"end":{"line":276,"column":2}},"28":{"start":{"line":278,"column":0},"end":{"line":278,"column":28}}},"branchMap":{"1":{"line":64,"type":"binary-expr","locations":[{"start":{"line":64,"column":44},"end":{"line":64,"column":56}},{"start":{"line":64,"column":60},"end":{"line":64,"column":62}}]},"2":{"line":68,"type":"if","locations":[{"start":{"line":68,"column":8},"end":{"line":68,"column":8}},{"start":{"line":68,"column":8},"end":{"line":68,"column":8}}]},"3":{"line":68,"type":"binary-expr","locations":[{"start":{"line":68,"column":12},"end":{"line":68,"column":27}},{"start":{"line":68,"column":31},"end":{"line":68,"column":35}}]},"4":{"line":74,"type":"if","locations":[{"start":{"line":74,"column":8},"end":{"line":74,"column":8}},{"start":{"line":74,"column":8},"end":{"line":74,"column":8}}]},"5":{"line":74,"type":"binary-expr","locations":[{"start":{"line":74,"column":12},"end":{"line":74,"column":25}},{"start":{"line":74,"column":29},"end":{"line":74,"column":33}}]},"6":{"line":77,"type":"if","locations":[{"start":{"line":77,"column":12},"end":{"line":77,"column":12}},{"start":{"line":77,"column":12},"end":{"line":77,"column":12}}]},"7":{"line":121,"type":"if","locations":[{"start":{"line":121,"column":8},"end":{"line":121,"column":8}},{"start":{"line":121,"column":8},"end":{"line":121,"column":8}}]},"8":{"line":126,"type":"if","locations":[{"start":{"line":126,"column":8},"end":{"line":126,"column":8}},{"start":{"line":126,"column":8},"end":{"line":126,"column":8}}]},"9":{"line":131,"type":"cond-expr","locations":[{"start":{"line":131,"column":50},"end":{"line":131,"column":53}},{"start":{"line":131,"column":56},"end":{"line":131,"column":59}}]},"10":{"line":132,"type":"binary-expr","locations":[{"start":{"line":132,"column":31},"end":{"line":132,"column":35}},{"start":{"line":132,"column":39},"end":{"line":132,"column":41}}]}},"code":["(function () { YUI.add('pjax-content', function (Y, NAME) {","","/**","`Y.Router` extension that provides the content fetching and handling needed to","implement the standard pjax (HTMP5 pushState + Ajax) functionality.","","@module pjax","@submodule pjax-content","@since 3.7.0","**/","","/**","`Y.Router` extension that provides the content fetching and handling needed to","implement the standard pjax (HTMP5 pushState + Ajax) functionality.","","This makes it easy to fetch server rendered content for URLs using Ajax. By","helping the router to fulfill the \"request\" for the content you can avoid full","page loads.","","The `PjaxContent` class isn't useful on its own, but can be mixed into a","`Router`-based class along with the `PjaxBase` class to add Pjax functionality","to that Router. For a pre-made standalone Pjax router, see the `Pjax` class.","","    var MyRouter = Y.Base.create('myRouter', Y.Router, [","        Y.PjaxBase,","        Y.PjaxContent","    ], {","        // ...","    });","","@class PjaxContent","@extensionfor Router","@since 3.7.0","**/","function PjaxContent() {}","","PjaxContent.prototype = {","    // -- Public Methods -------------------------------------------------------","","    /**","    Extracts and returns the relevant HTML content from an Ajax response. The","    content is extracted using the `contentSelector` attribute as a CSS","    selector. If `contentSelector` is `null`, the entire response will be","    returned.","","    The return value is an object containing two properties:","","      * `node`: A `Y.Node` instance for a document fragment containing the","        extracted HTML content.","","      * `title`: The title of the HTML page, if any, extracted using the","        `titleSelector` attribute (which defaults to looking for a `<title>`","        element). If `titleSelector` is not set or if a title could not be","        found, this property will be `undefined`.","","    @method getContent","    @param {String} responseText Raw Ajax response text.","    @return {Object} Content object with the properties described above.","    @since 3.5.0","    **/","    getContent: function (responseText) {","        var content         = {},","            contentSelector = this.get('contentSelector'),","            frag            = Y.Node.create(responseText || ''),","            titleSelector   = this.get('titleSelector'),","            titleNode;","","        if (contentSelector && frag) {","            content.node = frag.all(contentSelector).toFrag();","        } else {","            content.node = frag;","        }","","        if (titleSelector && frag) {","            titleNode = frag.one(titleSelector);","","            if (titleNode) {","                content.title = titleNode.get('text');","            }","        }","","        return content;","    },","","    /**","    Pjax route middleware to load content from a server. This makes an Ajax","    request for the requested URL, parses the returned content and puts it on","    the route's response object.","","    This is route middleware and not intended to be the final callback for a","    route. This will add the following information to the route's request and","    response objects:","","      - `req.ioURL`: The full URL that was used to make the `Y.io()` XHR. This","        may contain `\"pjax=1\"` if the `addPjaxParam` option is set.","","      - `res.content`: An object containing `node` and `title` properties for","        the content extracted from the server's response. See `getContent()` for","        more details.","","      - `res.ioResponse`: The full `Y.io()` response object. This is useful if","        you need access to the XHR's response `status` or HTTP headers.","","    @example","        router.route('/foo/', 'loadContent', function (req, res, next) {","            Y.one('container').setHTML(res.content.node);","            Y.config.doc.title = res.content.title;","        });","","    @method loadContent","    @param {Object} req Request object.","    @param {Object} res Response Object.","    @param {Function} next Function to pass control to the next route callback.","    @since 3.7.0","    @see Router.route()","    **/","    loadContent: function (req, res, next) {","        var url = req.url;","","        // If there's an outstanding request, abort it.","        if (this._request) {","            this._request.abort();","        }","","        // Add a 'pjax=1' query parameter if enabled.","        if (this.get('addPjaxParam')) {","            // Captures the path with query, and hash parts of the URL. Then","            // properly injects the \"pjax=1\" query param in the right place,","            // before any hash fragment, and returns the updated URL.","            url = url.replace(/([^#]*)(#.*)?$/, function (match, path, hash) {","                path += (path.indexOf('?') > -1 ? '&' : '?') + 'pjax=1';","                return path + (hash || '');","            });","        }","","        // Send a request.","        this._request = Y.io(url, {","            'arguments': {","                route: {","                    req : req,","                    res : res,","                    next: next","                },","","                url: url","            },","","            context: this,","            headers: {'X-PJAX': 'true'},","            timeout: this.get('timeout'),","","            on: {","                complete: this._onPjaxIOComplete,","                end     : this._onPjaxIOEnd","            }","        });","    },","","    // -- Event Handlers -------------------------------------------------------","","    /**","    Handles IO complete events.","","    This parses the content from the `Y.io()` response and puts it on the","    route's response object.","","    @method _onPjaxIOComplete","    @param {String} id The `Y.io` transaction id.","    @param {Object} ioResponse The `Y.io` response object.","    @param {Object} details Extra details carried through from `loadContent()`.","    @protected","    @since 3.7.0","    **/","    _onPjaxIOComplete: function (id, ioResponse, details) {","        var content = this.getContent(ioResponse.responseText),","            route   = details.route,","            req     = route.req,","            res     = route.res;","","        // Put the URL requested through `Y.io` on the route's `req` object.","        req.ioURL = details.url;","","        // Put the parsed content and `Y.io` response object on the route's","        // `res` object.","        res.content    = content;","        res.ioResponse = ioResponse;","","        route.next();","    },","","    /**","    Handles IO end events.","","    @method _onPjaxIOEnd","    @param {String} id The `Y.io` transaction id.","    @param {Object} details Extra details carried through from `loadContent()`.","    @protected","    @since 3.5.0","    **/","    _onPjaxIOEnd: function () {","        this._request = null;","    }","};","","PjaxContent.ATTRS = {","    /**","    If `true`, a \"pjax=1\" query parameter will be appended to all URLs","    requested via Pjax.","","    Browsers ignore HTTP request headers when caching content, so if the","    same URL is used to request a partial Pjax page and a full page, the","    browser will cache them under the same key and may later load the","    cached partial page when the user actually requests a full page (or vice","    versa).","","    To prevent this, we can add a bogus query parameter to the URL so that","    Pjax URLs will always be cached separately from non-Pjax URLs.","","    @attribute addPjaxParam","    @type Boolean","    @default true","    @since 3.5.0","    **/","    addPjaxParam: {","        value: true","    },","","    /**","    CSS selector used to extract a specific portion of the content of a page","    loaded via Pjax.","","    For example, if you wanted to load the page `example.html` but only use","    the content within an element with the id \"pjax-content\", you'd set","    `contentSelector` to \"#pjax-content\".","","    If not set, the entire page will be used.","","    @attribute contentSelector","    @type String","    @default null","    @since 3.5.0","    **/","    contentSelector: {","        value: null","    },","","    /**","    CSS selector used to extract a page title from the content of a page","    loaded via Pjax.","","    By default this is set to extract the title from the `<title>` element,","    but you could customize it to extract the title from an `<h1>`, or from","    any other element, if that's more appropriate for the content you're","    loading.","","    @attribute titleSelector","    @type String","    @default \"title\"","    @since 3.5.0","    **/","    titleSelector: {","        value: 'title'","    },","","    /**","    Time in milliseconds after which an Ajax request should time out.","","    @attribute timeout","    @type Number","    @default 30000","    @since 3.5.0","    **/","    timeout: {","        value: 30000","    }","};","","Y.PjaxContent = PjaxContent;","","","}, '3.17.2', {\"requires\": [\"io-base\", \"node-base\", \"router\"]});","","}());"]};
}
var __cov_FhxxnqGo2AeguLFAF26zhg = __coverage__['build/pjax-content/pjax-content.js'];
__cov_FhxxnqGo2AeguLFAF26zhg.s['1']++;YUI.add('pjax-content',function(Y,NAME){__cov_FhxxnqGo2AeguLFAF26zhg.f['1']++;__cov_FhxxnqGo2AeguLFAF26zhg.s['2']++;function PjaxContent(){__cov_FhxxnqGo2AeguLFAF26zhg.f['2']++;}__cov_FhxxnqGo2AeguLFAF26zhg.s['3']++;PjaxContent.prototype={getContent:function(responseText){__cov_FhxxnqGo2AeguLFAF26zhg.f['3']++;__cov_FhxxnqGo2AeguLFAF26zhg.s['4']++;var content={},contentSelector=this.get('contentSelector'),frag=Y.Node.create((__cov_FhxxnqGo2AeguLFAF26zhg.b['1'][0]++,responseText)||(__cov_FhxxnqGo2AeguLFAF26zhg.b['1'][1]++,'')),titleSelector=this.get('titleSelector'),titleNode;__cov_FhxxnqGo2AeguLFAF26zhg.s['5']++;if((__cov_FhxxnqGo2AeguLFAF26zhg.b['3'][0]++,contentSelector)&&(__cov_FhxxnqGo2AeguLFAF26zhg.b['3'][1]++,frag)){__cov_FhxxnqGo2AeguLFAF26zhg.b['2'][0]++;__cov_FhxxnqGo2AeguLFAF26zhg.s['6']++;content.node=frag.all(contentSelector).toFrag();}else{__cov_FhxxnqGo2AeguLFAF26zhg.b['2'][1]++;__cov_FhxxnqGo2AeguLFAF26zhg.s['7']++;content.node=frag;}__cov_FhxxnqGo2AeguLFAF26zhg.s['8']++;if((__cov_FhxxnqGo2AeguLFAF26zhg.b['5'][0]++,titleSelector)&&(__cov_FhxxnqGo2AeguLFAF26zhg.b['5'][1]++,frag)){__cov_FhxxnqGo2AeguLFAF26zhg.b['4'][0]++;__cov_FhxxnqGo2AeguLFAF26zhg.s['9']++;titleNode=frag.one(titleSelector);__cov_FhxxnqGo2AeguLFAF26zhg.s['10']++;if(titleNode){__cov_FhxxnqGo2AeguLFAF26zhg.b['6'][0]++;__cov_FhxxnqGo2AeguLFAF26zhg.s['11']++;content.title=titleNode.get('text');}else{__cov_FhxxnqGo2AeguLFAF26zhg.b['6'][1]++;}}else{__cov_FhxxnqGo2AeguLFAF26zhg.b['4'][1]++;}__cov_FhxxnqGo2AeguLFAF26zhg.s['12']++;return content;},loadContent:function(req,res,next){__cov_FhxxnqGo2AeguLFAF26zhg.f['4']++;__cov_FhxxnqGo2AeguLFAF26zhg.s['13']++;var url=req.url;__cov_FhxxnqGo2AeguLFAF26zhg.s['14']++;if(this._request){__cov_FhxxnqGo2AeguLFAF26zhg.b['7'][0]++;__cov_FhxxnqGo2AeguLFAF26zhg.s['15']++;this._request.abort();}else{__cov_FhxxnqGo2AeguLFAF26zhg.b['7'][1]++;}__cov_FhxxnqGo2AeguLFAF26zhg.s['16']++;if(this.get('addPjaxParam')){__cov_FhxxnqGo2AeguLFAF26zhg.b['8'][0]++;__cov_FhxxnqGo2AeguLFAF26zhg.s['17']++;url=url.replace(/([^#]*)(#.*)?$/,function(match,path,hash){__cov_FhxxnqGo2AeguLFAF26zhg.f['5']++;__cov_FhxxnqGo2AeguLFAF26zhg.s['18']++;path+=(path.indexOf('?')>-1?(__cov_FhxxnqGo2AeguLFAF26zhg.b['9'][0]++,'&'):(__cov_FhxxnqGo2AeguLFAF26zhg.b['9'][1]++,'?'))+'pjax=1';__cov_FhxxnqGo2AeguLFAF26zhg.s['19']++;return path+((__cov_FhxxnqGo2AeguLFAF26zhg.b['10'][0]++,hash)||(__cov_FhxxnqGo2AeguLFAF26zhg.b['10'][1]++,''));});}else{__cov_FhxxnqGo2AeguLFAF26zhg.b['8'][1]++;}__cov_FhxxnqGo2AeguLFAF26zhg.s['20']++;this._request=Y.io(url,{'arguments':{route:{req:req,res:res,next:next},url:url},context:this,headers:{'X-PJAX':'true'},timeout:this.get('timeout'),on:{complete:this._onPjaxIOComplete,end:this._onPjaxIOEnd}});},_onPjaxIOComplete:function(id,ioResponse,details){__cov_FhxxnqGo2AeguLFAF26zhg.f['6']++;__cov_FhxxnqGo2AeguLFAF26zhg.s['21']++;var content=this.getContent(ioResponse.responseText),route=details.route,req=route.req,res=route.res;__cov_FhxxnqGo2AeguLFAF26zhg.s['22']++;req.ioURL=details.url;__cov_FhxxnqGo2AeguLFAF26zhg.s['23']++;res.content=content;__cov_FhxxnqGo2AeguLFAF26zhg.s['24']++;res.ioResponse=ioResponse;__cov_FhxxnqGo2AeguLFAF26zhg.s['25']++;route.next();},_onPjaxIOEnd:function(){__cov_FhxxnqGo2AeguLFAF26zhg.f['7']++;__cov_FhxxnqGo2AeguLFAF26zhg.s['26']++;this._request=null;}};__cov_FhxxnqGo2AeguLFAF26zhg.s['27']++;PjaxContent.ATTRS={addPjaxParam:{value:true},contentSelector:{value:null},titleSelector:{value:'title'},timeout:{value:30000}};__cov_FhxxnqGo2AeguLFAF26zhg.s['28']++;Y.PjaxContent=PjaxContent;},'3.17.2',{'requires':['io-base','node-base','router']});
