Oh, okay. You can write new CSS that resets abusive pseudo-elements :before / :after :
function resetPsuedo(el) { if (!el.id) el.id = makeId(); var selector = "#" + el.id; var head = document.getElementsByTagName('head')[0], style = document.createElement('style'), rules = document.createTextNode(selector + ":before, " + selector + ":after { content: '' }"); style.type = 'text/css'; if(style.styleSheet) style.styleSheet.cssText = rules.nodeValue; else style.appendChild(rules); head.appendChild(style); } function makeId() { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; for (var i=0; i < 15; i++) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; }
Assigning a random identifier to the element you are passing into (if there is none) allows you to crack inline styles, instead of accessing el.beforeStyle , you can use the CSS selector: el#rkhjr828t9g:before .
You may need to add more rules for full reset styles. jsFiddle: see me!
http://www.w3.org/TR/CSS21/generate.html#before-after-content
The: before and: after elements pseudo-elements interact with other fields as if they were real elements inserted only inside their associated element.
For example, the following document fragment and style sheet:
<p> Text </p> p:before { display: block; content: 'Some'; }
... will be displayed in exactly the same way as the following document fragment and stylesheet:
<p><span>Some</span> Text </p> span { display: block }
Similarly, the following document fragment and stylesheet:
<h2> Header </h2> h2:after { display: block; content: 'Thing'; }
... will be displayed in exactly the same way as the following document fragment and stylesheet:
<h2> Header <span>Thing</span></h2> h2 { display: block; } span { display: block; }
benesch
source share