https://rawgit.com/timdown/rangy/master/fiddlings/spec/innerText.htm#leading-whitespace
@param el
542047
function elementLeadingWhitespace(el) {
  let style = getComputedStyle(el, null)
  let display = style.getPropertyValue('display')

  let firstNotIgnoredChild = () => {
    for(let i = 0; i < el.children.length; i++) {
      let n = el.children[i]
      if(!ignoredNode(n)) return n
    }
    return null
  }

  if(display === 'inline') {
    let first = firstNotIgnoredChild()
    if(first && first.nodeType === Node.ELEMENT_NODE) {
      return elementLeadingWhitespace(first)
    } else {
      return ''
    }
  } else if(display === 'inline-block'
    || display === 'inline-table'
    || display === 'none'
    || display === 'table-cell'
    || display === 'table-column'
    || display === 'table-column-group') {
    return ''
  } else {
    return '\n'
  }
}
187572
function checkForIrregularWhitespace(node) {
            const sourceLines = sourceCode.lines;

            sourceLines.forEach((sourceLine, lineIndex) => {
                const lineNumber = lineIndex + 1;
                let match;

                while ((match = IRREGULAR_WHITESPACE.exec(sourceLine)) !== null) {
                    const location = {
                        line: lineNumber,
                        column: match.index
                    };

                    errors.push({ node, message: "Irregular whitespace not allowed.", loc: location });
                }
            });
        }
700941
function interElementWhiteSpace(node) {
  var value

  if (node && typeof node === 'object' && node.type === 'text') {
    value = node.value || ''
  } else if (typeof node === 'string') {
    value = node
  } else {
    return false
  }

  return value.replace(re, '') === ''
}
318858
private function removeWhitespaceAroundTags(SimpleHtmlDom $element)
    {
        if (isset(self::$trimWhitespaceFromTags[$element->tag])) {
            $node = $element->getNode();

            /** @var \DOMNode[] $candidates */
            $candidates = [];
            if ($node->childNodes->length > 0) {
                $candidates[] = $node->firstChild;
                $candidates[] = $node->lastChild;
                $candidates[] = $node->previousSibling;
                $candidates[] = $node->nextSibling;
            }

            foreach ($candidates as &$candidate) {
                if ($candidate === null) {
                    continue;
                }

                if ($candidate->nodeType === \XML_TEXT_NODE) {
                    $candidate->nodeValue = \preg_replace(self::$regExSpace, ' ', $candidate->nodeValue);
                }
            }
        }
    }
1321642
function()
    {
        if (WebInspector.CodeMirrorTextEditor._whitespaceStyleInjected || !WebInspector.settings.showWhitespacesInEditor.get())
            return;
        WebInspector.CodeMirrorTextEditor._whitespaceStyleInjected = true;
        const classBase = ".show-whitespaces .CodeMirror .cm-whitespace-";
        const spaceChar = "·";
        var spaceChars = "";
        var rules = "";
        for (var i = 1; i <= WebInspector.CodeMirrorTextEditor.MaximumNumberOfWhitespacesPerSingleSpan; ++i) {
            spaceChars += spaceChar;
            var rule = classBase + i + "::before { content: '" + spaceChars + "';}\n";
            rules += rule;
        }
        var style = createElement("style");
        style.textContent = rules;
        document.head.appendChild(style);
    }
108388
protected function linear_whitespace()
	{
		do
		{
			if (substr($this->data, $this->position, 2) === "\x0D\x0A")
			{
				$this->position += 2;
			}
			elseif ($this->data[$this->position] === "\x0A")
			{
				$this->position++;
			}
			$this->position += strspn($this->data, "\x09\x20", $this->position);
		} while ($this->has_data() && $this->is_linear_whitespace());
		$this->value .= "\x20";
	}
336515
def number_of_leading_spaces(s)
		n=0; i=0;
		while i < s.size 
			c = s[i,1]
			if c == ' '
				i+=1; n+=1;
			elsif c == "\t"
				i+=1; n+=TabSize;
			else
				break
			end
		end
		n
	end
