As long as the <style>
block contains something uniquely identifiable, then it's relatively straightforward to remove. Using jQuery to loop through all the <style>
blocks in the page, you can then check their content for the offending selector and remove the entire block:
$('style').each(function(index, elem) {
let styleBlock = $(this);
let content = styleBlock.text();
if (content.indexOf('.widget-form') > -1) {
// Found an inline style block - let's kill it!
styleBlock.remove();
}
});
You can also do this in a very similar way with plain JS:
var styles = document.querySelectorAll('style');
Array.prototype.forEach.call(styles, function(el, i) {
let content = el.textContent;
if (content.indexOf('.widget-form') > -1) {
// Found an inline style block - let's kill it!
el.remove();
// Or el.parentNode.removeChild(el); for maximum backwards compatibility
}
});