Link.js (hoppscotch-2.0.0) | : | Link.js (hoppscotch-2.1.0) | ||
---|---|---|---|---|
skipping to change at line 30 | skipping to change at line 30 | |||
}, | }, | |||
// It's a convention to rename `createElement` to `h` | // It's a convention to rename `createElement` to `h` | |||
render(h, context) { | render(h, context) { | |||
const tag = getLinkTag(context.props) | const tag = getLinkTag(context.props) | |||
// Map our attributes correctly | // Map our attributes correctly | |||
const attrs = {} | const attrs = {} | |||
let on = {} | let on = {} | |||
switch (tag) { | switch (tag) { | |||
case ANCHOR_TAG: | case ANCHOR_TAG: | |||
attrs["aria-label"] = "Link" | ||||
// Map `to` prop to the correct attribute | // Map `to` prop to the correct attribute | |||
attrs.href = context.props.to | attrs.href = context.props.to | |||
// Handle `blank` prop | // Handle `blank` prop | |||
if (context.props.blank) { | if (context.props.blank) { | |||
attrs.target = "_blank" | attrs.target = "_blank" | |||
attrs.rel = "noopener" | attrs.rel = "noopener" | |||
} | } | |||
// Transform native events to regular events for HTML anchor tag | // Transform native events to regular events for HTML anchor tag | |||
skipping to change at line 56 | skipping to change at line 58 | |||
attrs.to = context.props.to | attrs.to = context.props.to | |||
// Handle `exact` prop | // Handle `exact` prop | |||
if (context.props.exact) { | if (context.props.exact) { | |||
attrs.exact = true | attrs.exact = true | |||
} | } | |||
break | break | |||
default: | default: | |||
attrs["aria-label"] = "Button" | ||||
break | break | |||
} | } | |||
// Merge our new data with existing ones | // Merge our new data with existing ones | |||
const data = mergeData(context.data, { attrs, on }) | const data = mergeData(context.data, { attrs, on }) | |||
// Return a new virtual node | // Return a new virtual node | |||
return h(tag, data, context.children) | return h(tag, data, context.children) | |||
}, | }, | |||
} | } | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 3 lines changed or added |