diff --git a/build-system/test-configs/dep-check-config.js b/build-system/test-configs/dep-check-config.js index e2179426a9ce1..39607f8070388 100644 --- a/build-system/test-configs/dep-check-config.js +++ b/build-system/test-configs/dep-check-config.js @@ -120,7 +120,7 @@ exports.rules = [ filesMatching: 'ads/**/*.js', mustNotDependOn: 'src/**/*.js', allowlist: [ - 'ads/**->src/utils/dom-fingerprint.js', + 'ads/**->src/core/dom/fingerprint.js', 'ads/**->src/core/constants/consent-state.js', 'ads/**->src/core/error/index.js', 'ads/**->src/core/types/array.js', diff --git a/src/document-ready.js b/src/core/document-ready.js similarity index 100% rename from src/document-ready.js rename to src/core/document-ready.js diff --git a/src/utils/dom-fingerprint.js b/src/core/dom/fingerprint.js similarity index 97% rename from src/utils/dom-fingerprint.js rename to src/core/dom/fingerprint.js index f6d15761e2c1c..a3cd3efe5b378 100644 --- a/src/utils/dom-fingerprint.js +++ b/src/core/dom/fingerprint.js @@ -14,8 +14,8 @@ * limitations under the License. */ -import {isElement} from '../core/types'; -import {stringHash32} from '../core/types/string'; +import {isElement} from '../types'; +import {stringHash32} from '../types/string'; /** * Gets a string of concatenated element names and relative positions diff --git a/src/get-html.js b/src/core/dom/get-html.js similarity index 90% rename from src/get-html.js rename to src/core/dom/get-html.js index 0f469ea59cfcb..84392f26437c5 100644 --- a/src/get-html.js +++ b/src/core/dom/get-html.js @@ -14,7 +14,7 @@ * limitations under the License. */ -import {isElement} from './core/types'; +import {isElement, isString} from '../types'; /** @type {!Array} */ const excludedTags = ['script', 'style']; @@ -76,14 +76,12 @@ export function getHtml(win, selector, attrs) { */ function appendToResult(node, attrs, result) { const stack = [node]; - const allowedAttrs = attrs.filter((attr) => { - return allowedAttributes.includes(attr); - }); + const allowedAttrs = attrs.filter((attr) => allowedAttributes.includes(attr)); while (stack.length > 0) { node = stack.pop(); - if (typeof node === 'string') { + if (isString(node)) { result.push(node); } else if (node.nodeType === Node.TEXT_NODE) { result.push(node.textContent); @@ -99,7 +97,7 @@ function appendToResult(node, attrs, result) { } /** - * + * Returns true for allowed AMP tags and non-AMP tags except