* Convert HTML string to AST. * 将HTML字符串转换为AST。
(
template, //html 模板
options
)
| 13098 | * 将HTML字符串转换为AST。 |
| 13099 | */ |
| 13100 | function parse( |
| 13101 | template, //html 模板 |
| 13102 | options |
| 13103 | ) { |
| 13104 | warn$2 = options.warn || baseWarn; //警告日志函数 |
| 13105 | platformIsPreTag = options.isPreTag || no; // 判断标签是否是pre 如果是则返回真 |
| 13106 | /* mustUseProp 校验属性 |
| 13107 | * 1. attr === 'value', tag 必须是 'input,textarea,option,select,progress' 其中一个 type !== 'button' |
| 13108 | * 2. attr === 'selected' && tag === 'option' |
| 13109 | * 3. attr === 'checked' && tag === 'input' |
| 13110 | * 4. attr === 'muted' && tag === 'video' |
| 13111 | * 的情况下为真 |
| 13112 | * */ |
| 13113 | platformMustUseProp = options.mustUseProp || no; |
| 13114 | |
| 13115 | |
| 13116 | platformGetTagNamespace = options.getTagNamespace || no; //判断 tag 是否是svg或者math 标签 |
| 13117 | //baseOptions中的modules参数为 |
| 13118 | // modules=modules$1=[ |
| 13119 | // { // class 转换函数 |
| 13120 | // staticKeys: ['staticClass'], |
| 13121 | // transformNode: transformNode, |
| 13122 | // genData: genData |
| 13123 | // }, |
| 13124 | // { //style 转换函数 |
| 13125 | // staticKeys: ['staticStyle'], |
| 13126 | // transformNode: transformNode$1, |
| 13127 | // genData: genData$1 |
| 13128 | // }, |
| 13129 | // { |
| 13130 | // preTransformNode: preTransformNode |
| 13131 | // } |
| 13132 | // ] |
| 13133 | |
| 13134 | |
| 13135 | //循环过滤数组或者对象的值,根据key循环 过滤对象或者数组[key]值,如果不存在则丢弃,如果有相同多个的key值,返回多个值的数组 |
| 13136 | transforms = pluckModuleFunction(options.modules, 'transformNode'); |
| 13137 | //循环过滤数组或者对象的值,根据key循环 过滤对象或者数组[key]值,如果不存在则丢弃,如果有相同多个的key值,返回多个值的数组 |
| 13138 | preTransforms = pluckModuleFunction(options.modules, 'preTransformNode'); |
| 13139 | //循环过滤数组或者对象的值,根据key循环 过滤对象或者数组[key]值,如果不存在则丢弃,如果有相同多个的key值,返回多个值的数组 |
| 13140 | postTransforms = pluckModuleFunction(options.modules, 'postTransformNode'); |
| 13141 | console.log('==options==') |
| 13142 | console.log(options) |
| 13143 | |
| 13144 | /* |
| 13145 | 拿到 key transforms值的函数 |
| 13146 | * transforms=[ |
| 13147 | transformNode, //函数 获取 class 属性和:class或者v-bind的动态属性值,并且转化成字符串 添加到staticClass和classBinding 属性中 |
| 13148 | transformNode$1 //函数 transformNode$1获取 style属性和:style或者v-bind的动态属性值,并且转化成字符串 添加到staticStyle和styleBinding属性中 |
| 13149 | * ] |
| 13150 | * */ |
| 13151 | console.log('==transforms==') |
| 13152 | console.log(transforms) |
| 13153 | /* |
| 13154 | 拿到 key preTransforms值的函数 |
| 13155 | * preTransforms=[ |
| 13156 | preTransformNode // preTransformNode把attrsMap与attrsList属性值转换添加到el ast虚拟dom中为虚拟dom添加for,alias,iterator1,iterator2, addRawAttr ,type ,key, ref,slotName或者slotScope或者slot,component或者inlineTemplate , plain,if ,else,elseif 属性 |
| 13157 | * ] |
no test coverage detected