Get the density of links as a percentage of the content
This is the amount of text that is inside a link divided by the total text in the node.

@param Element
@return number (float)
180812
function getLinkDensity(e) {
  var links = e.getElementsByTagName("a");

  var textLength = getInnerText(e).length;
  var linkLength = 0;
  for (var i = 0, il = links.length; i < il; i++) {
    var href = links[i].getAttribute('href');
    // hack for <h2><a href="#menu"></a></h2> / <h2><a></a></h2>
    if (!href || (href.length > 0 && href[0] === '#')) continue;
    linkLength += getInnerText(links[i]).length;
  }
  return linkLength / textLength;
}
96662
function(element) {
			var result = 0;
			var parent = element.parentNode;
			if (parent) {
				var node = parent.firstElementChild;
				while (node) {
					if (node === element) {
						break;
					} else {
						node = node.nextElementSibling;
						result++;
					}
				}
			}
			return result;
		}
1043010
public String getPlainText(Element element) {
        FormattingVisitor formatter = new FormattingVisitor();
        NodeTraversor.traverse(formatter, element); // walk the DOM, and call .head() and .tail() for each node

        return formatter.toString();
    }
487017
public List<T> getElements() {
		ArrayList<T> list = new ArrayList<>(nodes.size());
		for (Node<T> node : nodes)
			list.add(node.element);
		return list;
	}
	
	/** Return the number of elements. */
	public int size() { return nodes.size(); }
	
}
533869
private Double getPercentage(Number number)
   {
      Double result = null;

      if (number != null)
      {
         result = Double.valueOf(number.doubleValue() / 100);
      }

      return result;
   }
1267552
function _elementNeedsDistribution(element) {
    var this$1 = this;

    var c$ = tree.Logical.getChildNodes(element);
    for (var i=0, c; i < c$.length; i++) {
      c = c$[i];
      if (this$1._distributor.isInsertionPoint(c)) {
        return element.getRootNode();
      }
    }
  }
173266
private String getElementText(Element element) {
        Node node = element.getFirstChild();
        if (node == null || node.getNodeType() != Node.TEXT_NODE) {
            return null;
        }
        return node.getNodeValue().trim();
    }
1360476
function (containerEl) {
    // Only a single child element
    if (
      containerEl.childNodes.length === 1
      && containerEl.childNodes[0].nodeType === NODE_TYPE.ELEMENT
    ) {
      return true;
    }
    // Only one element, and all other children are whitespace
    var foundElement = false;
    for (var i = 0, count = containerEl.childNodes.length; i < count; i++) {
      var child = containerEl.childNodes[i];
      if (child.nodeType === NODE_TYPE.ELEMENT) {
        if (foundElement) {
          // Encountered an element after already encountering another one
          // Therefore, more than one element at root level
          return false;
        } else {
          foundElement = true;
        }
      } else if (child.nodeType === NODE_TYPE.TEXT && !isEmpty(child.textContent)) {
        // Contains text content
        return false;
      }
    }
    return true;
  }
33309
public String getText(WebElement element) {
        String text = element.getText();
        if (text != null) {
            // Safari driver does not return &nbsp; as normal spacce, while others do
            text = text.replace(NON_BREAKING_SPACE, ' ');
            // Safari driver does not return trim, while others do
            text = text.trim();
        }
        return text;
    }
906968
public static String getClass(String element) {
        Preconditions.checkNotNull(element,"argument 'element' can not be null");
        return element.substring(element.lastIndexOf('.') + 1);
    }
435663
function getNearestTypeElement(element) {
		var found = false;
		var moduleBoundaryReached = false;

		// We need to check for the existence of 'element' since occasionally we call this on a detached element node.
		// For example:
		//  1. event handlers like mouseout may sometimes detach nodes from the DOM
		//  2. event handlers like mouseleave will still fire on the detached node
		// Checking existence of element.parentNode ensures the element is a valid HTML Element
		while (!found && element && element.parentNode && !moduleBoundaryReached) {
			found = isTypeElement(element);
			moduleBoundaryReached = isModuleElement(element);

			if (!found) {
				element = element.parentNode;
			}

		}

		return found ? element : null;
	}
108285
public static int getPercentage(String percentage) {
        if (isNotEmpty(percentage) && isNumeric(percentage)) {
            int p = Integer.parseInt(percentage);
            return p;
        } else {
            return 0;
        }
    }
4706
@Override
   public int getContentLength()
   {
      try
      {
         if (!connected)
         {
            connect();
         }

         return (int)nodeRepresentation.getContentLenght();
      }
      catch (IOException e)
      {
         if (LOG.isTraceEnabled())
         {
            LOG.trace("An exception occurred: " + e.getMessage());
         }
      }
      catch (RepositoryException e)
      {
         if (LOG.isTraceEnabled())
         {
            LOG.trace("An exception occurred: " + e.getMessage());
         }
      }
      return -1;
   }
733635
function getElement () {
  if (element === null) {
    element = document.createElement('a');
    element.innerText = 'Download';
    element.style.position = 'absolute';
    element.style.top = '-100px';
    element.style.left = '0px';
  }

  return element;
}
1152848
private int getElementIndex(Node node) {
        final String nodeName = node.getNodeName();

        int count = 1;
        for (Node previousSibling = node.getPreviousSibling();
                previousSibling != null;
                previousSibling = previousSibling.getPreviousSibling()) {
            if (previousSibling.getNodeType() == Node.ELEMENT_NODE
                    && previousSibling.getNodeName().equals(nodeName)) {
                count++;
            }
        }

        return count;
    }
480390
function getElementSize(element) {
            if (!element.getBoundingClientRect) {
                return {
                    width: element.offsetWidth,
                    height: element.offsetHeight
                }
            }

            var rect = element.getBoundingClientRect();
            return {
                width: Math.round(rect.width),
                height: Math.round(rect.height)
            }
        }
230240
public static String getPackage(String element) {
        Preconditions.checkNotNull(element,"argument 'element' can not be null");
        return element.substring(0, element.lastIndexOf('.'));
    }