返回值:ObjectjQuery.support

概述

jQuery 1.3 新增。一组用于展示不同浏览器各自特性和bug的属性集合。

jQuery提供了一系列属性,你也可以自由增加你自己的属性。其中许多属性是很低级的,所以很难说他们能否在日新月异的发展中一直保持有效,但这这些主要用于插件和内核开发者。

所有这些支持的属性值都通过特性检测来实现,而不是用任何浏览器检测。以下有一些非常棒的资源用于解释这些特性检测是如何工作的:
  • http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting
  • http://yura.thinkweb2.com/cft/
  • http://www.jibbering.com/faq/faq_notes/not_browser_detect.html
jQuery.support主要包括以下测试: boxModel: 如果这个页面和浏览器是以W3C CSS盒式模型来渲染的,则等于true。通常在IE 6和IE 7的怪癖模式中这个值是false。在document准备就绪前,这个值是null。 cssFloat: 如果用cssFloat来访问CSS的float的值,则返回true。目前在IE中会返回false,他用styleFloat代替。 hrefNormalized: 如果浏览器从getAttribute("href")返回的是原封不动的结果,则返回true。在IE中会返回false,因为他的URLs已经常规化了。 htmlSerialize: 如果浏览器通过innerHTML插入链接元素的时候会序列化这些链接,则返回true,目前IE中返回false。 leadingWhitespace: 如果在使用innerHTML的时候浏览器会保持前导空白字符,则返回true,目前在IE 6-8中返回false。 noCloneEvent: 如果浏览器在克隆元素的时候不会连同事件处理函数一起复制,则返回true,目前在IE中返回false。 objectAll: 如果在某个元素对象上执行getElementsByTagName("*")会返回所有子孙元素,则为true,目前在IE 7中为false。 opacity: 如果浏览器能适当解释透明度样式属性,则返回true,目前在IE中返回false,因为他用alpha滤镜代替。 scriptEval: 使用 appendChild/createTextNode 方法插入脚本代码时,浏览器是否执行脚本,目前在IE中返回false,IE使用 .text 方法插入脚本代码以执行。 style: 如果getAttribute("style")返回元素的行内样式,则为true。目前IE中为false,因为他用cssText代替。 tbody: 如果浏览器允许table元素不包含tbody元素,则返回true。目前在IE中会返回false,他会自动插入缺失的tbody。

示例

描述:

检测浏览器是否支持盒式模型

jQuery 代码:
jQuery.support.boxModel

目录 索引

输入要查找的关键字:

