Greediness with unspecified width of flex blocks in CSS

If flex elements do not have a specified width, then this width will be generated based on the content:

html<div class="parent">
  <div class="child elem1">text text text</div>
  <div class="child elem2">text</div>
</div>
css.parent {
  display: flex;
  width: 300px;
  height: 200px;
  border: 1px solid red;
}
.child {
  height: 50px;
  border: 1px solid green;
}

Результат:

If you set greediness for such elements, the free space will be added to the width formed by the text:

html<div class="parent">
  <div class="child elem1">text text text</div>
  <div class="child elem2">text</div>
</div>
css.parent {
  display: flex;
  width: 300px;
  height: 200px;
  border: 1px solid red;
}
.child {
  height: 50px;
  border: 1px solid green;
}
.elem1 {
  flex-grow: 1;
}
.elem2 {
  flex-grow: 1;
}

Результат: