// cache check for defaultView.getComputedStyle
getComputedStyle = document.defaultView && document.defaultView.getComputedStyle,
// normalize float css property
- styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat";
+ styleFloat = jQuery.support.cssFloat ? "cssFloat" : "styleFloat",
+ fcamelCase = function(all, letter){
+ return letter.toUpperCase();
+ };
jQuery.fn.css = function( name, value ) {
var options = name, isFunction = jQuery.isFunction( value );
if ( /float/i.test( name ) )
name = styleFloat;
- name = name.replace(/-([a-z])/ig, function(all, letter){
- return letter.toUpperCase();
- });
+ name = name.replace(/-([a-z])/ig, fcamelCase);
if ( set )
style[ name ] = value;
ret = "1";
} else if ( elem.currentStyle ) {
- var camelCase = name.replace(/\-(\w)/g, function(all, letter){
- return letter.toUpperCase();
- });
+ var camelCase = name.replace(/\-(\w)/g, fcamelCase);
ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
rxhtmlTag = /(<(\w+)[^>]*?)\/>/g,
rselfClosing = /^(?:abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i,
rinsideTable = /^<(thead|tbody|tfoot|colg|cap)/,
- rtbody = /<tbody/i;
+ rtbody = /<tbody/i,
+ fcloseTag = function(all, front, tag){
+ return rselfClosing.test(tag) ?
+ all :
+ front + "></" + tag + ">";
+ });
jQuery.fn.extend({
text: function( text ) {
// Convert html string into DOM nodes
if ( typeof elem === "string" ) {
// Fix "XHTML"-style tags in all browsers
- elem = elem.replace(rxhtmlTag, function(all, front, tag){
- return rselfClosing.test(tag) ?
- all :
- front + "></" + tag + ">";
- });
+ elem = elem.replace(rxhtmlTag, fcloseTag);
// Trim whitespace, otherwise indexOf won't work as expected
var tags = elem.replace(rleadingWhitespace, "")