LoginSignup
28
27

More than 5 years have passed since last update.

IE11では、jsのテンプレートリテラル(バッククォートで挟むやつ)が効かない。ので別対応。

Posted at

IEよ、てめぇだけは許さねぇ。と思う出来事は日々あるものの。
今回はかなりショックだったので、メモ。
テンプレートリテラルが効かないってどゆこと。
ふつうに難しいことはしてないっす。ES6の結構ファンディメンタルな文法だとおもってつかってたら、IE11未対応って。。。。(←思い込んでた私がわるいんです。はい。)

これを


html = `<div>hoge
            <div>huge  
                <div>hage
                </div>
            </div>
        </div>`;

こんな風にかけてか!!!!


html = "<div>hoge<div>huge<div>hage</div></div></div>";
html = "<div>hoge"+ 
            "<div>huge"+
                "<div>hage"+
                "</div>"+
            "</div>"+
        "</div>";

と憤慨したが。qiitaにメシアあり。
https://qiita.com/_shimizu/items/837b529de9f3302e315c


var heredoc = (function () {/*
    <div>hoge
        <div>huge
            <div>hage
            </div>
        </div>
    </div>;
*/}).toString().match(/(?:\/\*(?:[\s\S]*?)\*\/)/).pop().replace(/^\/\*/, "").replace(/\*\/$/, "");

キョンキョンよろしく。あなたに会えてよかった。

ブラウザ作るの大変だとはうかがっているんですが。それでも。。。なんとかなりませんかねIE.

28
27
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
27