Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajax behavior incompatible with .prop() behavior (as well as absolute urls) #70

Open
Majkl578 opened this issue Jun 25, 2013 · 2 comments
Assignees
Labels
Milestone

Comments

@Majkl578
Copy link

Hi, I've just spent about an hour debugging why my ajax link doesn't work. I had an anchor:

<a href="#">Foo</a>

And I was dynamically changing its href after click on another element. I was using .prop() to change anchor's href. After changing it to .attr(), ajax started working.
Really a WTF. My question is: Is it a bug or a hidden feature with no warning?

@vojtech-dobes
Copy link
Owner

I believe it should be compatible - I could probably read the href via prop() either.

@Majkl578
Copy link
Author

I've been digging a bit and maybe found a root of the problem.
The difference between .prop() and .attr() seems to be that prop returns absolute URL, even though it's set as relative. After doing what I said in first post (getting link by prop and putting it to another anchor), this then makes the following condition in validation extension to fail:

if (/:|^#/.test(analyze.form ? settings.url : analyze.el.attr('href'))) return false;
. (By the way, am I correct nette.ajax.js doesn't work with absolute URLs at all because of this?)

Edit: Yup, it seems when validation ext is enabled (by default), absolute URLs do not work at all. :/ (Changed the title of the issue.)

@ghost ghost assigned vojtech-dobes Jul 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants