jQueryにおけるブラウザの各種サポート状態を返す

書式

jQuery.support.★

★:調べたいプロパティ名

説明

jQuery 1.3以前ではjQuery.browserなど個別のプロパティでブラウザのサポート状態を調べていましたが、1.3以降ではjQuery.supportオブジェクト内のプロパティにまとめられました。ただし、プラグインなどの互換性のため以前のjQuery.browserなどは残されたままになっています。

サンプルコード [実行]

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<link rel="stylesheet" href="main.css" type="text/css" media="all">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript"><!--
$(function(){
var bSupport = jQuery.support;
var txt = "";
txt = "boxModel = "+bSupport.boxModel+"<br>";
txt += "cssFloat = "+bSupport.cssFloat+"<br>";
txt += "hrefNormalized = "+bSupport.hrefNormalized+"<br>";
txt += "htmlSerialize = "+bSupport.htmlSerialize+"<br>";
txt += "leadingWhitespace = "+bSupport.leadingWhitespace+"<br>";
txt += "noCloneEvent = "+bSupport.noCloneEvent+"<br>";
txt += "objectAll = "+bSupport.objectAll+"<br>";
txt += "opacity = "+bSupport.opacity+"<br>";
txt += "scriptEval = "+bSupport.scriptEval+"<br>";
txt += "style = "+bSupport.style+"<br>";
txt += "tbody = "+bSupport.tbody+"<br>";
$("#result").html(txt);
});
// --></script>
</head>
<body>
<h1>各種ブラウザのサポート状態を調べる</h1>
<div id="result"></div>
</body>
</html>