__defineGetter__()じゃなくて、defineProperty()にしようかな

あ、なんか、__defineGetter__()はMDNを見るとすでに非推奨ぽいな。
なので、Object.definePropertyを使おうかな・・・
そんでもって、前回のフルスクリーンのやつを書き換えておく。
if(!document.fullscreenElement)
  document.__defineGetter__("fullscreenElement", function(){
    return(
      document.msFullscreenElement ||
      document.webkitFullscreenElement ||
      document.mozFullScreenElement || null);
  });
これを書き換えて、
if(!document.fullscreenElement)
  Object.defineProperty(document,"fullscreenElement",{
    get : function(){
      return(
        document.msFullscreenElement ||
        document.webkitFullscreenElement ||
        document.mozFullScreenElement || null);
    }
  });
こんな感じになりましたとさ、めでたしめでたし。


修正:2016/02/09 [ソース中] FullscreenElement → fullscreenElement
追記:ベンダープレフィックスなしで、フルスクリーン表示

ふんどしの持ち主

コメント

このブログの人気の投稿

Pythonのソースファイルの行番号を取得したい

Raspberry Pi 3 シリアルコンソール&シリアル通信

学習リモコン「リモコソ (RIMOKOSO1)」の設定