Make sure the expected BBox is returned if the element is a group
767598
function(elem) {

		try {
			// TODO: Fix issue with rotated groups. Currently they work
			// fine in FF, but not in other browsers (same problem mentioned
			// in Issue 339 comment #2).

			var bb = svgedit.utilities.getBBox(elem);
			var angle = svgedit.utilities.getRotationAngle(elem);

			if ((angle && angle % 90) ||
				svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(elem))) {
				// Accurate way to get BBox of rotated element in Firefox:
				// Put element in group and get its BBox
				var good_bb = false;
				// Get the BBox from the raw path for these elements
				var elemNames = ['ellipse', 'path', 'line', 'polyline', 'polygon'];
				if (elemNames.indexOf(elem.tagName) >= 0) {
					bb = good_bb = canvas.convertToPath(elem, true);
				} else if (elem.tagName == 'rect') {
					// Look for radius
					var rx = elem.getAttribute('rx');
					var ry = elem.getAttribute('ry');
					if (rx || ry) {
						bb = good_bb = canvas.convertToPath(elem, true);
					}
				}

				if (!good_bb) {
					// Must use clone else FF freaks out
					var clone = elem.cloneNode(true);
					var g = document.createElementNS(NS.SVG, "g");
					var parent = elem.parentNode;
					parent.appendChild(g);
					g.appendChild(clone);
					bb = svgedit.utilities.bboxToObj(g.getBBox());
					parent.removeChild(g);
				}

				// Old method: Works by giving the rotated BBox,
				// this is (unfortunately) what Opera and Safari do
				// natively when getting the BBox of the parent group
//						var angle = angle * Math.PI / 180.0;
//						var rminx = Number.MAX_VALUE, rminy = Number.MAX_VALUE, 
//							rmaxx = Number.MIN_VALUE, rmaxy = Number.MIN_VALUE;
//						var cx = round(bb.x + bb.width/2),
//							cy = round(bb.y + bb.height/2);
//						var pts = [ [bb.x - cx, bb.y - cy], 
//									[bb.x + bb.width - cx, bb.y - cy],
//									[bb.x + bb.width - cx, bb.y + bb.height - cy],
//									[bb.x - cx, bb.y + bb.height - cy] ];
//						var j = 4;
//						while (j--) {
//							var x = pts[j][0],
//								y = pts[j][1],
//								r = Math.sqrt( x*x + y*y );
//							var theta = Math.atan2(y,x) + angle;
//							x = round(r * Math.cos(theta) + cx);
//							y = round(r * Math.sin(theta) + cy);
//		
//							// now set the bbox for the shape after it's been rotated
//							if (x < rminx) rminx = x;
//							if (y < rminy) rminy = y;
//							if (x > rmaxx) rmaxx = x;
//							if (y > rmaxy) rmaxy = y;
//						}
//						
//						bb.x = rminx;
//						bb.y = rminy;
//						bb.width = rmaxx - rminx;
//						bb.height = rmaxy - rminy;
			}
			return bb;
		} catch(e) {
			console.log(elem, e);
			return null;
		}
	}
568264
def push_group(self, my_dict, key, element):
        '''  '''
        parent_group = my_dict.setdefault(key, {})
        if not isinstance(parent_group, dict):
            parent_group = my_dict[key] = {'hosts': parent_group}
        child_groups = parent_group.setdefault('children', [])
        if element not in child_groups:
            child_groups.append(element)
1339500
function checkKeyframesSelectorsGroup(i) {
  const start = i;
  let l;

  if (l = checkKeyframesSelector(i)) i += l;
  else return 0;

  while (i < tokensLength) {
    const spaceBefore = checkSC(i);
    const comma = checkDelim(i + spaceBefore);
    if (!comma) break;

    const spaceAfter = checkSC(i + spaceBefore + comma);
    if (l = checkKeyframesSelector(i + spaceBefore + comma + spaceAfter)) {
      i += spaceBefore + comma + spaceAfter + l;
    } else break;
  }

  tokens[start].selectorsGroupEnd = i;

  return i - start;
}
647403
function (bbox) {
        var _min = this.min.array;
        var _max = this.max.array;

        var _min2 = bbox.min.array;
        var _max2 = bbox.max.array;

        return ! (_min[0] > _max2[0] || _min[1] > _max2[1] || _min[2] > _max2[2]
            || _max[0] < _min2[0] || _max[1] < _min2[1] || _max[2] < _min2[2]);
    }
