@@ -73,6 +73,17 @@ limitations under the License.
7373} ) ;
7474}
7575
76+ // Replaces <caption>s inside <caption>s with <spans>, so that Firefox doesn't
77+ // omit them from the rendering.
78+ function fixNestedCaptions ( doc ) {
79+ doc . querySelectorAll ( 'caption caption' ) . array ( ) . forEach ( function ( caption ) {
80+ var span = doc . createElement ( 'span' ) ;
81+ span . innerHTML = caption . innerHTML ;
82+ caption . parentNode . insertBefore ( span , caption ) ;
83+ caption . remove ( ) ;
84+ } ) ;
85+ }
86+
7687function cloneStaticAndInline ( doc ) {
7788// Inline the images on the source document instead of the copy
7889// because the copy doesn't have time to load the images.
@@ -88,6 +99,8 @@ limitations under the License.
8899removeAll ( copy . querySelectorAll ( 'template' ) ) ;
89100removeAll ( copy . querySelectorAll ( 'cxx-publish-button' ) ) ;
90101
102+ fixNestedCaptions ( copy ) ;
103+
91104// Inline all style sheets.
92105var sheetUpdates = Array . prototype . map . call (
93106copy . querySelectorAll ( 'link[rel="stylesheet"]' ) ,