Featured post
Need help with: jquery prepend doctype to html -
here's situation:
- i editing application's css style sheet.
- i can edit css style sheet (unless can creatively glom onto file using css, or possibly add small jquery prepend statement in existing .js)
- application ie6, ie7 , ie8 compliant. never use firefox, , it's not option.
looking with:
1) think need use jquery "prepend/prependto" "doctype " on to
html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"
without !doctype throws ie8 quirksmode , of course doesn't accept styles such "input[type=checkbox]"
i have not used prepend before. can me full , correct syntax on how make 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">
this has not worked me yet $("html ").prepend("doctype ")
it's not <doctype html>
. it's:
<!doctype html> <html (xmlns or other attributes want)>
<!doctype
not element. has <!
@ start, invalid element. the “doctype declaration”, , cannot usefully altered after initial parsing.
even on browsers dom interfaces let move/replace documenttype
node representing doctype declaration, not have effect of changing between quirks , standards mode, decided only @ initial load time. cannot mutate document between modes.
you can load new document existing document changed mode:
<!-- no doctype, loads in quirks mode (backcompat) --> <html> <!-- rest of document, @ 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>
but advise against it. it's ugly, reset state , redraw @ end of load time, , has sorts of negative implications scripting.
if want standards mode, need adding doctype html itself. if absolutely can't touch application, how using isapi filter (assuming web server iis) add doctype html output?
- Get link
- X
- Other Apps
Comments
Post a Comment