This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(a): do not link when href or name exists in template
Change the a directive to link and hookup a click event only when there is no href or name in the template element. In a large Google app, this results in about 800 fewer registrations, saving a small but measurable amount of time and memory. Closes #5362
- Loading branch information
Showing
2 changed files
with
36 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f3de5b6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this change actually breaks an e2e test that we have in ngHref: https://github.com/angular/angular.js/blob/master/src/ng/directive/booleanAttrs.js#L72-L76
But it doesn't get caught by the protractor run because the old docs embeds this example and blocks clicks from propagating:
https://github.com/angular/angular.js/blob/master/docs/components/angular-bootstrap/bootstrap-prettify.js#L235
In the new docs, we are running these examples in iframes and so they do not have their click events hijacked. This makes the test above fail.
Either we modify this performance refactoring to allow this test to pass or we remove this aspect from the example. @IgorMinar and @kseamon what shall it be?
f3de5b6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a runnable example of the problem: http://ci.angularjs.org/job/angular.js-pete/421/artifact/build/docs/examples/example-example4/index.html
Clicking on "anchor (link, don't reload)" does do a reload.
f3de5b6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We at MobileIron are also seeing the same issue. As per W3Schools http://www.w3schools.com/tags/att_a_name.asp "name" is not supported by anchor tag, why consider it ?
<a href="" name="xyz" ng-click="value=4"></a> reloads the page. We got to fix it.
f3de5b6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #6554 and #9214