Skip to content
Snippets Groups Projects
Commit 67bbdee5 authored by Igor Markin's avatar Igor Markin
Browse files

Add build

parent 5cef614c
No related branches found
No related tags found
1 merge request!5Rework with parse 5
......@@ -102,7 +102,8 @@ const printHtmlNode = (node, printFunction, depth) => {
if (node.firstChild) {
result += ">";
result += "\n";
result += exports.printHtmlChildren(node, printFunction, depth + 1);
const printout = exports.printHtmlChildren(node, printFunction, depth + 1);
result += printout;
result += "</" + node.nodeName + ">";
}
else {
......@@ -115,7 +116,7 @@ const printHtmlNode = (node, printFunction, depth) => {
};
exports.printHtmlNode = printHtmlNode;
const cleanupHtmlNodeAttributes = (node, cleanupElementAttributes) => {
if (node.nodeType === node.ELEMENT_NODE) {
if (node.nodeType === constants_1.ELEMENT_NODE) {
cleanupElementAttributes(node);
}
let child = node.firstChild;
......@@ -128,8 +129,8 @@ exports.cleanupHtmlNodeAttributes = cleanupHtmlNodeAttributes;
const pruneHtmlNode = (node, pruneElement) => {
let toBeRemoved = false;
switch (node.nodeType) {
case node.COMMENT_NODE:
case node.DOCUMENT_TYPE_NODE:
case constants_1.COMMENT_NODE:
case constants_1.DOCUMENT_TYPE_NODE:
toBeRemoved = true;
break;
case node.TEXT_NODE: {
......@@ -142,7 +143,7 @@ const pruneHtmlNode = (node, pruneElement) => {
}
break;
}
case node.ELEMENT_NODE:
case constants_1.ELEMENT_NODE:
toBeRemoved = pruneElement(node);
}
if (toBeRemoved) {
......@@ -169,7 +170,7 @@ const escapeHtmlString = (string) => {
let html = "";
let index = 0;
let lastIndex = 0;
for (let index = match.index; index < str.length; index++) {
for (index = match.index; index < str.length; index++) {
switch (str.charCodeAt(index)) {
case 34: // "
escape = "&quot;";
......
......@@ -43,7 +43,7 @@ const pruneElement = (element) => {
exports.pruneElement = pruneElement;
const cloneAnchorFromPane = (a, pane) => {
try {
const url = new URL(a.href);
const url = new URL(a.getAttribute("href"));
// If this is external url
if (url.host && url.protocol) {
pane.parentNode.insertBefore(a.cloneNode(false), pane);
......
......@@ -13,8 +13,8 @@ const amendGmailNodes = (document) => {
*/
const attachmentsPanes = Array.from(document.getElementsByClassName("gmail_chip"));
attachmentsPanes.forEach((pane) => {
const as = pane.querySelectorAll("a");
as.forEach((a) => {
const as = pane.getElementsByTagName("a");
Array.from(as).forEach((a) => {
common_1.cloneAnchorFromPane(a, pane);
});
});
......
export declare const ELEMENT_NODE = 1;
export declare const COMMENT_NODE = 8;
export declare const DOCUMENT_TYPE_NODE = 10;
export declare const TEXT_NODE = 3;
export declare const DOCUMENT_NODE = 9;
export declare const EMAIL_VENDORS: {
......
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EMAIL_VENDORS = exports.DOCUMENT_NODE = exports.TEXT_NODE = exports.ELEMENT_NODE = void 0;
exports.EMAIL_VENDORS = exports.DOCUMENT_NODE = exports.TEXT_NODE = exports.DOCUMENT_TYPE_NODE = exports.COMMENT_NODE = exports.ELEMENT_NODE = void 0;
exports.ELEMENT_NODE = 1;
exports.COMMENT_NODE = 8;
exports.DOCUMENT_TYPE_NODE = 10;
exports.TEXT_NODE = 3;
exports.DOCUMENT_NODE = 9;
exports.EMAIL_VENDORS = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment