MCPcopy
hub / github.com/prettier/prettier / isSimpleElement

Function isSimpleElement

src/language-html/print-preprocess.js:142–156  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

140
141function mergeSimpleElementIntoText(ast /* , options */) {
142 const isSimpleElement = (node) =>
143 node.kind === "element" &&
144 node.attrs.length === 0 &&
145 !isNonEmptyArray(node.startTagComments) &&
146 node.children.length === 1 &&
147 node.firstChild.kind === "text" &&
148 !htmlWhitespace.hasWhitespaceCharacter(node.children[0].value) &&
149 !node.firstChild.hasLeadingSpaces &&
150 !node.firstChild.hasTrailingSpaces &&
151 node.isLeadingSpaceSensitive &&
152 !node.hasLeadingSpaces &&
153 node.isTrailingSpaceSensitive &&
154 !node.hasTrailingSpaces &&
155 node.prev?.kind === "text" &&
156 node.next?.kind === "text";
157 ast.walk((node) => {
158 if (node.children) {
159 for (let i = 0; i < node.children.length; i++) {

Callers 1

Calls 2

isNonEmptyArrayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…