Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf039c18

Browse files
committed
Avoid <caption>s inside <caption>s, since some browsers render that badly.
1 parent365d26e commitf039c18

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎publish.js‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
functionfixNestedCaptions(doc){
79+
doc.querySelectorAll('caption caption').array().forEach(function(caption){
80+
varspan=doc.createElement('span');
81+
span.innerHTML=caption.innerHTML;
82+
caption.parentNode.insertBefore(span,caption);
83+
caption.remove();
84+
});
85+
}
86+
7687
functioncloneStaticAndInline(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.
8899
removeAll(copy.querySelectorAll('template'));
89100
removeAll(copy.querySelectorAll('cxx-publish-button'));
90101

102+
fixNestedCaptions(copy);
103+
91104
// Inline all style sheets.
92105
varsheetUpdates=Array.prototype.map.call(
93106
copy.querySelectorAll('link[rel="stylesheet"]'),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp