code: static final List<Element> importOrDetach(Document document, Element... elements) {
          List<Element> detached = new ArrayList<Element>();
  
          for (Element e : elements) {
              if (document != e.getOwnerDocument()) {
                  detached.add((Element) document.importNode(e, true));
              }
              else {
                  Node parent = e.getParentNode();
  
                  if (parent != null)
                      parent.removeChild(e);
  
                  detached.add(e);
              }
          }
  
          return detached;
      }
docs: Make a list of elements available in a document.
  <ul>
  <li>Any element that is already in the document will be detached from its
  parent</li>
  <li>Any element that is not already in the document will be deep-imported
  </li>
  </ul>
  
  @param document The document to import elements into
  @param elements The elements that are made available to a document.
  @return Elements that are all in the supplied document, but detached.