rounDOM INT32 MAX

    @@ -18,8 +18,8 @@ // [^1] DOM w/ IEEE_754 details c.f. // http://let.hatelabo.jp/noromanba/let/hLHUs7CEkec6 - // Firefox Desktop ignoring >Signed INT32 - // so you can't use `Number.MAX_SAFE_INTEGER` + // ignoring >Signed INT32 at some values/scene + // so you can't use `Number.MAX_SAFE_INTEGER`, use below instead let rounder = sandbox.contentWindow.document.body; // needs get after set rounder.style.zIndex = Number.MAX_SAFE_INTEGER; @@ -49,7 +49,7 @@ // https://en.wikipedia.org/wiki/Floor_and_ceiling_functions // TODO CSS3 spec; https://www.w3.org/Style/CSS/ // https://www.w3.org/TR/CSS2/visuren.html#propdef-z-index -// same as `window.scroll*()`, X-Browsers reports +// same as `window.scroll*()` X-Browsers reports, Firefox Desktop most strict handling // http://let.hatelabo.jp/noromanba/let/hLHVmL_RgoIK // https://www.w3.org/TR/cssom-view/#webidl-values
  • /*
     * @title rounDOM 2147483647
     * @description get Signed INT32 max value w/ DOM API
     * @include http://*
     * @include https://*
     * @contributor noromanba   http://let.hatelabo.jp/noromanba/let/hLHUs7CEkec6
     * @contributor noromanba   http://let.hatelabo.jp/noromanba/let/hLHVmL_ErMVx
     * @contributor noromanba   http://let.hatelabo.jp/noromanba/let/hLHVmL_RgoIK
     * @license     MIT License https://opensource.org/licenses/MIT
     * @javascript_url
     */
    
    (() => {
        'use strict';
    
        const wall = document.head || document.body || document.documentElement;
        const sandbox = wall.appendChild(document.createElement('iframe'));
    
        // [^1] DOM w/ IEEE_754 details c.f.
        //       http://let.hatelabo.jp/noromanba/let/hLHUs7CEkec6
        //      ignoring >Signed INT32 at some values/scene
        //      so you can't use `Number.MAX_SAFE_INTEGER`, use below instead
        let rounder = sandbox.contentWindow.document.body;
        // needs get after set
        rounder.style.zIndex = Number.MAX_SAFE_INTEGER;
        const MAX_SAFE_SIGNED_INT32 = Number(rounder.style.zIndex);
    
        if (!console || !console.assert) {
            window.prompt('Signed +INT32: 2147483647?', MAX_SAFE_SIGNED_INT32);
            return;
        }
        console.assert([
            0x7FFFFFFF,
            -1 >>> 1,
            2 ** (32 - 1) - 1,
            MAX_SAFE_SIGNED_INT32,
        ].every(v => v === 2147483647));
    })();
    
    // DEV
    //
    // [1]:
    // Signed INT32
    //  https://en.wikipedia.org/wiki/IEEE_754
    //  https://en.wikipedia.org/wiki/Single-precision_floating-point_format
    // specs
    //  https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
    //   https://developer.mozilla.org/en-US/docs/Web/CSS/integer#Interpolation
    //    https://en.wikipedia.org/wiki/Floor_and_ceiling_functions
    //  TODO CSS3 spec; https://www.w3.org/Style/CSS/
    //  https://www.w3.org/TR/CSS2/visuren.html#propdef-z-index
    // same as `window.scroll*()` X-Browsers reports, Firefox Desktop most strict handling
    //  http://let.hatelabo.jp/noromanba/let/hLHVmL_RgoIK
    //   https://www.w3.org/TR/cssom-view/#webidl-values
    
    
  • Permalink
    このページへの個別リンクです。
    RAW
    書かれたコードへの直接のリンクです。
    Packed
    文字列が圧縮された書かれたコードへのリンクです。
    Userscript
    Greasemonkey 等で利用する場合の .user.js へのリンクです。
    Loader
    @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
    Metadata
    コード中にコメントで @xxx と書かれたメタデータの JSON です。

History

  1. 2018/08/02 07:37:12 - 2018-08-02
  2. 2018/07/25 06:12:49 - 2018-07-25
  3. 2018/07/25 06:08:47 - 2018-07-25
  4. 2018/07/23 08:28:27 - 2018-07-23
  5. 2018/07/23 08:19:35 - 2018-07-23
  6. 2018/07/23 08:15:50 - 2018-07-23
  7. 2018/07/23 08:15:31 - 2018-07-23