Git Product home page Git Product logo

html-ast's Introduction

html-ast

html的AST解析

parse

dom只能有一个根节点

   import {Parse} from '../dist/index';
   const result = Parse(`htmlString`)

result

	{
	  "name": tagName,
	  "attr": [{}...],
	  "closeSelf": boolean,
	  "status": start|end,
	  "children": [{}...]
	}

compile

parse的结果作为入参

	import {Compile} from '../dist/index';
	Compile(data);

result

<form name='searchTop' action='//list.tmall.com/search_product.htm' class='mallSearch-form clearfix' target='_top' acceptCharset='gbk' ><fieldset ><legend > 天猫搜索</legend><div class='mallSearch-input clearfix' ><label for='mq' > 搜索 天猫 商品/品牌/店铺</label><div class='s-combobox' ><div class='s-combobox-input-wrap' ><input type='text' name='q' accesskey='s' autocomplete='off' x-webkit-speech='' x-webkit-grammar='builtin:translate' value='' id='mq' autocomplete='off' ></input></div></div><button type='submit' > 搜索<s ></s></button><input id='J_Type' type='hidden' name='type' value='p' ></input><input id='J_MallSearchStyle' type='hidden' name='style' value='' ></input><input id='J_Cat' type='hidden' name='cat' value='all' ></input><input type='hidden' name='vmarket' value='' ></input></div></fieldset><a href='//tmall.com' ><span > test</span></a></form>

html-ast's People

Contributors

renminghao avatar

Stargazers

Handmade Javascript avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.