assaf / zombie

Insanely fast, full-stack, headless browser testing using node.js
http://zombie.js.org/
MIT License
5.65k stars 520 forks source link

javascript: link or action targets not handled correctly #700

Open jsfan opened 10 years ago

jsfan commented 10 years ago

If a link or form contains JavaScript directly in the href or action, Zombie seems to understand that as opening a new page like a normal hyperlink would. While the JavaScript is still executed correctly, the DOM is lost as a result of Zombie trying to load the invalid target as a new page.

A problematic link would be e.g. <a href="javascript:void(0)">do something</a>

aik099 commented 10 years ago

I saw that too. I just rewrote HTML for not to use javascript: because there is no such protocol.

jsfan commented 10 years ago

Well, that only works if you control the HTML you're reading which in my case isn't true. I suspect Zombie should follow the "be strict with what you do, be lenient with what you require" approach to standards.

aik099 commented 10 years ago

Looking at how things happen in Zombie community, the bug won't be ever fixed by @assaf himself, unless you send a PR with a fix. For example some of bugs I reported as still there: https://github.com/assaf/zombie/issues/created_by/aik099?state=open (some of them are from previous years even).

jsfan commented 10 years ago

Yep. I'm planning to look into it and see if I can fix it and do a pull request. Still wanted to put it out there first.

andersonmadeira commented 9 years ago

I'm using the latest version and this issue still persists, is there already a pull request for this? did @assaf merge it?

assaf commented 9 years ago

There's no pull request for that.

jsfan commented 9 years ago

I'm sorry I never attended to this. I actually switched my project to webdriver, so this has lost its priority for me. I might still come back to it eventually but can't promise anything.