- Screen name: david.proweb
david.proweb's Profile
2 Posts
1 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- I posted it into bugs page, but dmethvin told that I need post here before. So, here I'm.Original post:
Well... If you have a a[href^="abc:"] element then you click on it the browser will start a new request, but this pattern will do not execute anything, so you will stand on the same page.
Take a look: http://jsfiddle.net/ZwYYT/
If you start an .ajax() request and .click() in this element, you will have an error, because your Ajax request will be aborted by browser.
The problem is that jQuery not show clearly what happen.
Easy solution: You can solve this problem by return false in .click().
Take a look: http://jsfiddle.net/VexYh/1/
So I suggest two solution:
- Easy but will not solve anything: return a error.message content like "Your request be aborted" (or just simulate a .abort());
- Harder but efficient (need be reviewed): if your a[href] match with /\w\w+\:/ (like my exampleaction: ok, or javascript: void(0);, return false by default.
Take a look: http://jsfiddle.net/wAB4T/1/
Note: in Chrome it'll try to load, but Chrome will cancel request, if you check the Network DevTools you can see it in red.
I tried on 1.8.2, 1.8.3 and edge.
dmethvin's reply:This is not a jQuery bug. Please talk out your frustrations on a forum or blog post.- 18-Mar-2012 01:42 AM
- Forum: Developing jQuery Core
Hi!I guess that it's a very simple idea. Just make a internal cache that store the `selector` and `context` in an array, and if the DOM not be modified since the last time, use the last result.I make this `jsperf` and I think that results are veeeeeery good: http://jsperf.com/domsubtreemodifiedI know that only some browsers support that, and it's deprecated (will be updated) on API, but it really is too faster then current methods, I guess.- «Prev
- Next »
Moderate user : david.proweb