Currently there is an optional $context parameter to bind functions. Whenever I use this parameter, I always do $binder->bindList($listOfStuff, $document->querySelector("select[name='thing']"); to bind a list of stuff into a select element (for example).
It would be nicer if I could pass just the selector into the context, and for the binder to do the querySelector for me. This is not only shorter to type, but it also means I won't have to import the HTMLDocument each time I want this functionality.
Proposed new style:
function go(Binder $binder):void {
$binder->bindList(["one", "two", "three"], "[name='thing']");
}
Currently there is an optional
$context
parameter to bind functions. Whenever I use this parameter, I always do$binder->bindList($listOfStuff, $document->querySelector("select[name='thing']");
to bind a list of stuff into a select element (for example).It would be nicer if I could pass just the selector into the context, and for the binder to do the querySelector for me. This is not only shorter to type, but it also means I won't have to import the HTMLDocument each time I want this functionality.
Proposed new style: