MCPcopy
hub / github.com/fanmingming/live / parseHTML

Function parseHTML

m3u8/vue.js:9279–9530  ·  view source on GitHub ↗
(html, options)

Source from the content-addressed store, hash-verified

9277 }
9278
9279 function parseHTML (html, options) {
9280 var stack = [];
9281 var expectHTML = options.expectHTML;
9282 var isUnaryTag$$1 = options.isUnaryTag || no;
9283 var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
9284 var index = 0;
9285 var last, lastTag;
9286 while (html) {
9287 last = html;
9288 // Make sure we're not in a plaintext content element like script/style
9289 if (!lastTag || !isPlainTextElement(lastTag)) {
9290 var textEnd = html.indexOf('<');
9291 if (textEnd === 0) {
9292 // Comment:
9293 if (comment.test(html)) {
9294 var commentEnd = html.indexOf('-->');
9295
9296 if (commentEnd >= 0) {
9297 if (options.shouldKeepComment) {
9298 options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
9299 }
9300 advance(commentEnd + 3);
9301 continue
9302 }
9303 }
9304
9305 // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
9306 if (conditionalComment.test(html)) {
9307 var conditionalEnd = html.indexOf(']>');
9308
9309 if (conditionalEnd >= 0) {
9310 advance(conditionalEnd + 2);
9311 continue
9312 }
9313 }
9314
9315 // Doctype:
9316 var doctypeMatch = html.match(doctype);
9317 if (doctypeMatch) {
9318 advance(doctypeMatch[0].length);
9319 continue
9320 }
9321
9322 // End tag:
9323 var endTagMatch = html.match(endTag);
9324 if (endTagMatch) {
9325 var curIndex = index;
9326 advance(endTagMatch[0].length);
9327 parseEndTag(endTagMatch[1], curIndex, index);
9328 continue
9329 }
9330
9331 // Start tag:
9332 var startTagMatch = parseStartTag();
9333 if (startTagMatch) {
9334 handleStartTag(startTagMatch);
9335 if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
9336 advance(1);

Callers 1

parseFunction · 0.85

Calls 5

advanceFunction · 0.85
parseEndTagFunction · 0.85
parseStartTagFunction · 0.85
handleStartTagFunction · 0.85
shouldIgnoreFirstNewlineFunction · 0.85

Tested by

no test coverage detected