#id*.class:animated:button:checkbox:checked:contains:disabled:empty:enabled:eq:even:file:first-child:first:gt:has:header:hidden:hidden:image:input:last-child:last:lt:not:nth-child:odd:only-child:parent:password:radio:reset:selected:submit:text:visible[attrSel1][attrSel2][attrSelN][attribute!=value][attribute$=value][attribute*=value][attribute=value][attribute][attributeadd(expr, [context])addClass(class)addClass(function(index, class))after(content)after(function)ajaxComplete(callback)ajaxError(callback)ajaxSend(callback)ajaxStart(callback)ajaxStop(callback)ajaxSuccess(callback)ancestor descendantandSelf()animate(param,[dur],[e],[fn])animate(params, options)append(content)append(function(index, html))appendTo(content)attr(key, fn)attr(key, value)attr(name)attr(properties)before(content)before(function)bind(type, [data], fn)blur()blur(fn)change()change(fn)children([expr])clearQueue([queueName])click()click(fn)clone()clone(true)closest([expr])contents()contextcss(name)css(name, function(index, value))css(name, value)css(properties)data([name])data(name, value)data(obj)dblclick()dblclick(fn)delay(duration, [queueName])dequeue(name)detach([expr])die([type], [fn])each(callback)elementempty()end()eq(index)error()error(fn)fadeIn(speed, [callback])fadeOut(speed, [callback])fadeTo(speed, opacity, [fn])filter(expr)filter(fn)find(expr)first()focus()focus(fn)focusin( [fn] )focusout( [fn] )get()get(index)has(expr)hasClass(class)height()height(val)hide()hide(speed, [callback])hover(over, out)html()html(function(index, html))html(val)index(subject)innerHeight()innerWidth()insertAfter(content)insertBefore(content)is(expr)jQuery()jQuery(callback)jQuery(elements)jQuery(expr, [context])jQuery(html, [ownerDoc])jQuery(html, props)jQuery.ajax([options])jQuery.ajaxSetup([options])jQuery.boxModeljQuery.browser.versionjQuery.browserjQuery.contains(container, contained)jQuery.data([element], [key])jQuery.data(element, key, val)jQuery.each(object, [callback])jQuery.error(message)jQuery.extend([d],tgt,obj1,[objN])jQuery.extend(object)jQuery.fn.extend(object)jQuery.fx.offjQuery.get(url, [data], [fn], [type])jQuery.getJSON(url, [data], [fn])jQuery.getScript(url, [callback])jQuery.grep(array, fn, [invert])jQuery.inArray(value, array)jQuery.isArray(obj)jQuery.isEmptyObject(obj)jQuery.isFunction(obj)jQuery.isPlainObject(obj)jQuery.makeArray(obj)jQuery.map(array, callback)jQuery.merge(first, second)jQuery.noConflict()jQuery.noConflict(extreme)jQuery.noopjQuery.param(obj, [traditional])jQuery.parseJSON(json)jQuery.post(url, [data], [fn], [type])jQuery.proxy(function, scope)jQuery.supportjQuery.toArray()jQuery.trim(str)jQuery.unique(array)keydown()keydown(fn)keypress()keypress(fn)keyup()keyup(fn)last()lengthlive(type, [data], fn)load(url, [data], [callback])map(callback)mousedown(fn)mousemove(fn)mouseout(fn)mouseover(fn)mouseup(fn)next([expr])nextAll([expr])nextUntil([expr])not(expr)offset(coordinates)offsetParent()offsetone(type, [data], fn)outerHeight(options)outerWidth(options)parent > childparent([expr])parents([expr])parentsUntil([expr])position()prepend(content)prepend(function(index, html))prependTo(content)prev + nextprev ~ siblingsprev([expr])prevAll([expr])prevUntil([expr])queue(name ,callback)queue(name)queue(name, queue)ready(fn)remove([expr])removeAttr(name)removeClass(class | fn])removeClass(class)removeData(name)replaceAll(selector)replaceWith(content)resize(fn)scroll(fn)scrollLeft()scrollLeft(val)scrollTop()scrollTop(val)select()select(fn)selector1,selector2,selectorNselectorserialize()serializeArray()show()show(speed, [callback])siblings([expr])size()slice(start, [end])slideDown(speed, [callback])slideToggle(speed, [callback])slideUp(speed, [callback])stop([clearQueue], [gotoEnd])submit()submit(fn)text()text(function(index, text))text(val)toggle()toggle(fn, fn2, [fn3, fn4, ...])toggle(speed, [callback])toggle(switch)toggleClass(class)toggleClass(class, switch)toggleClass(function(index, class), [switch])trigger(type, [data])triggerHandler(type, [data])unbind([type], [data])unload(fn)unwrap()val()val(array)val(function(index, value))val(val)width()width(val)wrap(elem)wrap(fn)wrap(html)wrapAll(elem)wrapAll(html)wrapInner(elem)wrapInner(fn)wrapInner(html)
#id*.class:animated:button:checkbox:checked:contains:disabled:empty:enabled:eq:even:file:first-child:first:gt:has:header:hidden:hidden:image:input:last-child:last:lt:not:nth-child:odd:only-child:parent:password:radio:reset:selected:submit:text:visible[attrSel1][attrSel2][attrSelN][attribute!=value][attribute$=value][attribute*=value][attribute=value][attribute][attributeadd(expr, [context])addClass(class)addClass(function(index, class))after(content)after(function)ajaxComplete(callback)ajaxError(callback)ajaxSend(callback)ajaxStart(callback)ajaxStop(callback)ajaxSuccess(callback)ancestor descendantandSelf()animate(param,[dur],[e],[fn])animate(params, options)append(content)append(function(index, html))appendTo(content)attr(key, fn)attr(key, value)attr(name)attr(properties)before(content)before(function)bind(type, [data], fn)blur()blur(fn)change()change(fn)children([expr])clearQueue([queueName])click()click(fn)clone()clone(true)closest([expr])contents()contextcss(name)css(name, function(index, value))css(name, value)css(properties)data([name])data(name, value)data(obj)dblclick()dblclick(fn)delay(duration, [queueName])dequeue(name)detach([expr])die([type], [fn])each(callback)elementempty()end()eq(index)error()error(fn)fadeIn(speed, [callback])fadeOut(speed, [callback])fadeTo(speed, opacity, [fn])filter(expr)filter(fn)find(expr)first()focus()focus(fn)focusin( [fn] )focusout( [fn] )get()get(index)has(expr)hasClass(class)height()height(val)hide()hide(speed, [callback])hover(over, out)html()html(function(index, html))html(val)index(subject)innerHeight()innerWidth()insertAfter(content)insertBefore(content)is(expr)jQuery()jQuery(callback)jQuery(elements)jQuery(expr, [context])jQuery(html, [ownerDoc])jQuery(html, props)jQuery.ajax([options])jQuery.ajaxSetup([options])jQuery.boxModeljQuery.browser.versionjQuery.browserjQuery.contains(container, contained)jQuery.data([element], [key])jQuery.data(element, key, val)jQuery.each(object, [callback])jQuery.error(message)jQuery.extend([d],tgt,obj1,[objN])jQuery.extend(object)jQuery.fn.extend(object)jQuery.fx.offjQuery.get(url, [data], [fn], [type])jQuery.getJSON(url, [data], [fn])jQuery.getScript(url, [callback])jQuery.grep(array, fn, [invert])jQuery.inArray(value, array)jQuery.isArray(obj)jQuery.isEmptyObject(obj)jQuery.isFunction(obj)jQuery.isPlainObject(obj)jQuery.makeArray(obj)jQuery.map(array, callback)jQuery.merge(first, second)jQuery.noConflict()jQuery.noConflict(extreme)jQuery.noopjQuery.param(obj, [traditional])jQuery.parseJSON(json)jQuery.post(url, [data], [fn], [type])jQuery.proxy(function, scope)jQuery.supportjQuery.toArray()jQuery.trim(str)jQuery.unique(array)keydown()keydown(fn)keypress()keypress(fn)keyup()keyup(fn)last()lengthlive(type, [data], fn)load(url, [data], [callback])map(callback)mousedown(fn)mousemove(fn)mouseout(fn)mouseover(fn)mouseup(fn)next([expr])nextAll([expr])nextUntil([expr])not(expr)offset(coordinates)offsetParent()offsetone(type, [data], fn)outerHeight(options)outerWidth(options)parent > childparent([expr])parents([expr])parentsUntil([expr])position()prepend(content)prepend(function(index, html))prependTo(content)prev + nextprev ~ siblingsprev([expr])prevAll([expr])prevUntil([expr])queue(name ,callback)queue(name)queue(name, queue)ready(fn)remove([expr])removeAttr(name)removeClass(class | fn])removeClass(class)removeData(name)replaceAll(selector)replaceWith(content)resize(fn)scroll(fn)scrollLeft()scrollLeft(val)scrollTop()scrollTop(val)select()select(fn)selector1,selector2,selectorNselectorserialize()serializeArray()show()show(speed, [callback])siblings([expr])size()slice(start, [end])slideDown(speed, [callback])slideToggle(speed, [callback])slideUp(speed, [callback])stop([clearQueue], [gotoEnd])submit()submit(fn)text()text(function(index, text))text(val)toggle()toggle(fn, fn2, [fn3, fn4, ...])toggle(speed, [callback])toggle(switch)toggleClass(class)toggleClass(class, switch)toggleClass(function(index, class), [switch])trigger(type, [data])triggerHandler(type, [data])unbind([type], [data])unload(fn)unwrap()val()val(array)val(function(index, value))val(val)width()width(val)wrap(elem)wrap(fn)wrap(html)wrapAll(elem)wrapAll(html)wrapInner(elem)wrapInner(fn)wrapInner(html)