code: function(textRange) {
                  var parentEl = textRange.parentElement();
                  var range = textRange.duplicate();
                  range.collapse(true);
                  var startEl = range.parentElement();
                  range = textRange.duplicate();
                  range.collapse(false);
                  var endEl = range.parentElement();
                  var startEndContainer = (startEl == endEl) ? startEl : dom.getCommonAncestor(startEl, endEl);
  
                  return startEndContainer == parentEl ? startEndContainer : dom.getCommonAncestor(parentEl, startEndContainer);
              }
docs: /*
  This is a workaround for a bug where IE returns the wrong container element from the TextRange's parentElement()
  method. For example, in the following (where pipes denote the selection boundaries):
  
  <ul id="ul"><li id="a">| a </li><li id="b"> b |</li></ul>
  
  var range = document.selection.createRange();
  alert(range.parentElement().id); // Should alert "ul" but alerts "b"
  
  This method returns the common ancestor node of the following:
  - the parentElement() of the textRange
  - the parentElement() of the textRange after calling collapse(true)
  - the parentElement() of the textRange after calling collapse(false)