tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nan.mjs (1065B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
      4 
      5 import { span } from "resource://devtools/client/shared/vendor/react-dom-factories.mjs";
      6 import PropTypes from "resource://devtools/client/shared/vendor/react-prop-types.mjs";
      7 
      8 import { getGripType, wrapRender } from "./rep-utils.mjs";
      9 
     10 /**
     11 * Renders a NaN object
     12 */
     13 
     14 NaNRep.PropTypes = {
     15  shouldRenderTooltip: PropTypes.bool,
     16 };
     17 
     18 function NaNRep(props) {
     19  const shouldRenderTooltip = props.shouldRenderTooltip;
     20 
     21  const config = getElementConfig(shouldRenderTooltip);
     22 
     23  return span(config, "NaN");
     24 }
     25 
     26 function getElementConfig(shouldRenderTooltip) {
     27  return {
     28    className: "objectBox objectBox-nan",
     29    title: shouldRenderTooltip ? "NaN" : null,
     30  };
     31 }
     32 
     33 function supportsObject(object, noGrip = false) {
     34  return getGripType(object, noGrip) == "NaN";
     35 }
     36 
     37 const rep = wrapRender(NaNRep);
     38 
     39 // Exports from this module
     40 export { rep, supportsObject };