ckald / jquery-pjax Goto Github PK
View Code? Open in Web Editor NEWThis project forked from defunkt/jquery-pjax
jQuery PJAX with old-school hashes support
License: Other
This project forked from defunkt/jquery-pjax
jQuery PJAX with old-school hashes support
License: Other
Недавно начал использовать вашу модификацию, вновь IE отличается.
PHP: если в запрашиваемом документе, например response.php принудительно выставить header("Content-type:text/html; charset=utf8"); IE просто перейдёт по ссылке обойдя вызов pjax.
The title tag is not updated - (FF12, and Chrome)
I don't know how to make a patch but for a fix - my git diff looks like this
@@ -258,6 +258,9 @@
options.context = $container
options.success = function(data, textStatus, jqXHR){
+
+ var $data = $(data);
+
if ( options.fragment ) {
// If they specified a fragment, look for it in the response
// and pull it out.
@@ -275,11 +278,14 @@
// Make it happen.
this.html(data);
-
+
// If there's a <title> tag in the response, use it as
// the page's title.
- var oldTitle = document.title,
- title = $.trim( this.find('title').remove().text() );
+ var oldTitle = document.title;
+
+ title= findAll($data, 'title').last().text()
+ //title = $.trim( data.find('title').remove().text() );
+
if ( title ) document.title = title;
var state = {
@@ -363,6 +369,24 @@
return pjax.xhr;
}
+ // Internal: Filter and find all elements matching the selector.
+ //
+ // Where $.fn.find only matches descendants, findAll will test all the
+ // top level elements in the jQuery object as well.
+ //
+ // elems - jQuery object of Elements
+ // selector - String selector to match
+ //
+ // Returns a jQuery object.
+ function findAll(elems, selector) {
+ var results = $()
+ elems.each(function() {
+ if ($(this).is(selector))
+ results = results.add(this)
+ results = results.add(selector, this)
+ })
+ return results
+ }
pjax.defaults = {
timeout: 650,
@@ -468,4 +492,5 @@
$(window).hashchange();
}
+
})(jQuery);
If I create my site in the folder(example: http://site.com/test) browsers, which don't support PushState, the page is don't open.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.