MCPcopy Create free account
hub / github.com/TruthHun/BookStack / zeroWidthElement

Function zeroWidthElement

static/editor.md/lib/codemirror/lib/codemirror.js:8260–8271  ·  view source on GitHub ↗
(measure)

Source from the content-addressed store, hash-verified

8258
8259 var zwspSupported;
8260 function zeroWidthElement(measure) {
8261 if (zwspSupported == null) {
8262 var test = elt("span", "\u200b");
8263 removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
8264 if (measure.firstChild.offsetHeight != 0)
8265 zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8);
8266 }
8267 var node = zwspSupported ? elt("span", "\u200b") :
8268 elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
8269 node.setAttribute("cm-text", "");
8270 return node;
8271 }
8272
8273 // Feature-detect IE's crummy client rect reporting for bidi text
8274 var badBidiRects;

Callers 1

buildLineContentFunction · 0.70

Calls 3

eltFunction · 0.70
removeChildrenAndAddFunction · 0.70
setAttributeMethod · 0.45

Tested by

no test coverage detected