Skip to content
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

Booleanish behaviour of attributes like crossorigin not supported #447

Open
farnabaz opened this issue Sep 3, 2019 · 5 comments
Open

Booleanish behaviour of attributes like crossorigin not supported #447

farnabaz opened this issue Sep 3, 2019 · 5 comments

Comments

@farnabaz
Copy link
Member

farnabaz commented Sep 3, 2019

Version

v2.9.2

Reproduction link

https://codesandbox.io/s/codesandbox-nuxt-hm0ch

Steps to reproduce

When creating a new link with crossorigin value, and setting its value to true, attribute renders with value.
View page source and search for crossorigin

What is expected ?

Boolean attributes should not have value

<link crossorigin>

What is actually happening?

Boolean attributes renders with value

<link crossorigin="true">
This bug report is available on Nuxt community (#c9719)
@pimlie pimlie transferred this issue from nuxt/nuxt Sep 4, 2019
@pimlie
Copy link
Collaborator

pimlie commented Sep 4, 2019

Thanks for the report. Have moved this to the vue-meta repo because its a vue-meta issue.

Vue-meta maintains a list of attributes which are boolean attributes. Seems that crossorigin is not listed because its not really a boolean attribute like the others, its just that if you omit an explicit value it fallsback to a default one.

Dont think we can add crossorigin just to the list, because that list is for explicit boolean attributes only. Maybe we need a second list of booleanish attributes.

@pimlie pimlie changed the title Boolean attributes in head links Booleanish behaviour of attributes like crossorigin not supported Sep 4, 2019
@stale stale bot added the stale label Sep 26, 2019
@stale stale bot closed this as completed Oct 3, 2019
@pimlie pimlie added pending and removed stale labels Oct 28, 2019
@pimlie pimlie reopened this Oct 28, 2019
@nuxt nuxt deleted a comment from stale bot Oct 28, 2019
@abronin
Copy link

abronin commented Jul 19, 2020

You can always use empty string as a value for an attribute you want to be rendered as a booleanish. This link {rel: 'preconnect', crossorigin: ''} will be rendered as {<link ref="preconnect" crossorigin>}.

It may be more a hack than a feature till it is not mentioned in the documentation. Should I fix this by editing documentation? What do you think?

@luksak
Copy link

luksak commented Jul 21, 2020

This link {rel: 'preconnect', crossorigin: ''} will be rendered as <link ref="preconnect" crossorigin>}

That is not correct. This is being output:

<link rel="preconnect" crossorigin="">

Sadly that hasn't the desired effect.

@pimlie
Copy link
Collaborator

pimlie commented Jul 26, 2020

@luksak Unless this MDN page is incorrect, using crossorigin="" is the same as crossorigin or crossorigin="anonymous". So what exactly do you mean it doesnt has the desired effect?

@luksak
Copy link

luksak commented Jul 28, 2020

@pimlie Ah ok. Thanks for clarifying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants