Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Functional example Test of jQuery.cssHooks

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "functional instance testing of jQuery.cssHooks". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this "functional instance testing of jQuery.cssHooks" article can help you solve the problem.

Feature Testing (functional testing)

Before standardizing vendor-specific CSS attributes, first determine whether the browser supports standard attributes or variants with browser vendor prefixes. For example, check that the border-radius attribute is supported, and also check whether any variants of the attribute are members of the style object of the temporary element.

(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; iTunes +) {

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)

This is the end of the content of "functional example testing of jQuery.cssHooks". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report