393192
private function replaceWhitespacesInInlineElements($element, PlaceholderContainer $placeholderContainer)
    {
        return preg_replace_callback('/>\s/', function ($match) use ($placeholderContainer) {
            return '>'.$placeholderContainer->createPlaceholder(' ');
        }, $element);
    }
796430
def fix_whitespace(tokens, start, result):
    """"""
    for e in result:
        for child in e.iter():
            child.text = child.text.replace(' , ', ', ')
            for hyphen in HYPHENS:
                child.text = child.text.replace(' %s ' % hyphen, '%s' % hyphen)
            child.text = re.sub(r'- (.) -', r'-\1-', child.text)
    return result
153627
def xmlindent(elem, level=0, spacer='  '):
    
    i = "\n" + level * spacer
    if len(elem):
        if not elem.text or not elem.text.strip():
            elem.text = i + spacer
        if not elem.tail or not elem.tail.strip():
            elem.tail = i
        for elem in elem:
            xmlindent(elem, level + 1)
        if not elem.tail or not elem.tail.strip():
            elem.tail = i
    else:
        if level and (not elem.tail or not elem.tail.strip()):
            elem.tail = i
849452
def _no_trailing_whitespace(relative_path, contents, linter_options):
    """
    del relative_path
    del linter_options

    trailing_whitespace = re.compile(r"(?<![ \t\r\n])[ \t]+$")

    for index, line in enumerate(contents):
        for space in trailing_whitespace.finditer(line):
            assert space.end() == len(line) - 1
            return LinterFailure("Trailing whitespace",
                                 index + 1,
                                 line[:space.start()] + line[space.end():])
531293
public static void stripWhitespaceNodes(Node element) {
        Node node, child;
        for (child = element.getFirstChild(); child != null; child = node) {
            node = child.getNextSibling();
            stripWhitespaceNodes(child);
        }

        if (element.getNodeType() == Node.TEXT_NODE && element.getNodeValue().trim().length()==0) {
            element.getParentNode().removeChild(element);
        }
    }
1272888
private static void removePrefixFromChildren(Element el, String prefix)
			throws MarshalException {

		NodeList nl = el.getChildNodes();
		String localPrefix = null;
		for (int i = 0; i < nl.getLength(); i++) {
			Node n = nl.item(i);

			if (n.getNodeType() != Node.ELEMENT_NODE) {
				continue;
			}

			localPrefix = n.getPrefix();

			if (localPrefix != null && localPrefix.length() > 0) {

				if (!localPrefix.equals(prefix)) {
					IfmapJLog.warn("Extended Identifier: Multiple namespaces in extended identifer used."
							+ "IfmapJ thinks this is not a wise idea. Sorry!");
					throw new MarshalException("Extended Identifier: Multiple namespaces in extended identifer used."
							+ "IfmapJ thinks this is not a wise idea. Sorry!");
				}

				n.setPrefix(null);
			}

			removePrefixFromChildren((Element) n, prefix);
			dropNamespaceDecls((Element) n);

		}
	}
1112823
def whitespace(lines: float = 1.0):
    
    r = _get_report()
    r.append_body(render.whitespace(lines))
    r.stdout_interceptor.write_source('\n')
64718
public final void mLEADING() throws RecognitionException {
		try {
			int _type = LEADING;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// hql.g:40:9: ( 'leading' )
			// hql.g:40:11: 'leading'
			{
			match("leading"); if (state.failed) return;

			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
1108329
private void parse() throws ParserException {
		//skip white spaces
		skipWhitespace();
		try{
			_parse();
		}catch(Exception e){
			System.out.println("\t" + this.getClass().getSimpleName() + "->" + this.toString());
			if(!(e instanceof ParserException)){
				throw new ParserException("Error parsing", e);
			}else{
				throw (ParserException)e;
			}
		}
		skipWhitespace();
	}
961533
protected function whitespace()
    {
        $gotWhite = false;

        while (preg_match(static::$whitePattern, $this->buffer, $m, null, $this->count)) {
            if (isset($m[1]) && empty($this->commentsSeen[$this->count])) {
                $this->appendComment([Type::T_COMMENT, $m[1]]);

                $this->commentsSeen[$this->count] = true;
            }

            $this->count += strlen($m[0]);
            $gotWhite = true;
        }

        return $gotWhite;
    }