266211
def seqingroups(groups,seq):
  ''
  if not (groups and seq): return None
  bestmatch=None,None,0
  if any(len(g)<2 for g in groups): raise ValueError('some subgroups have length < 2')
  for i,g in filter(lambda x:x[1][0],enumerate(groups)): # i.e. we're only interested in groups with common elements
    # begin starts at 0 so begin+1 starts at 1. (first elt of each group is the bool indicator)
    begin=0
    while 1:
      try: begin=g.index(seq[0],begin+1)
      except ValueError: break
      jmax=min(len(g)-begin,len(seq))
      for j in range(jmax):
        if g[begin+j]!=seq[j]: break
      else: j+=1 # so matchlen works below
      matchlen=min(j,jmax)
      if matchlen<bestmatch[2]: continue
      bestmatch=[i,begin,matchlen] # note: begin is an offset including the initial bool
  return bestmatch if bestmatch[2] else None
317307
function (opts) {
        var objectGroupName = opts.name,
            objectGroup = null

        this.objectGroups.forEach(function (item) {
            if (item.name == objectGroupName) {
                objectGroup = item
            }
        })
        if (objectGroup !== null) {
            return objectGroup
        }
    }
1273210
private void checkGroup(Entry<Point, Set<Collidable>> current)
    {
        final Set<Collidable> elements = current.getValue();
        for (final Collidable objectA : elements)
        {
            checkOthers(objectA, current);
        }
    }
382969
function getKeyframesSelectorsGroup() {
  let selectorsGroup = [];
  const selectorsGroupEnd = tokens[pos].selectorsGroupEnd;

  selectorsGroup.push(getKeyframesSelector());

  if (checkSC(pos) && tokens[pos].type !== TokenType.Newline) {
    selectorsGroup = selectorsGroup.concat(getSC());
  }

  while (pos < selectorsGroupEnd) {
    selectorsGroup = selectorsGroup.concat(
      getDelim(),
      getSC(),
      getSC(),
      getSC(),
      getKeyframesSelector()
    );

    if (checkSC(pos) && tokens[pos].type !== TokenType.Newline) {
      selectorsGroup = selectorsGroup.concat(getSC());
    }
  }

  return selectorsGroup;
}
1063673
def is_group_or_super_group(cls, obj) -> bool:
        
        return cls._check(obj, [cls.GROUP, cls.SUPER_GROUP])
868078
def get_cgroup_item(self, key):
        
        value = _lxc.Container.get_cgroup_item(self, key)

        if value is False:
            return False
        else:
            return value.rstrip("\n")
442173
function _getElements( group, selector ) {
    if ( selector ) {
        if ( selector === 'form' ) {
            return [ formHtml ];
        }
        // e.g. if the widget selector starts at .question level (e.g. ".or-appearance-draw input")
        if ( group.classList.contains( 'question' ) ) {
            return [ ...group.querySelectorAll( 'input:not(.ignore), select:not(.ignore), textarea:not(.ignore)' ) ]
                .filter( el => el.matches( selector ) );
        }
        return [ ...group.querySelectorAll( selector ) ];
    }

    return [];
}
437355
def check_bbox(bbox):
    """"""
    for name, value in zip(['x_min', 'y_min', 'x_max', 'y_max'], bbox[:4]):
        if not 0 <= value <= 1:
            raise ValueError(
                'Expected {name} for bbox {bbox} '
                'to be in the range [0.0, 1.0], got {value}.'.format(
                    bbox=bbox,
                    name=name,
                    value=value,
                )
            )
    x_min, y_min, x_max, y_max = bbox[:4]
    if x_max <= x_min:
        raise ValueError('x_max is less than or equal to x_min for bbox {bbox}.'.format(
            bbox=bbox,
        ))
    if y_max <= y_min:
        raise ValueError('y_max is less than or equal to y_min for bbox {bbox}.'.format(
            bbox=bbox,
        ))
1241235
def color_group(self, checked=False, test_color=None):
        """"""
        group = self.tabs.currentWidget()
        if test_color is None:
            newcolor = QColorDialog.getColor(group.idx_color)
        else:
            newcolor = test_color
        group.idx_color = newcolor

        self.apply()
