There is a step that is confusingly worded in the AAA:
- Insert whatever last node ended up being in the previous step at the appropriate place for inserting a node, but using common ancestor as the override target.
This doesn't say to remove that element from its previous parent, but I think it is implied. The go X package for this algorithm does this and I think that is what they meant (https://github.com/golang/net/blob/master/html/parse.go#L1309). I think it should be better read as "take that node that was in lastNode and move it in the DOM (effectively removing it from its previous place in the DOM and reinserting it in the new place). I am making this a ticket because it took me a long time to identify this issue in my implementation because of the wording of the spec. My test cases kept failing and I think this was the culprit.
There is a step that is confusingly worded in the AAA:
This doesn't say to remove that element from its previous parent, but I think it is implied. The go X package for this algorithm does this and I think that is what they meant (https://github.com/golang/net/blob/master/html/parse.go#L1309). I think it should be better read as "take that node that was in lastNode and move it in the DOM (effectively removing it from its previous place in the DOM and reinserting it in the new place). I am making this a ticket because it took me a long time to identify this issue in my implementation because of the wording of the spec. My test cases kept failing and I think this was the culprit.