[gallery-y-common-dombind] directive creation method added and code refactor