MCPcopy Create free account
hub / github.com/TextGeneratorio/text-generator.io / zeroWidthElement

Function zeroWidthElement

static/libs/codemirror.js:1226–1237  ·  view source on GitHub ↗
(measure)

Source from the content-addressed store, hash-verified

1224
1225var zwspSupported;
1226function zeroWidthElement(measure) {
1227 if (zwspSupported == null) {
1228 var test = elt("span", "\u200b");
1229 removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
1230 if (measure.firstChild.offsetHeight != 0)
1231 { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }
1232 }
1233 var node = zwspSupported ? elt("span", "\u200b") :
1234 elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
1235 node.setAttribute("cm-text", "");
1236 return node
1237}
1238
1239// Feature-detect IE's crummy client rect reporting for bidi text
1240var badBidiRects;

Callers 1

buildLineContentFunction · 0.85

Calls 2

eltFunction · 0.85
removeChildrenAndAddFunction · 0.85

Tested by

no test coverage detected