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

Function zeroWidthElement

static/mergely/lib/codemirror.js:8501–8512  ·  view source on GitHub ↗
(measure)

Source from the content-addressed store, hash-verified

8499
8500 var zwspSupported;
8501 function zeroWidthElement(measure) {
8502 if (zwspSupported == null) {
8503 var test = elt("span", "\u200b");
8504 removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
8505 if (measure.firstChild.offsetHeight != 0)
8506 zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8);
8507 }
8508 var node = zwspSupported ? elt("span", "\u200b") :
8509 elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
8510 node.setAttribute("cm-text", "");
8511 return node;
8512 }
8513
8514 // Feature-detect IE's crummy client rect reporting for bidi text
8515 var badBidiRects;

Callers 1

buildLineContentFunction · 0.70

Calls 3

eltFunction · 0.70
removeChildrenAndAddFunction · 0.70
setAttributeMethod · 0.45

Tested by

no test coverage detected