JSFiddle - React, Tailwind, and code Playground

by Timmy Willison

HTML

<html>
    <head>
    </head>
    <body>
        <H1>Testing iframe selector (Works in IE8, not IE7): a[style^='mso-comment-reference: MO_1</H1>
        <hr/><br/>

        <div id="iframe-wrapper"></div>            

        <br/><hr/>
        
        <label><input type="checkbox" id="ToggleFade" checked/> Toggle MO_1</label>
    </body>
</html>

CSS

.MsoNormal
{
    display:block !important;
}

.MsoCommentReference
{
    display:block !important;
}

JavaScript

var iframe = document.createElement("iframe");
iframe.id = "submit_frame";
document.getElementById("iframe-wrapper").appendChild( iframe );
var iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
iframeDoc.write("<!doctype html><html><body><a style='mso-comment-reference: MO_1'>Linky</a></body></html>");
iframeDoc.close();

console.log( $('#submit_frame').contents()
             .find('a[style^="mso-comment-reference: MO_1"]').length === 1 );

console.log( "lowercase: ", $('#submit_frame').contents()
             .find('a[style^="mso-comment-reference: mo_1"]').length === 1 );