-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[FEATURE ember-routing-linkto-target-attribute] #4718
[FEATURE ember-routing-linkto-target-attribute] #4718
Conversation
@@ -427,7 +427,14 @@ var LinkView = Ember.LinkView = EmberView.extend({ | |||
_invoke: function(event) { | |||
if (!isSimpleClick(event)) { return true; } | |||
|
|||
if (this.preventDefault !== false) { event.preventDefault(); } | |||
if (this.preventDefault !== false) { | |||
if (Ember.FEATURES.isEnabled("ember-routing-linkto-target-attribute") && !this.get('target')) { |
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.
For the feature flags to be stripped by defeatureify you can not combine logic (it only looks for the single conditional).
Also, both sides of this are doing the same thing, is the conditional needed?
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.
Oops that was my bad!! those lines has to be
if (Ember.FEATURES.isEnabled("ember-routing-linkto-target-attribute")) {
if(!this.get('target')) {
event.preventDefault();
}
} else {
event.preventDefault();
}
The preventDefault
should not happen when a target attribute is provided
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.
I see, that makes sense.
link-to
helper
💯 I'm currently injecting this ability into LinkView so I'm very excited for this. |
can you add tests? |
@stefanpenner Added the test cases. I do have a query. |
@selvagsz @stefanpenner IMO since I'm using similar functionality in my apps: I chose to have it behave just like as if you didn't include it. i.e. it does still |
@jayphelps Thanks for your suggestion. Updated my PR now |
So, we're going to merge this. I was opposed at first because I was afraid that this was a slippery slope, due to:
However, given some of the new capabilities coming in HTMLbars, there should no longer be any need to use |
Does this need anything else to get into the |
…te_for_linkto [FEATURE ember-routing-linkto-target-attribute]
@rjackson please pull into beta |
@stefanpenner - Generally speaking we do not add new feature flagged items to the beta branch. We would normally enable by default on master/canary then let it roll to beta at the next cycle. Do you think we need to circumvent that in this case? |
@rjackson i have no idea why i said that |
please don't listen to me |
👍 |
This was go-ed at today's core team meeting. |
Thanks 👍 |
Taking up the row of #3924 . Supports
target
attribute for thelink-to anchor
element