"var control = view.$('[' + selector + '=' + attr + ']');" replces with ...

..."var control = view.$(selector);"