-
-
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
Remove LinkTo's tagName #19662
Remove LinkTo's tagName #19662
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,11 @@ class LinkTo extends InternalComponent implements DeprecatingInternalComponent { | |
!('model' in this.args.named && 'models' in this.args.named) | ||
); | ||
|
||
assert( | ||
'Passing the `@tagName` argument to <LinkTo> is not supported.', | ||
!('tagName' in this.args.named) | ||
); | ||
|
||
super.validateArguments(); | ||
} | ||
|
||
|
@@ -418,40 +423,6 @@ if (EMBER_MODERNIZED_BUILT_IN_COMPONENTS) { | |
}); | ||
} | ||
|
||
// @tagName | ||
{ | ||
let superOnUnsupportedArgument = prototype['onUnsupportedArgument']; | ||
|
||
Object.defineProperty(prototype, 'onUnsupportedArgument', { | ||
configurable: true, | ||
enumerable: false, | ||
value: function onUnsupportedArgument(this: LinkTo, name: string): void { | ||
if (name === 'tagName') { | ||
let tagName = this.named('tagName'); | ||
|
||
deprecate( | ||
`Passing the \`@tagName\` argument to <LinkTo> is deprecated. Using a <${tagName}> ` + | ||
'element for navigation is not recommended as it creates issues with assistive ' + | ||
'technologies. Remove this argument to use the default <a> element. In the rare ' + | ||
'cases that calls for using a different element, refactor to use the router ' + | ||
'service inside a custom event handler instead.', | ||
false, | ||
{ | ||
id: 'ember.link-to.tag-name', | ||
for: 'ember-source', | ||
since: {}, | ||
until: '4.0.0', | ||
} | ||
); | ||
|
||
this.modernized = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is asserted that passing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call. I added an |
||
} else { | ||
superOnUnsupportedArgument.call(this, name); | ||
} | ||
}, | ||
}); | ||
} | ||
|
||
// @bubbles & @preventDefault | ||
{ | ||
let superIsSupportedArgument = prototype['isSupportedArgument']; | ||
|
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.
Two concerns:
With this implemented as an assert, what does that mean for production? Would a
@tagName
be applied in production, even if it the assert stopped you in development? Seems bad if so. Maybe it should be athrow
.But, further, IMO we don't need a check at all. I don't think we're planning to add asserts for every old component argument which was removed in 4.0. They were removed, which means passing one of those arguments (like
@tagName
) could just mean it is ignored. I can ask around on this second point, but the first concern about production behavior not applying the tag name needs to be confirmed.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.
Yup, makes sense re:
assert
. As to the second point, classic components will keeptagName
, so it seems like something special will need to be done forlinkTo
.