MCPcopy Index your code
hub / github.com/ronreiter/interactive-tutorials / zeroWidthElement

Function zeroWidthElement

static/js/codemirror/codemirror.js:5064–5073  ·  view source on GitHub ↗
(measure)

Source from the content-addressed store, hash-verified

5062
5063 var zwspSupported;
5064 function zeroWidthElement(measure) {
5065 if (zwspSupported == null) {
5066 var test = elt("span", "\u200b");
5067 removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
5068 if (measure.firstChild.offsetHeight != 0)
5069 zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !ie_lt8;
5070 }
5071 if (zwspSupported) return elt("span", "\u200b");
5072 else return elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
5073 }
5074
5075 // See if "".split is the broken IE version, if so, provide an
5076 // alternative way to split lines.

Callers 1

lineContentFunction · 0.85

Calls 2

eltFunction · 0.85
removeChildrenAndAddFunction · 0.85

Tested by

no test coverage detected