Minor improvement to js widgets factory methods