Skip to content

Data URL as data:image/svg+xml is unable to be rendered after updating to 6.0.0 #1342

@jesse-iluminai

Description

@jesse-iluminai

After updating to 6.0.0 from 5.2.6 the default Bootstrap drop down arrow defined as an inline data:image/svg+xml URL no longer displays on screen.

  • Operating System: MacOS 11.3.1
  • Node Version: v14.16.1
  • NPM Version: 6.14.12
  • webpack Version: 5.44.0
  • css-loader Version: 6.0.0

Confirmed in Firefox 89.0.2 and Chrome 91.0.4472.114

Expected Behavior

We should be able to see the drop down arrow as given in the image below:

Screen Shot 2021-07-15 at 4 15 17 PM

URL is modified in such a way that it is not able to render

This is an out of the box/untouched Bootstrap 5.0.2 rule as seen below as an image and the copied rule from bootstrap.css

Screen Shot 2021-07-15 at 4 15 48 PM

background-color: #fff;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
background-repeat: no-repeat;
background-position: right 0.75rem center;
background-size: 16px 12px;

Actual Behavior

After updating to 6.0.0 the arrow no longer renders as seen in the image below.

Screen Shot 2021-07-15 at 4 23 59 PM

When using devtools in Firefox to examine the styles for the dropdown, it appears that some encoding has been applied to the data URL, making it unrenderable.

Screen Shot 2021-07-15 at 4 24 09 PM

background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3E%3Cpath%20fill='none'%20stroke='#343a40'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='2'%20d='M2%205l6%206%206-6'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 0.75rem center;
background-size: 16px 12px;

Code

Note: Bootstrap 5.0.2 is set up as a vendor module outside of package.json and therefore not included below.

{
  "repository": {},
  "description": " ",
  "license": "MIT",
  "scripts": {
    "webpack-dev-server": "webpack serve --mode development --progress"
  },
  "dependencies": {
    "alpinejs": "3.2.2",
    "phoenix": "file:deps/phoenix",
    "phoenix_html": "file:deps/phoenix_html",
    "phoenix_live_view": "file:deps/phoenix_live_view",
    "webpack-manifest-plugin": "3.1.1"
  },
  "devDependencies": {
    "@babel/core": "7.14.6",
    "@babel/preset-env": "7.14.7",
    "@babel/plugin-transform-runtime": "7.14.5",
    "babel-loader": "8.2.2",
    "copy-webpack-plugin": "9.0.1",
    "clean-webpack-plugin": "4.0.0-alpha.0",
    "css-loader": "6.0.0",
    "mini-css-extract-plugin": "2.1.0",
    "sass": "1.35.2",
    "sass-loader": "12.1.0",
    "webpack": "5.44.0",
    "webpack-cli": "4.7.2",
    "webpack-dev-server": "3.11.2"
  }
}
    module: {
      rules: [
        {
          test: /\.js$/,
          exclude: /node_modules/,
          use: {
            loader: 'babel-loader'
          }
        },
        {
          test: /\.(jpg|png|gif)$/,
          type: 'asset/resource',
          generator: {
            filename: 'images/[hash][ext][query]'
          }
        },
        {
          test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
          type: 'asset/resource',
          generator: {
            filename: 'fonts/[hash][ext][query]'
          }
        },
        {
          test: /\.[s]?css$/,
          use: [
            MiniCssExtractPlugin.loader,
            {
              loader: 'css-loader',
              options: {
                sourceMap: true,
                importLoaders: 2
              }
            },
            { 
              loader: "sass-loader", 
              options: { 
                sourceMap: true 
              }
            },
          ],
        }
      ]
    },
    plugins: [
      new CleanWebpackPlugin(),
      new MiniCssExtractPlugin({ 
        filename: isProductionMode ? "[name].[contenthash].css" : "css/[name].css"
      }),
      new CopyWebpackPlugin({ 
        patterns: [
          { from: 'assets/static/', to: '' }
        ]
      }),
      new WebpackManifestPlugin(),
      new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en/),
    ].concat(isProductionMode ? [] : [

    ]),
    optimization: {
      minimizer: [
        
      ]
    } 

How Do We Reproduce?

5.2.6 -> dropdown is visible
6.0.0 -> dropdown is not visible

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions