MCPcopy
hub / github.com/golang/net / resetInsertionMode

Method resetInsertionMode

html/parse.go:449–503  ·  view source on GitHub ↗

Section 12.2.4.1, "reset the insertion mode".

()

Source from the content-addressed store, hash-verified

447
448// Section 12.2.4.1, "reset the insertion mode".
449func (p *parser) resetInsertionMode() {
450 for i := len(p.oe) - 1; i >= 0; i-- {
451 n := p.oe[i]
452 last := i == 0
453 if last && p.context != nil {
454 n = p.context
455 }
456
457 switch n.DataAtom {
458 case a.Td, a.Th:
459 // TODO: remove this divergence from the HTML5 spec.
460 //
461 // See https://bugs.chromium.org/p/chromium/issues/detail?id=829668
462 p.im = inCellIM
463 case a.Tr:
464 p.im = inRowIM
465 case a.Tbody, a.Thead, a.Tfoot:
466 p.im = inTableBodyIM
467 case a.Caption:
468 p.im = inCaptionIM
469 case a.Colgroup:
470 p.im = inColumnGroupIM
471 case a.Table:
472 p.im = inTableIM
473 case a.Template:
474 // TODO: remove this divergence from the HTML5 spec.
475 if n.Namespace != "" {
476 continue
477 }
478 p.im = p.templateStack.top()
479 case a.Head:
480 // TODO: remove this divergence from the HTML5 spec.
481 //
482 // See https://bugs.chromium.org/p/chromium/issues/detail?id=829668
483 p.im = inHeadIM
484 case a.Body:
485 p.im = inBodyIM
486 case a.Frameset:
487 p.im = inFramesetIM
488 case a.Html:
489 if p.head == nil {
490 p.im = beforeHeadIM
491 } else {
492 p.im = afterHeadIM
493 }
494 default:
495 if last {
496 p.im = inBodyIM
497 return
498 }
499 continue
500 }
501 return
502 }
503}
504
505const whitespace = " \t\r\n\f"
506

Callers 4

ParseFragmentWithOptionsFunction · 0.95
inHeadIMFunction · 0.80
inTableIMFunction · 0.80
inTemplateIMFunction · 0.80

Calls 1

topMethod · 0.45

Tested by

no test coverage detected