MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / zeroWidthElement

Function zeroWidthElement

lib/web/CodeMirror/src/util/feature_detection.js:14–25  ·  view source on GitHub ↗
(measure)

Source from the content-addressed store, hash-verified

12
13let zwspSupported
14export function zeroWidthElement(measure) {
15 if (zwspSupported == null) {
16 let test = elt("span", "\u200b")
17 removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]))
18 if (measure.firstChild.offsetHeight != 0)
19 zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8)
20 }
21 let node = zwspSupported ? elt("span", "\u200b") :
22 elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px")
23 node.setAttribute("cm-text", "")
24 return node
25}
26
27// Feature-detect IE's crummy client rect reporting for bidi text
28let badBidiRects

Callers 1

buildLineContentFunction · 0.90

Calls 2

eltFunction · 0.90
removeChildrenAndAddFunction · 0.90

Tested by

no test coverage detected