Element.requireElementById

Calls getElementById, but throws instead of returning null if the element is not found. You can also ask for a specific subclass of Element to dynamically cast to, which also throws if it cannot be done.

class Element
final
SomeElementType
requireElementById
(
SomeElementType = Element
)
(
string id
,
string file = __FILE__
,
size_t line = __LINE__
)
if (
is(SomeElementType : Element)
)
out (ret) { assert (ret !is null); }
Suggestion Box / Bug Report