Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(a): prevent Opera from incorrectly navigating on link click
Browse files Browse the repository at this point in the history
we handle the navigation by ourselves, so we need to prevent the default action.

Opera ignores event.preventDefault() call so we must return false.
  • Loading branch information
sgtpep authored and mhevery committed Sep 6, 2012
1 parent 0432915 commit c81d817
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/ng/directive/a.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var htmlAnchorDirective = valueFn({
// if we have no href url, then don't navigate anywhere.
if (!element.attr('href')) {
event.preventDefault();
return false; // Needed for opera
}
});
}
Expand Down

7 comments on commit c81d817

@davispw
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix causes issues #1651, #1674, #1662, and in general any code that relies on click event bubbling.

@dlongley
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was just going to comment about the same thing. This fix is problematic for anything relying on event bubbling.

@chicoxyzzy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this fix doesn't works even for Opera for this issue #1729

@IgorMinar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. this is wrong and should be reverted.

@IgorMinar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

additionally the commit is missing a test that shows what's the actual problem on Opera

@Letsan
Copy link

@Letsan Letsan commented on c81d817 Jan 29, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this been fixed / reverted in 1.0.4 ? I don't see it in the changelog.

@chicoxyzzy
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been fixed

Please sign in to comment.