private function rebuildAttrIndex(string $key)
	{
		$this->index[$key] = [];

		foreach ($this->elements as $id => $element) {
			if ($element instanceof $this->elementClassName) {
				$value = $element->getAttr($key);
				$this->index[$key][$value][$id] = $element;
			} else {
				throw new \InvalidArgumentException("Indexed element must be instance of " . $this->elementClassName);
			}
		}
	}