Skip to content

Commit

Permalink
Fix Automattic#482: "Error when encoded quotes are used in html attri…
Browse files Browse the repository at this point in the history
…bute"
  • Loading branch information
dminkovsky committed Feb 4, 2025
1 parent 2b2d786 commit 0629d8a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/inline.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

var { decode } = require('entities');

var utils = require('./utils');
var numbers = require('./numbers');
var variables = require('./variables');
Expand Down Expand Up @@ -149,7 +151,11 @@ function inlineDocument($, css, options) {

// if the element has inline styles, fake selector with topmost specificity
if ($(el).attr(styleAttributeName)) {
var cssText = '* { ' + $(el).attr(styleAttributeName) + ' } ';
var styleAttributeValue = $(el).attr(styleAttributeName);
var cssStyleAttributeValue = options.decodeStyleAttributes
? decode(styleAttributeValue)
: styleAttributeValue;
var cssText = '* { ' + cssStyleAttributeValue + ' } ';
addProps(utils.parseCSS(cssText)[0][1], new utils.Selector('<style>', true));
}

Expand Down

0 comments on commit 0629d8a

Please sign in to comment.