937796
public void accept(PainterVisitor visitor, Object group, Bbox bounds, boolean recursive) {
		map.getVectorContext().drawGroup(group, this);

		Coordinate c = getUpperLeftCorner();
		PictureStyle pictureStyle = new PictureStyle(1);
		pictureStyle.setClassName("gm-ZoomStepControl");
		map.getVectorContext().drawImage(this, "bg", Geomajas.getIsomorphicDir() + "geomajas/mapaddon/zoombg.png",
				new Bbox(c.getX(), c.getY(), 20, 60), pictureStyle);

		pictureStyle = new PictureStyle(1);
		pictureStyle.setClassName("gm-ZoomStepControl-zoomIn");
		map.getVectorContext().drawImage(this, "plus", Geomajas.getIsomorphicDir() + "geomajas/mapaddon/zoomPlus.png",
				new Bbox(c.getX(), c.getY(), 20, 20), pictureStyle);
		map.getVectorContext().setCursor(this, "plus", Cursor.POINTER.getValue());

		pictureStyle = new PictureStyle(1);
		pictureStyle.setClassName("gm-ZoomStepControl-zoomOut");
		map.getVectorContext().drawImage(this, "minus",
				Geomajas.getIsomorphicDir() + "geomajas/mapaddon/zoomMinus.png",
				new Bbox(c.getX(), c.getY() + 40, 20, 20), pictureStyle);
		map.getVectorContext().setCursor(this, "minus", Cursor.POINTER.getValue());

		pictureStyle = new PictureStyle(1);
		pictureStyle.setClassName("gm-ZoomStepControl-zoomMax");
		map.getVectorContext().drawImage(this, "max", Geomajas.getIsomorphicDir() + "geomajas/mapaddon/maxextent.png",
				new Bbox(c.getX(), c.getY() + 20, 20, 20), pictureStyle);
		map.getVectorContext().setCursor(this, "max", Cursor.POINTER.getValue());

		if (firstTime) {
			map.getVectorContext().setController(this, "plus", new ZoomController(map, 2), Event.MOUSEEVENTS);
			map.getVectorContext().setCursor(this, "plus", Cursor.POINTER.getValue());

			map.getVectorContext().setController(this, "minus", new ZoomController(map, 0.5), Event.MOUSEEVENTS);
			map.getVectorContext().setCursor(this, "minus", Cursor.POINTER.getValue());

			map.getVectorContext().setController(this, "max", new MaxExtentController(map), Event.MOUSEEVENTS);
			map.getVectorContext().setCursor(this, "max", Cursor.POINTER.getValue());
		}
		firstTime = false;
	}
912413
public Boolean getBool(String key, String group) {
		return getBool(key, group, null);
	}
1267516
def _group(tlist, cls, match,
           valid_prev=lambda t: True,
           valid_next=lambda t: True,
           post=None,
           extend=True,
           recurse=True
           ):
    """"""

    tidx_offset = 0
    pidx, prev_ = None, None
    for idx, token in enumerate(list(tlist)):
        tidx = idx - tidx_offset

        if token.is_whitespace:
            continue

        if recurse and token.is_group and not isinstance(token, cls):
            _group(token, cls, match, valid_prev, valid_next, post, extend)

        if match(token):
            nidx, next_ = tlist.token_next(tidx)
            if prev_ and valid_prev(prev_) and valid_next(next_):
                from_idx, to_idx = post(tlist, pidx, tidx, nidx)
                grp = tlist.group_tokens(cls, from_idx, to_idx, extend=extend)

                tidx_offset += to_idx - from_idx
                pidx, prev_ = from_idx, grp
                continue

        pidx, prev_ = tidx, token
979767
function BBox(left, top, width, height) {
      var s;

      if (left == null) {
        left = 0;
      }
      if (top == null) {
        top = 0;
      }
      if (width == null) {
        width = null;
      }
      if (height == null) {
        height = null;
      }
      s = this;
      if (width === null) {
        s.xmin = Number.MAX_VALUE;
        s.xmax = Number.MAX_VALUE * -1;
      } else {
        s.xmin = s.left = left;
        s.xmax = s.right = left + width;
        s.width = width;
      }
      if (height === null) {
        s.ymin = Number.MAX_VALUE;
        s.ymax = Number.MAX_VALUE * -1;
      } else {
        s.ymin = s.top = top;
        s.ymax = s.bottom = height + top;
        s.height = height;
      }
      return;
    }