Return the open tag of the previous sibling
502684
def _get_previous_open_tag(self, obj):
        
        prev_instance = self.get_previous_instance(obj)
        if prev_instance and prev_instance.plugin_type == self.__class__.__name__:
            return prev_instance.glossary.get('open_tag')
583232
function walk(node, rootNode, prev) {
      var sibling, parent, startName = prev ? 'lastChild' : 'firstChild', siblingName = prev ? 'prev' : 'next';

      // Walk into nodes if it has a start
      if (node[startName]) {
        return node[startName];
      }

      // Return the sibling if it has one
      if (node !== rootNode) {
        sibling = node[siblingName];

        if (sibling) {
          return sibling;
        }

        // Walk up the parents to look for siblings
        for (parent = node.parent; parent && parent !== rootNode; parent = parent.parent) {
          sibling = parent[siblingName];

          if (sibling) {
            return sibling;
          }
        }
      }
    }
285663
function find_ancestor_tag($tag)
    {
        global $debug_object;
        if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }

        // Start by including ourselves in the comparison.
        $returnDom = $this;

        while (!is_null($returnDom))
        {
            if (is_object($debug_object)) { $debug_object->debug_log(2, "Current tag is: " . $returnDom->tag); }

            if ($returnDom->tag == $tag)
            {
                break;
            }
            $returnDom = $returnDom->parent;
        }
        return $returnDom;
    }
497378
function (start) {
        var container, parent, sibling, siblingName, root;

        container = parent = start ? startContainer : endContainer;
        siblingName = start ? 'previousSibling' : 'nextSibling';
        root = dom.getRoot();

        // If it's a text node and the offset is inside the text
        if (container.nodeType === 3 && !isWhiteSpaceNode(container)) {
          if (start ? startOffset > 0 : endOffset < container.nodeValue.length) {
            return container;
          }
        }

        /*eslint no-constant-condition:0 */
        while (true) {
          // Stop expanding on block elements
          if (!format[0].block_expand && dom.isBlock(parent)) {
            return parent;
          }

          // Walk left/right
          for (sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) {
            if (!isBookmarkNode(sibling) && !isWhiteSpaceNode(sibling) && !isBogusBr(sibling)) {
              return parent;
            }
          }

          // Check if we can move up are we at root level or body level
          if (parent === root || parent.parentNode === root) {
            container = parent;
            break;
          }

          parent = parent.parentNode;
        }

        return container;
      }
997915
function getPreviousSiblings(el) {
  var siblings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  var previousSibling = el.previousSibling;

  if (!previousSibling) {
    return siblings;
  }

  siblings.push(previousSibling);
  return getPreviousSiblings(previousSibling, siblings);
}
1078345
def focus_prev_sibling(self):
        """"""
        w, focuspos = self.get_focus()
        sib = self._tree.prev_sibling_position(focuspos)
        if sib is not None:
            self.set_focus(sib)
665308
def previous_element(name = nil)
      if siblings = parent.children
        found = nil
        siblings.each do |node|
          return found if node.equal?(self)
          found = node if node.tag? && (name.nil? || node.name == name)
        end
      end
      nil
    end
890976
def select_one(self, tag):
        """"""

        tags = self.select(tag, limit=1)
        return tags[0] if tags else None
620818
function _index(/**HTMLElement*/el) {
		var index = 0;
		while (el && (el = el.previousElementSibling)) {
			if (el.nodeName.toUpperCase() !== 'TEMPLATE') {
				index++;
			}
		}
		return index;
	}
1324359
def lastChild(self):
        '''
            
        '''
        blocks = object.__getattribute__(self, 'blocks')
        # First block is empty string for indent, but don't hardcode incase that changes
        if blocks[0] == '':
           firstIdx = 1
        else:
           firstIdx = 0

        if len(blocks) <= firstIdx:
            return None

        return blocks[-1]
632483
def t_OPEN_TAG(t):
    '
    if '=' in t.value: t.type = 'OPEN_TAG_WITH_ECHO'
    t.lexer.lineno += t.value.count("\n")
    t.lexer.begin('php')
    return t
1335552
def _get_child(self, children, index):
        """"""
        try:
            return children[index]
        except IndexError:
            raise WSDLParseError("Non existing item in tag '%s'" %
                                   self._schema.tag)
4102
def merge_adjacent(dom, tag_name):
    
    for node in dom.getElementsByTagName(tag_name):
        prev_sib = node.previousSibling
        if prev_sib and prev_sib.nodeName == node.tagName:
            for child in list(node.childNodes):
                prev_sib.appendChild(child)
            remove_node(node)
740977
function find_ancestor_tag($tag)
    {
        global $debugObject;
        if (is_object($debugObject)) { $debugObject->debugLogEntry(1); }

        // Start by including ourselves in the comparison.
        $returnDom = $this;

        while (!is_null($returnDom))
        {
            if (is_object($debugObject)) { $debugObject->debugLog(2, "Current tag is: " . $returnDom->tag); }

            if ($returnDom->tag == $tag)
            {
                break;
            }
            $returnDom = $returnDom->parent;
        }
        return $returnDom;
    }
684499
def get_previous_instance(self, obj):
        
        ordered_siblings = obj.get_siblings().filter(placeholder=obj.placeholder).order_by('position')
        pos = list(ordered_siblings).index(obj.cmsplugin_ptr)
        if pos > 0:
            prev_sibling = ordered_siblings[pos - 1]
            return prev_sibling.get_bound_plugin()
672946
def getFragment(self):
        """"""
        # assert self.innerHTML
        fragment = self.fragmentClass()
        self.openElements[0].reparentChildren(fragment)
        return fragment
528323
function findNextHTMLItem(editor) {
		var isFirst = true;
		return findItem(editor, false, function(content, searchPos){
			if (isFirst) {
				isFirst = false;
				return findOpeningTagFromPosition(content, searchPos);
			} else {
				return getOpeningTagFromPosition(content, searchPos);
			}
		}, function(tag, offset, selRange) {
			return getRangeForHTMLItem(tag, offset, selRange, false);
		});
	}