(html, options)
| 7384 | } |
| 7385 | |
| 7386 | function parseHTML (html, options) { |
| 7387 | var stack = []; |
| 7388 | var expectHTML = options.expectHTML; |
| 7389 | var isUnaryTag$$1 = options.isUnaryTag || no; |
| 7390 | var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no; |
| 7391 | var index = 0; |
| 7392 | var last, lastTag; |
| 7393 | while (html) { |
| 7394 | last = html; |
| 7395 | // Make sure we're not in a plaintext content element like script/style |
| 7396 | if (!lastTag || !isPlainTextElement(lastTag)) { |
| 7397 | var textEnd = html.indexOf('<'); |
| 7398 | if (textEnd === 0) { |
| 7399 | // Comment: |
| 7400 | if (comment.test(html)) { |
| 7401 | var commentEnd = html.indexOf('-->'); |
| 7402 | |
| 7403 | if (commentEnd >= 0) { |
| 7404 | advance(commentEnd + 3); |
| 7405 | continue |
| 7406 | } |
| 7407 | } |
| 7408 | |
| 7409 | // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment |
| 7410 | if (conditionalComment.test(html)) { |
| 7411 | var conditionalEnd = html.indexOf(']>'); |
| 7412 | |
| 7413 | if (conditionalEnd >= 0) { |
| 7414 | advance(conditionalEnd + 2); |
| 7415 | continue |
| 7416 | } |
| 7417 | } |
| 7418 | |
| 7419 | // Doctype: |
| 7420 | var doctypeMatch = html.match(doctype); |
| 7421 | if (doctypeMatch) { |
| 7422 | advance(doctypeMatch[0].length); |
| 7423 | continue |
| 7424 | } |
| 7425 | |
| 7426 | // End tag: |
| 7427 | var endTagMatch = html.match(endTag); |
| 7428 | if (endTagMatch) { |
| 7429 | var curIndex = index; |
| 7430 | advance(endTagMatch[0].length); |
| 7431 | parseEndTag(endTagMatch[1], curIndex, index); |
| 7432 | continue |
| 7433 | } |
| 7434 | |
| 7435 | // Start tag: |
| 7436 | var startTagMatch = parseStartTag(); |
| 7437 | if (startTagMatch) { |
| 7438 | handleStartTag(startTagMatch); |
| 7439 | continue |
| 7440 | } |
| 7441 | } |
| 7442 | |
| 7443 | var text = (void 0), rest$1 = (void 0), next = (void 0); |
no test coverage detected