MCPcopy Create free account
hub / github.com/ampproject/amphtml / posthtmlGetTextContent

Function posthtmlGetTextContent

build-system/server/app-index/test/helpers.js:7–23  ·  view source on GitHub ↗
(document, matcher)

Source from the content-addressed store, hash-verified

5}
6
7async function posthtmlGetTextContent(document, matcher) {
8 let textContent;
9
10 await posthtml([
11 (tree) => {
12 tree.match(matcher, (node) => {
13 if (node.content) {
14 textContent = node.content.join('');
15 }
16 return node;
17 });
18 return tree;
19 },
20 ]).process(document);
21
22 return textContent;
23}
24
25module.exports = {
26 getElementChildren,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected