File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,17 @@ limitations under the License.
73
73
} ) ;
74
74
}
75
75
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
+
76
87
function cloneStaticAndInline ( doc ) {
77
88
// Inline the images on the source document instead of the copy
78
89
// because the copy doesn't have time to load the images.
@@ -88,6 +99,8 @@ limitations under the License.
88
99
removeAll ( copy . querySelectorAll ( 'template' ) ) ;
89
100
removeAll ( copy . querySelectorAll ( 'cxx-publish-button' ) ) ;
90
101
102
+ fixNestedCaptions ( copy ) ;
103
+
91
104
// Inline all style sheets.
92
105
var sheetUpdates = Array . prototype . map . call (
93
106
copy . querySelectorAll ( 'link[rel="stylesheet"]' ) ,
You can’t perform that action at this time.
0 commit comments