source: trip-planner-front/node_modules/@angular/material/schematics/ng-update/migrations/hammer-gestures-v9/remove-element-from-html.mjs

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.4 KB
Line 
1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.removeElementFromHtml = void 0;
11/**
12 * Removes the specified element. Additionally, preceding whitespace will be removed
13 * to not leave empty lines in the resulting HTML.
14 */
15function removeElementFromHtml(element, recorder) {
16 // sourceCodeLocation is always set since we parse with location info enabled.
17 const { startOffset, endOffset } = element.sourceCodeLocation;
18 const parentIndex = element.parentNode.childNodes.indexOf(element);
19 const precedingTextSibling = element.parentNode.childNodes.find((f, i) => f.nodeName === '#text' && i === parentIndex - 1);
20 recorder.remove(startOffset, endOffset - startOffset);
21 // If we found a preceding text node which just consists of whitespace, remove it.
22 if (precedingTextSibling && /^\s+$/.test(precedingTextSibling.value)) {
23 const textSiblingLocation = precedingTextSibling.sourceCodeLocation;
24 recorder.remove(textSiblingLocation.startOffset, textSiblingLocation.endOffset - textSiblingLocation.startOffset);
25 }
26}
27exports.removeElementFromHtml = removeElementFromHtml;
28//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVtb3ZlLWVsZW1lbnQtZnJvbS1odG1sLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL3NjaGVtYXRpY3MvbmctdXBkYXRlL21pZ3JhdGlvbnMvaGFtbWVyLWdlc3R1cmVzLXY5L3JlbW92ZS1lbGVtZW50LWZyb20taHRtbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7OztHQU1HOzs7QUFLSDs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