検証に失敗するコントラスト スイッチャーがあります。スクリプト タグ内で CDATA セクションが必要になるのはいつですか?を読みました。 文字をエスケープしてCDATAを使用しようとしましたが、両方でまだ検証エラーが発生しています。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<script type="text/javascript">
$(document).ready(function(){
// DRY wrapper function
function appendStyleSheet() {
$('head').append('<link rel="stylesheet" href="{site_url}css/high-contrast.css" type="text/css" id="hc_stylesheet"/>');
}
// append the style sheet on load if the cookie is set to true
if ($.cookie('high_contrast_momentum') == 'true') {
appendStyleSheet();
}
$("#contrast-btn a").click(function () {
if ($.cookie('high_contrast_momentum') != 'true') {
appendStyleSheet();
$.cookie('high_contrast_momentum', 'true', {expires:365}); // set the cookie to true
}
else {
// remove the high-contrast style
$("#hc_stylesheet").remove();
$.cookie('high_contrast_momentum', 'false');
}
});
});
</script>
私が得ている検証エラーは次のとおりです。ドキュメントタイプは要素「リンク」を許可していません