Skip to content

remove type="text/css" from inline css load #366

@ovidijusr

Description

@ovidijusr

What is the current behavior?
when i use style-loader in webpack for inline loading I get inline style which looks like this:

<style type="text/css">
.css-code{}
</style>

What is the expected behavior?
ability to remove type attribute from style tag

<style>
.css-code{}
</style>

If this is a feature request, what is motivation or use case for changing the behavior?
I'm currently getting warnings from w3c about using this optional tag:

Warning: The type attribute for the style element is not needed and should be omitted.
From line 357, column 9; to line 357, column 31
↩</style><style type="text/css">/* sty

Tried to investigate why this type exist in first place but haven't found anything even compatibility related why.

Also tried to use attrs option for loader, but it doesn't seem to remove type attribute, and even if I try to disable it by using boolen it doesn't remove the attribute but makes it empty

attrs: {
  type: false,
},

Tried to remove it by giving empty string to attrs option but then it just returns empty attribute

<style type>
.css-code{}
</style>

Maybe i'm missing something? What is the reason it is being defined? Thank you for answers :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions