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

Generated tags include superfluous metadata #623

Closed
karol-majewski opened this issue Apr 12, 2018 · 1 comment
Closed

Generated tags include superfluous metadata #623

karol-majewski opened this issue Apr 12, 2018 · 1 comment

Comments

@karol-majewski
Copy link
Contributor

  • emotion version: 9.0.2
  • react version: 16.3.1

Relevant code:

function makeStyleTag(opts: Options): HTMLStyleElement {
let tag = document.createElement('style')
tag.type = 'text/css'
tag.setAttribute('data-emotion', opts.key || '')
if (opts.nonce !== undefined) {
tag.setAttribute('nonce', opts.nonce)
}
tag.appendChild(document.createTextNode(''))
// $FlowFixMe
;(opts.container !== undefined ? opts.container : document.head).appendChild(
tag
)
return tag
}

What you did:

  1. Used react-emotion in my application.
  2. Validated the serialized DOM with Nu HTML Checker

What happened:

It returned dozens of warning concerning the type attribute that is no longer necessary in HTML5.

Warning: The type attribute for the style element is not needed and should be omitted.
;}</style><style type="text/css" data-emotion="">.css-v

image

Reproduction:

Not sure if it's needed (the code doing it is right there), but if you'd like to see it in the wild, go to https://validator.w3.org/nu/ and check https://zefenify.com/about.html mentioned in the README.

Problem description:

As W3 docs say:

In HTML5, the type attribute is no longer required for CSS. The default value is "text/css".

Suggested solution:

Delete the line 46.

tag.type = 'text/css'

@emmatown
Copy link
Member

Thanks for the issue!! If you submit a PR removing that line and updating any necessary snapshots, I'd be happy to merge it.

karol-majewski added a commit to karol-majewski/emotion that referenced this issue Apr 13, 2018
This attribute is no longer required in HTML5.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants