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