1 |
- {"ast":null,"code":"'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\nexports.default = exports.serialize = exports.test = void 0;\n\nvar _markup = require('./lib/markup');\n/**\n * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\nconst ELEMENT_NODE = 1;\nconst TEXT_NODE = 3;\nconst COMMENT_NODE = 8;\nconst FRAGMENT_NODE = 11;\nconst ELEMENT_REGEXP = /^((HTML|SVG)\\w*)?Element$/;\n\nconst testNode = val => {\n var _val$hasAttribute;\n\n const constructorName = val.constructor.name;\n const {\n nodeType,\n tagName\n } = val;\n const isCustomElement = typeof tagName === 'string' && tagName.includes('-') || ((_val$hasAttribute = val.hasAttribute) === null || _val$hasAttribute === void 0 ? void 0 : _val$hasAttribute.call(val, 'is'));\n return nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement) || nodeType === TEXT_NODE && constructorName === 'Text' || nodeType === COMMENT_NODE && constructorName === 'Comment' || nodeType === FRAGMENT_NODE && constructorName === 'DocumentFragment';\n};\n\nconst test = val => {\n var _val$constructor;\n\n return (val === null || val === void 0 ? void 0 : (_val$constructor = val.constructor) === null || _val$constructor === void 0 ? void 0 : _val$constructor.name) && testNode(val);\n};\n\nexports.test = test;\n\nfunction nodeIsText(node) {\n return node.nodeType === TEXT_NODE;\n}\n\nfunction nodeIsComment(node) {\n return node.nodeType === COMMENT_NODE;\n}\n\nfunction nodeIsFragment(node) {\n return node.nodeType === FRAGMENT_NODE;\n}\n\nconst serialize = (node, config, indentation, depth, refs, printer) => {\n if (nodeIsText(node)) {\n return (0, _markup.printText)(node.data, config);\n }\n\n if (nodeIsComment(node)) {\n return (0, _markup.printComment)(node.data, config);\n }\n\n const type = nodeIsFragment(node) ? `DocumentFragment` : node.tagName.toLowerCase();\n\n if (++depth > config.maxDepth) {\n return (0, _markup.printElementAsLeaf)(type, config);\n }\n\n return (0, _markup.printElement)(type, (0, _markup.printProps)(nodeIsFragment(node) ? [] : Array.from(node.attributes).map(attr => attr.name).sort(), nodeIsFragment(node) ? {} : Array.from(node.attributes).reduce((props, attribute) => {\n props[attribute.name] = attribute.value;\n return props;\n }, {}), config, indentation + config.indent, depth, refs, printer), (0, _markup.printChildren)(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation);\n};\n\nexports.serialize = serialize;\nconst plugin = {\n serialize,\n test\n};\nvar _default = plugin;\nexports.default = _default;","map":{"version":3,"sources":["/Users/jane/Documents/Курс Front-end/HW8/myproject/node_modules/pretty-format/build/plugins/DOMElement.js"],"names":["Object","defineProperty","exports","value","default","serialize","test","_markup","require","ELEMENT_NODE","TEXT_NODE","COMMENT_NODE","FRAGMENT_NODE","ELEMENT_REGEXP","testNode","val","_val$hasAttribute","constructorName","constructor","name","nodeType","tagName","isCustomElement","includes","hasAttribute","call","_val$constructor","nodeIsText","node","nodeIsComment","nodeIsFragment","config","indentation","depth","refs","printer","printText","data","printComment","type","toLowerCase","maxDepth","printElementAsLeaf","printElement","printProps","Array","from","attributes","map","attr","sort","reduce","props","attribute","indent","printChildren","prototype","slice","childNodes","children","plugin","_default"],"mappings":"AAAA;;AAEAA,MAAM,CAACC,cAAP,CAAsBC,OAAtB,EAA+B,YAA/B,EAA6C;AAC3CC,EAAAA,KAAK,EAAE;AADoC,CAA7C;AAGAD,OAAO,CAACE,OAAR,GAAkBF,OAAO,CAACG,SAAR,GAAoBH,OAAO,CAACI,IAAR,GAAe,KAAK,CAA1D;;AAEA,IAAIC,OAAO,GAAGC,OAAO,CAAC,cAAD,CAArB;AAEA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMC,YAAY,GAAG,CAArB;AACA,MAAMC,SAAS,GAAG,CAAlB;AACA,MAAMC,YAAY,GAAG,CAArB;AACA,MAAMC,aAAa,GAAG,EAAtB;AACA,MAAMC,cAAc,GAAG,2BAAvB;;AAEA,MAAM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AAQC,SAAR,KAAsB;AACvDD,IAAAA,KAAK,CAACC,SAAS,CAAClC,IAAX,CAAL,GAAwBkC,SAAS,CAAClD,KAAlC;AACA,WAAOiD,KAAP;AACD,GAHD,EAGG,EAHH,CARN,EAYErB,MAZF,EAaEC,WAAW,GAAGD,MAAM,CAACuB,MAbvB,EAcErB,KAdF,EAeEC,IAfF,EAgBEC,OAhBF,CAFK,EAoBL,CAAC,GAAG5B,OAAO,CAACgD,aAAZ,EACEV,KAAK,CAACW,SAAN,CAAgBC,KAAhB,CAAsBhC,IAAtB,CAA2BG,IAAI,CAAC8B,UAAL,IAAmB9B,IAAI,CAAC+B,QAAnD,CADF,EAEE5B,MAFF,EAGEC,WAAW,GAAGD,MAAM,CAACuB,MAHvB,EAIErB,KAJF,EAKEC,IALF,EAMEC,OANF,CApBK,EA4BLJ,MA5BK,EA6BLC,WA7BK,CAAP;AA+BD,CAhDD;;AAkDA9B,OAAO,CAACG,SAAR,GAAoBA,SAApB;AACA,MAAMuD,MAAM,GAAG;AACbvD,EAAAA,SADa;AAEbC,EAAAA;AAFa,CAAf;AAIA,IAAIuD,QAAQ,GAAGD,MAAf;AACA1D,OAAO,CAACE,OAAR,GAAkByD,QAAlB","sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\nexports.default = exports.serialize = exports.test = void 0;\n\nvar _markup = require('./lib/markup');\n\n/**\n * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nconst ELEMENT_NODE = 1;\nconst TEXT_NODE = 3;\nconst COMMENT_NODE = 8;\nconst FRAGMENT_NODE = 11;\nconst ELEMENT_REGEXP = /^((HTML|SVG)\\w*)?Element$/;\n\nconst testNode = val => {\n var _val$hasAttribute;\n\n const constructorName = val.constructor.name;\n const {nodeType, tagName} = val;\n const isCustomElement =\n (typeof tagName === 'string' && tagName.includes('-')) ||\n ((_val$hasAttribute = val.hasAttribute) === null ||\n _val$hasAttribute === void 0\n ? void 0\n : _val$hasAttribute.call(val, 'is'));\n return (\n (nodeType === ELEMENT_NODE &&\n (ELEMENT_REGEXP.test(constructorName) || isCustomElement)) ||\n (nodeType === TEXT_NODE && constructorName === 'Text') ||\n (nodeType === COMMENT_NODE && constructorName === 'Comment') ||\n (nodeType === FRAGMENT_NODE && constructorName === 'DocumentFragment')\n );\n};\n\nconst test = val => {\n var _val$constructor;\n\n return (\n (val === null || val === void 0\n ? void 0\n : (_val$constructor = val.constructor) === null ||\n _val$constructor === void 0\n ? void 0\n : _val$constructor.name) && testNode(val)\n );\n};\n\nexports.test = test;\n\nfunction nodeIsText(node) {\n return node.nodeType === TEXT_NODE;\n}\n\nfunction nodeIsComment(node) {\n return node.nodeType === COMMENT_NODE;\n}\n\nfunction nodeIsFragment(node) {\n return node.nodeType === FRAGMENT_NODE;\n}\n\nconst serialize = (node, config, indentation, depth, refs, printer) => {\n if (nodeIsText(node)) {\n return (0, _markup.printText)(node.data, config);\n }\n\n if (nodeIsComment(node)) {\n return (0, _markup.printComment)(node.data, config);\n }\n\n const type = nodeIsFragment(node)\n ? `DocumentFragment`\n : node.tagName.toLowerCase();\n\n if (++depth > config.maxDepth) {\n return (0, _markup.printElementAsLeaf)(type, config);\n }\n\n return (0, _markup.printElement)(\n type,\n (0, _markup.printProps)(\n nodeIsFragment(node)\n ? []\n : Array.from(node.attributes)\n .map(attr => attr.name)\n .sort(),\n nodeIsFragment(node)\n ? {}\n : Array.from(node.attributes).reduce((props, attribute) => {\n props[attribute.name] = attribute.value;\n return props;\n }, {}),\n config,\n indentation + config.indent,\n depth,\n refs,\n printer\n ),\n (0, _markup.printChildren)(\n Array.prototype.slice.call(node.childNodes || node.children),\n config,\n indentation + config.indent,\n depth,\n refs,\n printer\n ),\n config,\n indentation\n );\n};\n\nexports.serialize = serialize;\nconst plugin = {\n serialize,\n test\n};\nvar _default = plugin;\nexports.default = _default;\n"]},"metadata":{},"sourceType":"script"}
|