Fix Table Caption infinite recursion.
Add test.
auto merge of #3998 : Hoverbear/servo/fix_table_caption, r=jdm

Fixed #3997.