MCPcopy Create free account
hub / github.com/breck7/scroll / zeroWidthElement

Function zeroWidthElement

external/.scrollLibs.js:2080–2091  ·  view source on GitHub ↗
(measure)

Source from the content-addressed store, hash-verified

2078
2079 var zwspSupported
2080 function zeroWidthElement(measure) {
2081 if (zwspSupported == null) {
2082 var test = elt("span", "\u200b")
2083 removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]))
2084 if (measure.firstChild.offsetHeight != 0) {
2085 zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8)
2086 }
2087 }
2088 var node = zwspSupported ? elt("span", "\u200b") : elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px")
2089 node.setAttribute("cm-text", "")
2090 return node
2091 }
2092
2093 // Feature-detect IE's crummy client rect reporting for bidi text
2094 var badBidiRects

Callers 1

buildLineContentFunction · 0.85

Calls 2

eltFunction · 0.85
removeChildrenAndAddFunction · 0.85

Tested by

no test coverage detected