INNER CODE UNIT · JavaScript

quoteText

w3c/webdriver · issue.js:53

		let quoteText = text => text.split("\n").map(el => "> " + el).join("\n");

		// TODO(ato): Make this just construct a tree of h2/h3
		let findSection = (el, localName) => {
			let sectionEl = el.closest("section");
			if (!sectionEl)
				return null;
			let heading = sectionEl.querySelector(":scope > " + localName);
			if (!heading)
				return findSection(sectionEl.parentNode, localName);

			let relUrl = location.href + "#" + encodeURIComponent(heading.id);

			return {
				url: relUrl,
				text: heading.textContent,
			};
		};

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…