(quote, end)
| 310 | }, |
| 311 | |
| 312 | onattribend(quote, end) { |
| 313 | if (currentOpenTag && currentProp) { |
| 314 | // finalize end pos |
| 315 | setLocEnd(currentProp.loc, end) |
| 316 | |
| 317 | if (quote !== QuoteType.NoValue) { |
| 318 | if (__BROWSER__ && currentAttrValue.includes('&')) { |
| 319 | currentAttrValue = currentOptions.decodeEntities!( |
| 320 | currentAttrValue, |
| 321 | true, |
| 322 | ) |
| 323 | } |
| 324 | |
| 325 | if (currentProp.type === NodeTypes.ATTRIBUTE) { |
| 326 | // assign value |
| 327 | |
| 328 | // condense whitespaces in class |
| 329 | if (currentProp!.name === 'class') { |
| 330 | currentAttrValue = condense(currentAttrValue).trim() |
| 331 | } |
| 332 | |
| 333 | if (quote === QuoteType.Unquoted && !currentAttrValue) { |
| 334 | emitError(ErrorCodes.MISSING_ATTRIBUTE_VALUE, end) |
| 335 | } |
| 336 | |
| 337 | currentProp!.value = { |
| 338 | type: NodeTypes.TEXT, |
| 339 | content: currentAttrValue, |
| 340 | loc: |
| 341 | quote === QuoteType.Unquoted |
| 342 | ? getLoc(currentAttrStartIndex, currentAttrEndIndex) |
| 343 | : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1), |
| 344 | } |
| 345 | if ( |
| 346 | tokenizer.inSFCRoot && |
| 347 | currentOpenTag.tag === 'template' && |
| 348 | currentProp.name === 'lang' && |
| 349 | currentAttrValue && |
| 350 | currentAttrValue !== 'html' |
| 351 | ) { |
| 352 | // SFC root template with preprocessor lang, force tokenizer to |
| 353 | // RCDATA mode |
| 354 | tokenizer.enterRCDATA(toCharCodes(`</template`), 0) |
| 355 | } |
| 356 | } else { |
| 357 | // directive |
| 358 | let expParseMode = ExpParseMode.Normal |
| 359 | if (!__BROWSER__) { |
| 360 | if (currentProp.name === 'for') { |
| 361 | expParseMode = ExpParseMode.Skip |
| 362 | } else if (currentProp.name === 'slot') { |
| 363 | expParseMode = ExpParseMode.Params |
| 364 | } else if ( |
| 365 | currentProp.name === 'on' && |
| 366 | currentAttrValue.includes(';') |
| 367 | ) { |
| 368 | expParseMode = ExpParseMode.Statements |
| 369 | } |
nothing calls this directly
no test coverage detected