Revert "opt: [mdx]js script with defer attribute (#1869)"

This reverts commit 939e786331.
This commit is contained in:
YiFang Xiao 2024-12-04 12:04:21 +08:00
parent 5982b1d337
commit 612dc8db0f

View file

@ -959,7 +959,7 @@ void MdxDictionary::replaceLinks( QString & id, QString & article )
continue; continue;
} }
else { else {
//audio ,script,video ,html5 tags fall here. //audio ,video ,html5 tags fall here.
match = RX::Mdx::srcRe.match( linkTxt ); match = RX::Mdx::srcRe.match( linkTxt );
if ( match.hasMatch() ) { if ( match.hasMatch() ) {
QString newText; QString newText;
@ -971,15 +971,9 @@ void MdxDictionary::replaceLinks( QString & id, QString & article )
else { else {
scheme = "bres://"; scheme = "bres://";
} }
newText = newText =
match.captured( 1 ) + match.captured( 2 ) + scheme + id + "/" + match.captured( 3 ) + match.captured( 2 ); match.captured( 1 ) + match.captured( 2 ) + scheme + id + "/" + match.captured( 3 ) + match.captured( 2 );
//add defer to script tag
if ( linkType.compare( "script" ) == 0 ) {
newText = newText + " defer ";
}
newLink = linkTxt.replace( match.capturedStart(), match.capturedLength(), newText ); newLink = linkTxt.replace( match.capturedStart(), match.capturedLength(), newText );
} }
else { else {