问题
I am talking about Emmet.io (former Zen Coding)
Is there a Javascript code or JQuery plugin that does that in reverse?
Example:
emmet('ul > li*3') => '<ul><li></li><li></li><li></li></ul>'
I wan't something like this
emmet('<ul><li></li><li></li><li></li></ul>') => 'ul > li*3'
PS: i have been googling for a while before i decided to ask here. Thank you.
回答1:
HTML.js is what you're looking for
http://nbubna.github.io/HTML/
回答2:
Okay. Lets do this way.
We have the Sizzle selector. And with the .size()
I guess we might be able to achieve it.
Check this question. Seems similar: Reverse Zen Coding.
来源:https://stackoverflow.com/questions/15206411/generate-emmet-code-from-html