Need help with: jquery preend doctype to html

Here is my situation:

  • I am editing an application CSS stylesheet.
  • I can ONLY edit the CSS stylesheet (if I cannot creatively peek into another file using CSS or maybe add a small jQuery presale operator in an existing .js)
  • Application ONLY ie6, ie7 and ie8. They never use FireFox, and this is not an option.

Search for help with

1) I think I need to use jQuery for "prepend / prependTo" "doctype" on

html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"

Without! doctype it throws ie8 into quirksmode and, of course, does not accept any styles such as "input [type = checkbox]"

I have not used preend before. Can you help me with the full and correct syntax on how to do the following:

CURRENT: <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

DESIRED: <doctype html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

It hasn't worked for me yet $("html ").prepend("doctype ")

+3
1

<doctype html>. :

<!DOCTYPE html>
<html (xmlns or any other attributes you want)>

<!DOCTYPE . <! , . " doctype", .

, DOM- / DocumentType node, doctype, Quirks Standards, , . .

, :

<!-- no doctype, loads in Quirks Mode (BackCompat) -->
<html>
    <!-- rest of the document, then at the end: -->

    <script>
        alert('now in compatMode '+document.compatMode);
        if (document.compatMode==='BackCompat') {
            setTimeout(function() {
                var markup= document.documentElement.innerHTML;
                markup= '<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">'+markup+'</html>';
                document.open();
                document.write(markup);
                document.close();
            }, 0);
        }
    </script>
</html>

. , reset .

, doctype HTML. , ISAPI ( , - IIS), doctype HTML?

+23

All Articles