copy js from liuliu's repo
componentize