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

fix(compile): Collecting directives from tags that will be replaced #2617

Closed
wants to merge 1 commit into from

Conversation

lgalfaso
Copy link
Contributor

@lgalfaso lgalfaso commented May 9, 2013

Fix the collecting of element directives from tags that will get replaced
by another directive on an attribute. If the element has an attribute
or class directive that will replace the entire element, then do not
collect the element directive on the tag

Closes #2573

BREAKING CHANGE:

  • Will break directives that made the assumption that any element directive
    on the replaced tag would get collected
  • Will break element directives that expect to be collected twice when they
    were replaced by another directive

Fix the collecting of directives from elements that will get replaced
by another directive on an attribute. If the element has an attribute
or class directive that will replace the entire element, then do not
collect the directive on the element

Closes angular#2573

BREAKING CHANGE:
* Will break directives that made the assumption that any directive
on the replaced element would get collected
* Will break directives that expect to be collected twice when they
were replaced by another directive that is marked as replace
@petebacondarwin
Copy link
Contributor

  • Contributor signed CLA now or in the past (if you just signed, leave a comment here with your real name)
  • PR doesn't introduce new api
  • PR is approved by 2+ senior team members
  • Intentional breaking change (both):
    • Approved by 2+ senior team members
    • The breaking change is documented (including migration steps)
  • PR contains unit tests
  • PR contains e2e tests (if suitable)
  • PR contains documentation update (if suitable)
  • PR passes all tests on Travis (sanity)
  • PR passes all tests on ci.angularjs.org (cross-browser compatibility)
  • PR is rebased against recent master
  • PR is squashed into one commit per logical change
  • PR's commit messages are descriptive and allows us to autogenerate release notes (required commit message format)
  • All changes requested in review have been implemented

@petebacondarwin
Copy link
Contributor

I like this idea but it needs to be looked at very carefully.

@IgorMinar
Copy link
Contributor

This solves only case where an element directive is duplicated via replacement merge. You could end up in the same situation just just by using different syntaxes to trigger the same directive: <div ng-repeat="item in items" ng:repeat="user in users"></div>.

A better fix would be to ensure that once we collect all directives, we run though the list and ensure that each directive in the list is unique, if not we should drop all but the first occurrence of the directive.

@lgalfaso
Copy link
Contributor Author

Collecting all directives and then deciding would be ideal, but we would need a lot more care as we might not have the directive template as this directive is using a templateUrl.

@lgalfaso
Copy link
Contributor Author

Compilation is moving in a different direction, closing

@lgalfaso lgalfaso closed this Feb 28, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replacing input element in the directive re-attaches the formatters and parsers
3 participants