您好,登錄后才能下訂單哦!
這篇文章主要介紹“jQuery.cssHooks的功能實(shí)例測(cè)試”的相關(guān)知識(shí),小編通過(guò)實(shí)際案例向大家展示操作過(guò)程,操作方法簡(jiǎn)單快捷,實(shí)用性強(qiáng),希望這篇“jQuery.cssHooks的功能實(shí)例測(cè)試”文章能幫助大家解決問(wèn)題。
Feature Testing(功能測(cè)試)
在使供應(yīng)商特定的CSS屬性標(biāo)準(zhǔn)化前,首先要確定瀏覽器是否支持標(biāo)準(zhǔn)的屬性 或 帶瀏覽器供應(yīng)商前綴的變種。例如,檢查支持border-radius 屬性,還要檢查該屬性的任何變種寫(xiě)法是否是臨時(shí)元素的 style 對(duì)象中的成員。
(function($) {
function styleSupport( prop ) {
var vendorProp, supportedProp,
// capitalize first character of the prop to test vendor prefix
capProp = prop.charAt(0).toUpperCase() + prop.slice(1),
prefixes = [ "Moz", "Webkit", "O", "ms" ],
div = document.createElement( "div" );
if ( prop in div.style ) {
// browser supports standard CSS property name
supportedProp = prop;
} else {
// otherwise test support for vendor-prefixed property names
for ( var i = 0; i < prefixes.length; i++ ) {
vendorProp = prefixes[i] + capProp;
if ( vendorProp in div.style ) {
supportedProp = vendorProp;
break;
}
}
}
// avoid memory leak in IE
div = null;
// add property to $.support so it can be accessed elsewhere
$.support[ prop ] = supportedProp;
return supportedProp;
}
// call the function, e.g. testing for "border-radius" support:
styleSupport( "borderRadius" );
})(jQuery);
關(guān)于“jQuery.cssHooks的功能實(shí)例測(cè)試”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí),可以關(guān)注億速云行業(yè)資訊頻道,小編每天都會(huì)為大家更新不同的知識(shí)點(diǎn)。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。